mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 02:45:39 -04:00
- Convert discover, stats, status, and system-health server actions to proper API route handlers under `app/api/`; delete `lib/actions/explore.ts`, `lib/actions/settings.ts`, and `lib/actions/setup.ts` - Add `use-discover`, `use-stats`, and `use-system-health` SWR hooks that call the new routes; update `command-palette`, `title-card`, `update-toast`, and `stats-display` to consume them - Lift auth centering wrapper from individual login/register pages into `(auth)/layout.tsx`; switch both pages from `auth.api.getSession` to the cached `getSession()` helper - Relocate setup wizard from `app/(auth)/setup/` to `app/setup/` (outside auth group) with dedicated `copy-button` and `refresh-button` client components - Move `not-found.tsx` and `error.tsx` to app root so they apply globally instead of only within the pages route group
37 lines
824 B
TypeScript
37 lines
824 B
TypeScript
"use client";
|
|
|
|
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
|
import { useState } from "react";
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
export function CopyButton({ code }: { code: string }) {
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
function handleCopy() {
|
|
navigator.clipboard.writeText(code);
|
|
setCopied(true);
|
|
setTimeout(() => setCopied(false), 2000);
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={handleCopy}
|
|
className="text-[11px] text-muted-foreground"
|
|
>
|
|
{copied ? (
|
|
<>
|
|
<IconCheck aria-hidden={true} className="size-3 text-green-400" />
|
|
Copied
|
|
</>
|
|
) : (
|
|
<>
|
|
<IconCopy aria-hidden={true} className="size-3" />
|
|
Copy
|
|
</>
|
|
)}
|
|
</Button>
|
|
);
|
|
}
|