()
| 29 | ] |
| 30 | |
| 31 | export function ActivityBar(): React.JSX.Element { |
| 32 | const { activePanel, sidebarVisible, setActivePanel } = useLayoutStore() |
| 33 | const { accounts, currentAccountId } = useAccountStore() |
| 34 | const currentAccount = accounts.find((a) => a.id === currentAccountId) |
| 35 | const avatarConfig = getAvatarConfig(currentAccount?.avatar) |
| 36 | const [userPopoverOpen, setUserPopoverOpen] = useState(false) |
| 37 | const [workspacePopoverOpen, setWorkspacePopoverOpen] = useState(false) |
| 38 | |
| 39 | return ( |
| 40 | <Flex className="activity-bar" vertical justify="space-between"> |
| 41 | <Flex vertical> |
| 42 | {activities.map((item) => ( |
| 43 | <Tooltip key={item.key} title={item.title} placement="right"> |
| 44 | <button |
| 45 | className={`activity-bar-item ${activePanel === item.key && sidebarVisible ? 'active' : ''}`} |
| 46 | onClick={() => setActivePanel(item.key)} |
| 47 | > |
| 48 | {item.icon} |
| 49 | </button> |
| 50 | </Tooltip> |
| 51 | ))} |
| 52 | </Flex> |
| 53 | <Flex vertical className="activity-bar-bottom"> |
| 54 | <Popover |
| 55 | content={<WorkspaceCard onClose={() => setWorkspacePopoverOpen(false)} />} |
| 56 | trigger="click" |
| 57 | placement="rightBottom" |
| 58 | arrow={false} |
| 59 | open={workspacePopoverOpen} |
| 60 | onOpenChange={setWorkspacePopoverOpen} |
| 61 | destroyOnHidden |
| 62 | > |
| 63 | <Tooltip title="工作区" placement="right"> |
| 64 | <button className="activity-bar-item"> |
| 65 | <FolderOutlined /> |
| 66 | </button> |
| 67 | </Tooltip> |
| 68 | </Popover> |
| 69 | <Tooltip title="设置" placement="right"> |
| 70 | <button className="activity-bar-item" onClick={() => openSettings()}> |
| 71 | <SettingOutlined /> |
| 72 | </button> |
| 73 | </Tooltip> |
| 74 | <Popover |
| 75 | content={<UserProfileCard onClose={() => setUserPopoverOpen(false)} />} |
| 76 | trigger="click" |
| 77 | placement="rightBottom" |
| 78 | arrow={false} |
| 79 | open={userPopoverOpen} |
| 80 | onOpenChange={setUserPopoverOpen} |
| 81 | destroyOnHidden |
| 82 | > |
| 83 | <button className="activity-bar-item activity-bar-avatar"> |
| 84 | <Avatar |
| 85 | size={28} |
| 86 | icon={<avatarConfig.icon />} |
| 87 | style={{ backgroundColor: avatarConfig.color }} |
| 88 | /> |
nothing calls this directly
no test coverage detected