Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | import { cn } from '../../lib/utils'; interface SkeletonProps { className?: string; } export function Skeleton({ className }: SkeletonProps) { return ( <div className={cn( 'animate-pulse bg-gray-200 dark:bg-gray-700 rounded', className )} /> ); } export function CardSkeleton() { return ( <div className="rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 p-4"> <Skeleton className="h-4 w-24 mb-3" /> <Skeleton className="h-3 w-full mb-2" /> <Skeleton className="h-3 w-3/4" /> </div> ); } export function ListSkeleton({ count = 3 }: { count?: number }) { return ( <div className="space-y-2"> {Array.from({ length: count }).map((_, i) => ( <div key={i} className="flex items-center gap-3 p-2"> <Skeleton className="w-8 h-8 rounded-full" /> <div className="flex-1"> <Skeleton className="h-3 w-24 mb-1" /> <Skeleton className="h-2 w-32" /> </div> </div> ))} </div> ); } /** * Skeleton for a single chat message bubble. * Supports both user and assistant message styles. */ export function MessageSkeleton({ isUser = false }: { isUser?: boolean }) { return ( <div className={cn('flex gap-4', isUser && 'justify-end')}> <div className={cn( 'w-8 h-8 rounded-lg flex-shrink-0', isUser ? 'bg-gray-200 dark:bg-gray-600 order-last' : 'bg-gray-300 dark:bg-gray-600' )} > <Skeleton className="w-full h-full rounded-lg" /> </div> <div className={cn('flex-1', isUser && 'max-w-2xl')}> <div className={cn( 'p-4 rounded-2xl', isUser ? 'bg-orange-100 dark:bg-orange-900/30' : 'bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700' )} > <Skeleton className="h-4 w-full mb-2" /> <Skeleton className="h-4 w-3/4 mb-2" /> <Skeleton className="h-4 w-1/2" /> </div> </div> </div> ); } /** * Skeleton for a list of chat messages. * Alternates between user and assistant skeletons. */ export function MessageListSkeleton({ count = 4 }: { count?: number }) { return ( <div className="space-y-6 p-6"> {Array.from({ length: count }).map((_, i) => ( <MessageSkeleton key={i} isUser={i % 2 === 0} /> ))} </div> ); } /** * Skeleton for a conversation item in the sidebar. */ export function ConversationItemSkeleton() { return ( <div className="flex items-center gap-3 px-3 py-3 border-b border-gray-50 dark:border-gray-800"> <Skeleton className="w-7 h-7 rounded-lg flex-shrink-0" /> <div className="flex-1 min-w-0"> <Skeleton className="h-3 w-24 mb-1.5" /> <Skeleton className="h-2 w-32" /> </div> </div> ); } /** * Skeleton for the conversation list sidebar. */ export function ConversationListSkeleton({ count = 5 }: { count?: number }) { return ( <div className="flex flex-col h-full"> {/* Header skeleton */} <div className="flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700"> <Skeleton className="h-3 w-16" /> <Skeleton className="w-4 h-4 rounded" /> </div> {/* List items */} <div className="flex-1 overflow-hidden"> {Array.from({ length: count }).map((_, i) => ( <ConversationItemSkeleton key={i} /> ))} </div> </div> ); } /** * Skeleton for the chat header. */ export function ChatHeaderSkeleton() { return ( <div className="h-14 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between px-6 bg-white dark:bg-gray-900"> <div className="flex items-center gap-2"> <Skeleton className="h-5 w-24" /> <Skeleton className="h-3 w-20" /> </div> <div className="flex items-center gap-2"> <Skeleton className="h-8 w-8 rounded-full" /> <Skeleton className="h-8 w-8 rounded-full" /> </div> </div> ); } /** * Skeleton for the chat input area. */ export function ChatInputSkeleton() { return ( <div className="border-t border-gray-100 dark:border-gray-800 p-4 bg-white dark:bg-gray-900"> <div className="max-w-4xl mx-auto"> <div className="flex items-end gap-2 bg-gray-50 dark:bg-gray-800 rounded-2xl border border-gray-200 dark:border-gray-700 p-2"> <Skeleton className="w-5 h-5 rounded" /> <div className="flex-1 py-1"> <Skeleton className="h-5 w-full" /> </div> <Skeleton className="w-16 h-6 rounded" /> <Skeleton className="w-8 h-8 rounded-full" /> </div> <div className="text-center mt-2"> <Skeleton className="h-3 w-40 mx-auto" /> </div> </div> </div> ); } /** * Full chat area skeleton including header, messages, and input. */ export function ChatAreaSkeleton({ messageCount = 4 }: { messageCount?: number }) { return ( <div className="flex flex-col h-full"> <ChatHeaderSkeleton /> <div className="flex-1 overflow-hidden"> <MessageListSkeleton count={messageCount} /> </div> <ChatInputSkeleton /> </div> ); } |