diff --git a/packages/web/src/components/layout/SpaceSidebar.tsx b/packages/web/src/components/layout/SpaceSidebar.tsx index 5bd2dd6b..ad7be883 100644 --- a/packages/web/src/components/layout/SpaceSidebar.tsx +++ b/packages/web/src/components/layout/SpaceSidebar.tsx @@ -4,6 +4,7 @@ import { useSpaceStore } from '../../stores/spaceStore'; import { useChatStore } from '../../stores/chatStore'; import { useUIStore } from '../../stores/uiStore'; import { useInstanceStore } from '../../stores/instanceStore'; +import { Tooltip } from '../ui/Tooltip'; import { getSpaceGradient, HOME_GRADIENT } from '../../utils/gradients'; @@ -17,9 +18,12 @@ interface SidebarItemProps { actionType?: 'add' | 'join' | 'explore'; hasUnread?: boolean; dimmed?: boolean; + federationBadge?: boolean; + federationDisconnected?: boolean; + tooltipText?: string; } -function SidebarItem({ id, name, icon, active, onClick, type = 'space', actionType, hasUnread, dimmed }: SidebarItemProps) { +function SidebarItem({ id, name, icon, active, onClick, type = 'space', actionType, hasUnread, dimmed, federationBadge, federationDisconnected, tooltipText }: SidebarItemProps) { const [isHovered, setIsHovered] = useState(false); const firstLetter = name.charAt(0).toUpperCase(); @@ -66,6 +70,53 @@ function SidebarItem({ id, name, icon, active, onClick, type = 'space', actionTy return `${base} text-white ${active ? 'rounded-[13px]' : 'rounded-[20px] hover:rounded-[13px]'}`; }; + const buttonContent = ( + + ); + + const innerContent = ( +
+ {buttonContent} + {federationBadge && ( +
+ {federationDisconnected ? ( +
+ ) : ( + + + + )} +
+ )} +
+ ); + return (
)} - + {tooltipText ? ( + + {innerContent} + + ) : ( + innerContent + )}
); } +function InstanceDivider({ label, disconnected }: { label: string; disconnected: boolean }) { + return ( + +
+
+
+ + + +
+
+ + ); +} + export function SpaceSidebar() { const spaces = useSpaceStore((s) => s.spaces); const currentSpaceId = useSpaceStore((s) => s.currentSpaceId); @@ -226,14 +274,15 @@ export function SpaceSidebar() { {/* Remote instance groups */} {groupedSpaces.remoteGroups.map(([origin, groupSpaces]) => { const inst = instances.find(i => i.origin === origin); - const label = inst?.label || (() => { try { return new URL(origin).host; } catch { return '?'; } })(); + const hostLabel = (() => { try { return new URL(origin).host; } catch { return '?'; } })(); + const label = inst?.label || hostLabel; const isDimmed = disconnectedOrigins.has(origin); return ( -
-
- {label} -
+ {groupSpaces.map((space) => ( handleSpaceClick(space.id)} hasUnread={unreadSpaceIds.has(space.id)} dimmed={isDimmed} + federationBadge + federationDisconnected={isDimmed} + tooltipText={`${space.name} \u00b7 ${hostLabel}`} /> ))}