'use client' import * as React from 'react' import { cn } from '../../utils/cn' import { ScrollFadeOverlay, useScrollFade } from '../ui/scroll-fade' import { ChatTicketItem, type ChatTicketItemData } from './entity-cards/chat-ticket-item' export interface ChatTicketListProps extends React.HTMLAttributes { tickets: ChatTicketItemData[] onTicketClick?: (ticketId: string) => void /** Show skeleton placeholder rows instead of tickets while loading. */ isLoading?: boolean /** Number of skeleton rows rendered while `isLoading`. Defaults to 5. */ skeletonCount?: number } const ChatTicketList = React.forwardRef( ({ className, tickets, onTicketClick, isLoading = false, skeletonCount = 5, ...props }, ref) => { // Shared scroll-shadow tracking (ui/scroll-fade) — re-measures on resize // and content changes, so no manual ticket-count effect is needed. const { scrollRef, fadeTop, fadeBottom, update: updateFade } = useScrollFade() if (isLoading) { return (

Your Chats:

{Array.from({ length: skeletonCount }).map((_, i) => ( // eslint-disable-next-line react/no-array-index-key ))}
) } if (tickets.length === 0) return null return (

Your Chats:

{tickets.map((ticket) => ( ))}
{/* Scroll-fade overlays — tinted with the page background so edge tickets fade into the surface behind the list in BOTH themes (`--color-bg` flips with `data-theme`). Shared ui/scroll-fade. */}
) }, ) ChatTicketList.displayName = 'ChatTicketList' export { ChatTicketList } export type { ChatTicketItemData }