mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 12:39:52 +08:00
- components/model-selector.tsx uses Dialog, Command and Tooltip directly; delete components/ai-elements/model-selector.tsx and components/button-with-tooltip.tsx; one renderGroups for both lists; no "Server · " prefix round trip - components/ui: drop CommandDialog, CommandShortcut and six unused shadcn exports - model-config-dialog: no type-to-confirm on provider delete; provider-credentials-fields: drop footer and bedrockApiKey - hooks/use-model-config.ts and lib/types/model-config.ts: remove the 2025-12 single-provider migration, resetConfig, selectedModel and fields nothing reads - components/chat/TemplateFormDialog.tsx replaces the create and edit dialogs; TemplatePanel drops the setInput fallback, the templatesChanged listener, dictionary fallbacks and formatLastUsed; lib/template-storage.ts drops getTemplate, clickCount and indexes - reasoning.tsx becomes one component; shimmer uses a CSS keyframe (motion and @radix-ui/react-use-controllable-state removed) - error-toast.tsx deleted in favour of toast.error; ValidationCard drops the idle status; dev-xml-simulator uses English literals - admin: no enum setting type, shared types from lib/admin (AdminProviderInput stays exported for that), ENABLE_HISTORY_XML_REPLACE entry removed - app/globals.css: drop check-pop, --ease-spring, --duration-normal and the shadow aliases - dictionaries: 81 unused keys removed from all four languages
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
"use client"
|
|
|
|
import { type CSSProperties, type ElementType, memo, useMemo } from "react"
|
|
import { cn } from "@/lib/utils"
|
|
|
|
export type TextShimmerProps = {
|
|
children: string
|
|
as?: ElementType
|
|
className?: string
|
|
duration?: number
|
|
spread?: number
|
|
}
|
|
|
|
const ShimmerComponent = ({
|
|
children,
|
|
as: Component = "p",
|
|
className,
|
|
duration = 2,
|
|
spread = 2,
|
|
}: TextShimmerProps) => {
|
|
const dynamicSpread = useMemo(
|
|
() => (children?.length ?? 0) * spread,
|
|
[children, spread],
|
|
)
|
|
|
|
return (
|
|
<Component
|
|
className={cn(
|
|
"animate-shimmer relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent",
|
|
"[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
|
|
className,
|
|
)}
|
|
style={
|
|
{
|
|
"--spread": `${dynamicSpread}px`,
|
|
"--shimmer-duration": `${duration}s`,
|
|
backgroundImage:
|
|
"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))",
|
|
} as CSSProperties
|
|
}
|
|
>
|
|
{children}
|
|
</Component>
|
|
)
|
|
}
|
|
|
|
export const Shimmer = memo(ShimmerComponent)
|