mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 22:39:28 +00:00
feat(webui): always show right sidebar and implement left vertical carousel
This commit is contained in:
@@ -457,125 +457,126 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
|
||||
cursor: text;
|
||||
}
|
||||
`}</style>
|
||||
{showMentionList && (membersLoading || filteredAgents.length > 0 || filteredHumans.length > 0) && (
|
||||
<div className="absolute bottom-full left-4 mb-2 w-64 rounded-xl shadow-lg border border-border overflow-hidden z-20 bg-popover text-popover-foreground animate-in fade-in slide-in-from-bottom-2 duration-200">
|
||||
<div className="h-64 overflow-y-auto">
|
||||
{membersLoading ? (
|
||||
<div className="p-2 space-y-4 animate-pulse">
|
||||
{/* Agents Skeleton */}
|
||||
<div className="space-y-2">
|
||||
<div className="px-3 py-1.5 bg-muted/50 border-b border-border">
|
||||
<Skeleton className="h-3 w-16" />
|
||||
{showMentionList &&
|
||||
(membersLoading || filteredAgents.length > 0 || filteredHumans.length > 0) && (
|
||||
<div className="absolute bottom-full left-4 mb-2 w-64 rounded-xl shadow-lg border border-border overflow-hidden z-20 bg-popover text-popover-foreground animate-in fade-in slide-in-from-bottom-2 duration-200">
|
||||
<div className="h-64 overflow-y-auto">
|
||||
{membersLoading ? (
|
||||
<div className="p-2 space-y-4 animate-pulse">
|
||||
{/* Agents Skeleton */}
|
||||
<div className="space-y-2">
|
||||
<div className="px-3 py-1.5 bg-muted/50 border-b border-border">
|
||||
<Skeleton className="h-3 w-16" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-28" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-20" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-28" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-20" />
|
||||
{/* Members Skeleton */}
|
||||
<div className="space-y-2">
|
||||
<div className="px-3 py-1.5 bg-muted/50 border-b border-border">
|
||||
<Skeleton className="h-3 w-16" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-32" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Members Skeleton */}
|
||||
<div className="space-y-2">
|
||||
<div className="px-3 py-1.5 bg-muted/50 border-b border-border">
|
||||
<Skeleton className="h-3 w-16" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-32" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 px-3 py-2">
|
||||
<Skeleton className="w-6 h-6 rounded-full" />
|
||||
<Skeleton className="h-4 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{filteredAgents.length > 0 && (
|
||||
<>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setCollapsedSections((prev) => ({ ...prev, bots: !prev.bots }))
|
||||
}}
|
||||
className="w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border sticky top-0 flex items-center justify-between hover:bg-muted transition-colors"
|
||||
>
|
||||
<span>Agents</span>
|
||||
<ChevronDown
|
||||
className={`w-3 h-3 transition-transform ${collapsedSections.bots ? '-rotate-90' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
{!collapsedSections.bots &&
|
||||
filteredAgents.map((item, index) => {
|
||||
const actualIndex = index
|
||||
return (
|
||||
<button
|
||||
key={item.data.id}
|
||||
onClick={() => handleSelectEntity(item)}
|
||||
onMouseEnter={() => setHighlightedIndex(actualIndex)}
|
||||
className={`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left ${
|
||||
actualIndex === highlightedIndex
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'hover:bg-accent/50'
|
||||
}`}
|
||||
>
|
||||
<div className="w-6 h-6 rounded-full bg-purple-100 dark:bg-purple-900/40 flex items-center justify-center text-xs font-bold text-purple-600 dark:text-purple-300">
|
||||
{item.data.name?.[0]}
|
||||
</div>
|
||||
<span className="text-sm">{item.data.name}</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
) : (
|
||||
<>
|
||||
{filteredAgents.length > 0 && (
|
||||
<>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setCollapsedSections((prev) => ({ ...prev, bots: !prev.bots }))
|
||||
}}
|
||||
className="w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border sticky top-0 flex items-center justify-between hover:bg-muted transition-colors"
|
||||
>
|
||||
<span>Agents</span>
|
||||
<ChevronDown
|
||||
className={`w-3 h-3 transition-transform ${collapsedSections.bots ? '-rotate-90' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
{!collapsedSections.bots &&
|
||||
filteredAgents.map((item, index) => {
|
||||
const actualIndex = index
|
||||
return (
|
||||
<button
|
||||
key={item.data.id}
|
||||
onClick={() => handleSelectEntity(item)}
|
||||
onMouseEnter={() => setHighlightedIndex(actualIndex)}
|
||||
className={`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left ${
|
||||
actualIndex === highlightedIndex
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'hover:bg-accent/50'
|
||||
}`}
|
||||
>
|
||||
<div className="w-6 h-6 rounded-full bg-purple-100 dark:bg-purple-900/40 flex items-center justify-center text-xs font-bold text-purple-600 dark:text-purple-300">
|
||||
{item.data.name?.[0]}
|
||||
</div>
|
||||
<span className="text-sm">{item.data.name}</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
||||
{filteredHumans.length > 0 && (
|
||||
<>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setCollapsedSections((prev) => ({ ...prev, users: !prev.users }))
|
||||
}}
|
||||
className="w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border sticky top-0 flex items-center justify-between hover:bg-muted transition-colors"
|
||||
>
|
||||
<span>Members</span>
|
||||
<ChevronDown
|
||||
className={`w-3 h-3 transition-transform ${collapsedSections.users ? '-rotate-90' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
{!collapsedSections.users &&
|
||||
filteredHumans.map((item, index) => {
|
||||
const actualIndex =
|
||||
(collapsedSections.bots ? 0 : filteredAgents.length) + index
|
||||
return (
|
||||
<button
|
||||
key={item.data.id}
|
||||
onClick={() => handleSelectEntity(item)}
|
||||
onMouseEnter={() => setHighlightedIndex(actualIndex)}
|
||||
className={`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left ${
|
||||
actualIndex === highlightedIndex
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'hover:bg-accent/50'
|
||||
}`}
|
||||
>
|
||||
<div className="w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900/40 flex items-center justify-center text-xs font-bold text-blue-600 dark:text-blue-300">
|
||||
{item.data.name?.[0]}
|
||||
</div>
|
||||
<span className="text-sm">{item.data.name}</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{filteredHumans.length > 0 && (
|
||||
<>
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setCollapsedSections((prev) => ({ ...prev, users: !prev.users }))
|
||||
}}
|
||||
className="w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border sticky top-0 flex items-center justify-between hover:bg-muted transition-colors"
|
||||
>
|
||||
<span>Members</span>
|
||||
<ChevronDown
|
||||
className={`w-3 h-3 transition-transform ${collapsedSections.users ? '-rotate-90' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
{!collapsedSections.users &&
|
||||
filteredHumans.map((item, index) => {
|
||||
const actualIndex =
|
||||
(collapsedSections.bots ? 0 : filteredAgents.length) + index
|
||||
return (
|
||||
<button
|
||||
key={item.data.id}
|
||||
onClick={() => handleSelectEntity(item)}
|
||||
onMouseEnter={() => setHighlightedIndex(actualIndex)}
|
||||
className={`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left ${
|
||||
actualIndex === highlightedIndex
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'hover:bg-accent/50'
|
||||
}`}
|
||||
>
|
||||
<div className="w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900/40 flex items-center justify-center text-xs font-bold text-blue-600 dark:text-blue-300">
|
||||
{item.data.name?.[0]}
|
||||
</div>
|
||||
<span className="text-sm">{item.data.name}</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
|
||||
{showUpperPart && (
|
||||
<div className="flex flex-col gap-2 p-3 pb-0 animate-in fade-in slide-in-from-bottom-2 duration-200">
|
||||
|
||||
Reference in New Issue
Block a user