Hybrid traditional + AI-first webapp scaffold. Sibling to crema-app-template, adds the AI assistant surface, command bus, scripts dialog, and virtual cursor. What's pre-wired: - 6 routes: Overview, Resources, Activity, Assistant, Library, Settings - Collapsible rail + appbar + avatar dropdown shell (template code, not a lib) - Mobile sheet at <md - /assistant: streaming chat via @crema/llm-ui, mock fallback, model selector, token meter, retry probe, stop-while-streaming, persistent UI Control toggle - /settings: editable LM Studio endpoint + context window + response cap, with test-connection button - Markdown rendering for assistant replies; ```action``` blocks rendered as a small "Ran N actions" pill - ⌘⇧P script runner dialog + Play icon in the appbar - Two demo scripts in public/scripts/ - mightypix theme as default, scoped via <AppShell theme="mightypix"> Libs wired in tsconfig + app.css: - @crema/action-bus (the bus, parser, runner, cursor, provider, ws, llm-bridge) - @crema/llm-ui, @crema/chat-ui, @crema/aifirst-ui, @crema/notification-ui - lib-theme-mightypix Docs: - README.md — pitch + quick start + structure - docs/AI_FIRST.md — full system tour (data-action contract, bus, DSL, scripts, cursor, LLM integration) - app/components/layout/THEME_CONTRACT.md — every CSS variable a theme must declare - CLAUDE.md — orientation for an LLM working in the repo Genericized from comfy-cloud (the original prototype): - Brand defaults to "App" / Sparkles icon (override via app/lib/identity.ts) - User defaults to a stub (swap useUser() for real auth) - localStorage namespace is "crema.*" (was "comfy.*") Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
131 lines
2.8 KiB
TypeScript
131 lines
2.8 KiB
TypeScript
import * as React from "react"
|
|
|
|
import { cn } from "~/lib/utils"
|
|
import { Button } from "~/components/ui/button"
|
|
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react"
|
|
|
|
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
return (
|
|
<nav
|
|
role="navigation"
|
|
aria-label="pagination"
|
|
data-slot="pagination"
|
|
className={cn("mx-auto flex w-full justify-center", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function PaginationContent({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"ul">) {
|
|
return (
|
|
<ul
|
|
data-slot="pagination-content"
|
|
className={cn("flex items-center gap-0.5", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
|
return <li data-slot="pagination-item" {...props} />
|
|
}
|
|
|
|
type PaginationLinkProps = {
|
|
isActive?: boolean
|
|
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
|
React.ComponentProps<"a">
|
|
|
|
function PaginationLink({
|
|
className,
|
|
isActive,
|
|
size = "icon",
|
|
...props
|
|
}: PaginationLinkProps) {
|
|
return (
|
|
<Button
|
|
variant={isActive ? "outline" : "ghost"}
|
|
size={size}
|
|
className={cn(className)}
|
|
nativeButton={false}
|
|
render={
|
|
<a
|
|
aria-current={isActive ? "page" : undefined}
|
|
data-slot="pagination-link"
|
|
data-active={isActive}
|
|
{...props}
|
|
/>
|
|
}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function PaginationPrevious({
|
|
className,
|
|
text = "Previous",
|
|
...props
|
|
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
return (
|
|
<PaginationLink
|
|
aria-label="Go to previous page"
|
|
size="default"
|
|
className={cn("pl-1.5!", className)}
|
|
{...props}
|
|
>
|
|
<ChevronLeftIcon data-icon="inline-start" />
|
|
<span className="hidden sm:block">{text}</span>
|
|
</PaginationLink>
|
|
)
|
|
}
|
|
|
|
function PaginationNext({
|
|
className,
|
|
text = "Next",
|
|
...props
|
|
}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
|
|
return (
|
|
<PaginationLink
|
|
aria-label="Go to next page"
|
|
size="default"
|
|
className={cn("pr-1.5!", className)}
|
|
{...props}
|
|
>
|
|
<span className="hidden sm:block">{text}</span>
|
|
<ChevronRightIcon data-icon="inline-end" />
|
|
</PaginationLink>
|
|
)
|
|
}
|
|
|
|
function PaginationEllipsis({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
aria-hidden
|
|
data-slot="pagination-ellipsis"
|
|
className={cn(
|
|
"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<MoreHorizontalIcon
|
|
/>
|
|
<span className="sr-only">More pages</span>
|
|
</span>
|
|
)
|
|
}
|
|
|
|
export {
|
|
Pagination,
|
|
PaginationContent,
|
|
PaginationEllipsis,
|
|
PaginationItem,
|
|
PaginationLink,
|
|
PaginationNext,
|
|
PaginationPrevious,
|
|
}
|