|
1 | | -import { NavMenu } from '@/components/common/NavMenu'; |
| 1 | +import { Column, Focusable, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen'; |
| 2 | +import Link from 'next/link'; |
| 3 | +import { IconLabel } from '@/components/common/IconLabel'; |
2 | 4 | import { useMessages, useNavigation } from '@/components/hooks'; |
3 | | -import { Settings2, UserCircle, Users } from '@/components/icons'; |
| 5 | +import { ArrowLeft, Settings2, UserCircle, Users } from '@/components/icons'; |
4 | 6 |
|
5 | | -export function SettingsNav({ onItemClick }: { onItemClick?: () => void }) { |
| 7 | +export function SettingsNav({ |
| 8 | + isCollapsed, |
| 9 | + onItemClick, |
| 10 | +}: { |
| 11 | + isCollapsed?: boolean; |
| 12 | + onItemClick?: () => void; |
| 13 | +}) { |
6 | 14 | const { t, labels } = useMessages(); |
7 | 15 | const { renderUrl, pathname } = useNavigation(); |
8 | 16 |
|
@@ -42,12 +50,57 @@ export function SettingsNav({ onItemClick }: { onItemClick?: () => void }) { |
42 | 50 | .find(({ path }) => path && pathname.includes(path.split('?')[0]))?.id; |
43 | 51 |
|
44 | 52 | return ( |
45 | | - <NavMenu |
46 | | - items={items} |
47 | | - title={t(labels.settings)} |
48 | | - selectedKey={selectedKey} |
49 | | - allowMinimize={false} |
50 | | - onItemClick={onItemClick} |
51 | | - /> |
| 53 | + <Column gap="2"> |
| 54 | + <Link href={renderUrl('/boards', false)} role="button" onClick={onItemClick}> |
| 55 | + <TooltipTrigger isDisabled={!isCollapsed} delay={0}> |
| 56 | + <Focusable> |
| 57 | + <Row |
| 58 | + alignItems="center" |
| 59 | + hover={{ backgroundColor: 'surface-sunken' }} |
| 60 | + borderRadius |
| 61 | + minHeight="40px" |
| 62 | + > |
| 63 | + <IconLabel icon={<ArrowLeft />} label={isCollapsed ? '' : t(labels.back)} padding /> |
| 64 | + </Row> |
| 65 | + </Focusable> |
| 66 | + <Tooltip placement="right">{t(labels.back)}</Tooltip> |
| 67 | + </TooltipTrigger> |
| 68 | + </Link> |
| 69 | + {items.map(({ label: sectionLabel, items: sectionItems }, index) => ( |
| 70 | + <Column key={`${sectionLabel}${index}`} gap="1" marginBottom="1"> |
| 71 | + {!isCollapsed && ( |
| 72 | + <Row padding> |
| 73 | + <Text weight="bold">{sectionLabel}</Text> |
| 74 | + </Row> |
| 75 | + )} |
| 76 | + {sectionItems.map(({ id, path, label, icon }) => { |
| 77 | + const isSelected = selectedKey === id; |
| 78 | + return ( |
| 79 | + <Link key={id} href={path} role="button" onClick={onItemClick}> |
| 80 | + <TooltipTrigger isDisabled={!isCollapsed} delay={0}> |
| 81 | + <Focusable> |
| 82 | + <Row |
| 83 | + alignItems="center" |
| 84 | + hover={{ backgroundColor: 'surface-sunken' }} |
| 85 | + backgroundColor={isSelected ? 'surface-sunken' : undefined} |
| 86 | + borderRadius |
| 87 | + minHeight="40px" |
| 88 | + > |
| 89 | + <IconLabel |
| 90 | + icon={icon} |
| 91 | + label={isCollapsed ? '' : label} |
| 92 | + weight={isSelected ? 'bold' : undefined} |
| 93 | + padding |
| 94 | + /> |
| 95 | + </Row> |
| 96 | + </Focusable> |
| 97 | + <Tooltip placement="right">{label}</Tooltip> |
| 98 | + </TooltipTrigger> |
| 99 | + </Link> |
| 100 | + ); |
| 101 | + })} |
| 102 | + </Column> |
| 103 | + ))} |
| 104 | + </Column> |
52 | 105 | ); |
53 | 106 | } |
0 commit comments