Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Jan 10, 2025
1 parent 9248cb4 commit a85d24e
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 138 deletions.
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
}
3 changes: 2 additions & 1 deletion src/components/compose-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export function ComposePost({ onSubmit }) {
const [isThreadMode, setIsThreadMode] = useState(false);
const [posts, setPosts] = useState([{ text: "", image: null }]);
const [error, setError] = useState("");
const { setModalOpen, saveDraft, saveAutoSave, clearAutoSave, autosave } = useDraftsStore();
const { setModalOpen, saveDraft, saveAutoSave, clearAutoSave, autosave } =
useDraftsStore();

// Load auto-saved content on mount
useEffect(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/drafts-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export function DraftsModal({ onSelect }) {
</div>

{drafts.length === 0 ? (
<p className="text-gray-600 text-center py-8">No drafts saved yet</p>
<p className="text-gray-600 text-center py-8">
No drafts saved yet
</p>
) : (
<div className="space-y-4 max-h-[60vh] overflow-y-auto">
{drafts.map((draft) => (
Expand Down
9 changes: 5 additions & 4 deletions src/components/twitter-api-notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ export function TwitterApiNotice() {
We've been ratelimited.
</DialogTitle>
<DialogDescription className="text-gray-600">
We exceeded our ration of 17 tweets per 24 hours... so while we wait until {format(new Date(1736524953 * 1000), "h:mm a 'on' MMM d, yyyy")}, we're raising funds to pay the absurd $200/month API fee.
We exceeded our ration of 17 tweets per 24 hours... so while we
wait until{" "}
{format(new Date(1736524953 * 1000), "h:mm a 'on' MMM d, yyyy")}
, we're raising funds to pay the absurd $200/month API fee.
</DialogDescription>
<div className="pt-2 flex gap-4">
<Button
asChild
>
<Button asChild>
<a
href="https://app.potlock.org/?tab=project&projectId=crosspost.near"
target="_blank"
Expand Down
41 changes: 23 additions & 18 deletions src/components/ui/button.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";

import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-2 border-gray-800 hover:bg-gray-100 shadow-[2px_2px_0_rgba(0,0,0,1)]",
{
variants: {
variant: {
default: "bg-white",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "bg-white",
secondary: "bg-white",
ghost: "border-0 shadow-none hover:bg-accent hover:text-accent-foreground",
ghost:
"border-0 shadow-none hover:bg-accent hover:text-accent-foreground",
link: "border-0 shadow-none text-primary underline-offset-4 hover:underline",
},
size: {
Expand All @@ -27,18 +29,21 @@ const buttonVariants = cva(
variant: "default",
size: "default",
},
}
)
},
);

const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
(<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props} />)
);
})
Button.displayName = "Button"
const Button = React.forwardRef(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
);
Button.displayName = "Button";

export { Button, buttonVariants }
export { Button, buttonVariants };
122 changes: 66 additions & 56 deletions src/components/ui/dialog.jsx
Original file line number Diff line number Diff line change
@@ -1,84 +1,94 @@
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";

import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";

const Dialog = DialogPrimitive.Root
const Dialog = DialogPrimitive.Root;

const DialogTrigger = DialogPrimitive.Trigger
const DialogTrigger = DialogPrimitive.Trigger;

const DialogPortal = DialogPrimitive.Portal
const DialogPortal = DialogPrimitive.Portal;

const DialogClose = DialogPrimitive.Close
const DialogClose = DialogPrimitive.Close;

const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
className,
)}
{...props} />
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
{...props}
/>
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;

const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay className="bg-black/20" />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border-2 border-gray-800 bg-white p-6 shadow-[4px_4px_0_rgba(0,0,0,1)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}>
{children}
<DialogPrimitive.Close
className="absolute right-4 top-4 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
const DialogContent = React.forwardRef(
({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay className="bg-black/20" />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border-2 border-gray-800 bg-white p-6 shadow-[4px_4px_0_rgba(0,0,0,1)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className,
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
),
);
DialogContent.displayName = DialogPrimitive.Content.displayName;

const DialogHeader = ({
className,
...props
}) => (
const DialogHeader = ({ className, ...props }) => (
<div
className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)}
{...props} />
)
DialogHeader.displayName = "DialogHeader"
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className,
)}
{...props}
/>
);
DialogHeader.displayName = "DialogHeader";

const DialogFooter = ({
className,
...props
}) => (
const DialogFooter = ({ className, ...props }) => (
<div
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
{...props} />
)
DialogFooter.displayName = "DialogFooter"
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className,
)}
{...props}
/>
);
DialogFooter.displayName = "DialogFooter";

const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
{...props} />
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className,
)}
{...props}
/>
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;

const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props} />
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
{...props}
/>
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;

export {
Dialog,
Expand All @@ -91,4 +101,4 @@ export {
DialogFooter,
DialogTitle,
DialogDescription,
}
};
4 changes: 1 addition & 3 deletions src/components/window-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export const WindowControls = () => {
</div>
{signedAccountId && (
<div className="mt-4 space-y-1 text-center sm:text-left">
<p className="text-sm text-gray-600">
NEAR: {signedAccountId}
</p>
<p className="text-sm text-gray-600">NEAR: {signedAccountId}</p>
{isConnected && handle && (
<p className="text-sm text-gray-600">Twitter: @{handle}</p>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge"
import { twMerge } from "tailwind-merge";

export function cn(...inputs) {
return twMerge(clsx(inputs));
Expand Down
4 changes: 2 additions & 2 deletions src/store/drafts-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ export const useDraftsStore = create((set, get) => ({
},

saveAutoSave: (posts) => {
if (posts.every(p => !p.text.trim())) {
if (posts.every((p) => !p.text.trim())) {
// If all posts are empty, clear autosave
localStorage.removeItem(AUTOSAVE_KEY);
set({ autosave: null });
return;
}

const autosave = {
posts,
updatedAt: new Date().toISOString(),
Expand Down
Loading

0 comments on commit a85d24e

Please sign in to comment.