Initial commit. Spun up via the docs/STARTER.md recipe: cp from vibespace, reset git, rename package, set brand to "Arcadia Admin" with Shield icon in app/lib/identity.ts. Inherits the full Crema sibling-lib wiring including @crema/arcadia-client (typed HTTP + Phoenix Channels realtime against arcadia-core) and @crema/arcadia-auth-ui (login/signup/password-reset/2FA forms). The /login route already renders <LoginForm>; <ArcadiaProvider> in app/root.tsx reads VITE_ARCADIA_URL (default localhost:4000) and VITE_ARCADIA_TENANT (default "default"). CLAUDE.md and README rewritten to frame this as the admin app for arcadia-core. docs/STARTER.md removed — arcadia-admin is a leaf consumer, not a downstream starter. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
166 lines
3.6 KiB
TypeScript
166 lines
3.6 KiB
TypeScript
import { Check, Copy } from "lucide-react"
|
|
import { useState, type ComponentProps } from "react"
|
|
|
|
import { cn } from "~/lib/utils"
|
|
|
|
function CodeBlock({
|
|
className,
|
|
children,
|
|
...props
|
|
}: ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="code-block"
|
|
className={cn(
|
|
"overflow-hidden rounded-lg border bg-muted/30 font-mono text-sm",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function CodeBlockHeader({ className, ...props }: ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="code-block-header"
|
|
className={cn(
|
|
"flex items-center justify-between border-b bg-muted/50 px-3 py-1.5",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockLang({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-lang"
|
|
className={cn(
|
|
"text-xs font-medium tracking-wide text-muted-foreground uppercase",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockCopyButton({
|
|
className,
|
|
value,
|
|
...props
|
|
}: Omit<ComponentProps<"button">, "onClick" | "children"> & { value: string }) {
|
|
const [copied, setCopied] = useState(false)
|
|
|
|
function handleCopy() {
|
|
navigator.clipboard.writeText(value).then(() => {
|
|
setCopied(true)
|
|
setTimeout(() => setCopied(false), 1500)
|
|
})
|
|
}
|
|
|
|
return (
|
|
<button
|
|
data-slot="code-block-copy"
|
|
type="button"
|
|
onClick={handleCopy}
|
|
className={cn(
|
|
"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
"[&_svg]:size-3",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{copied ? <Check /> : <Copy />}
|
|
{copied ? "Copied" : "Copy"}
|
|
</button>
|
|
)
|
|
}
|
|
|
|
function CodeBlockContent({ className, ...props }: ComponentProps<"pre">) {
|
|
return (
|
|
<pre
|
|
data-slot="code-block-content"
|
|
className={cn("overflow-x-auto p-4 text-sm leading-relaxed", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockKeyword({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-keyword"
|
|
className={cn("text-syntax-keyword", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockString({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-string"
|
|
className={cn("text-syntax-string", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockNumber({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-number"
|
|
className={cn("text-syntax-number", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockComment({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-comment"
|
|
className={cn("text-syntax-comment italic", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockFunction({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-function"
|
|
className={cn("text-syntax-function", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function CodeBlockType({ className, ...props }: ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
data-slot="code-block-type"
|
|
className={cn("text-syntax-type", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export {
|
|
CodeBlock,
|
|
CodeBlockHeader,
|
|
CodeBlockLang,
|
|
CodeBlockCopyButton,
|
|
CodeBlockContent,
|
|
CodeBlockKeyword,
|
|
CodeBlockString,
|
|
CodeBlockNumber,
|
|
CodeBlockComment,
|
|
CodeBlockFunction,
|
|
CodeBlockType,
|
|
}
|