diff --git a/src/app/(main)/App.tsx b/src/app/(main)/App.tsx index 33e998075..e29a4a33c 100644 --- a/src/app/(main)/App.tsx +++ b/src/app/(main)/App.tsx @@ -4,8 +4,8 @@ import Script from 'next/script'; import { useEffect } from 'react'; import { MobileNav } from '@/app/(main)/MobileNav'; import { SideNav } from '@/app/(main)/SideNav'; +import { TopNav } from '@/app/(main)/TopNav'; import { useConfig, useLoginQuery, useNavigation } from '@/components/hooks'; -import { TeamsButton } from '@/components/input/TeamsButton'; import { LAST_TEAM_CONFIG } from '@/lib/constants'; import { removeItem, setItem } from '@/lib/storage'; import { UpdateNotice } from './UpdateNotice'; @@ -51,18 +51,7 @@ export function App({ children }) { - - - - - + {children} diff --git a/src/app/(main)/TopNav.tsx b/src/app/(main)/TopNav.tsx index 11a234cdc..759a576da 100644 --- a/src/app/(main)/TopNav.tsx +++ b/src/app/(main)/TopNav.tsx @@ -1,30 +1,47 @@ -import { Row, ThemeButton } from '@umami/react-zen'; -import { LanguageButton } from '@/components/input/LanguageButton'; -import { ProfileButton } from '@/components/input/ProfileButton'; +'use client'; +import { Icon, Row } from '@umami/react-zen'; +import { useNavigation } from '@/components/hooks'; +import { Slash } from '@/components/icons'; +import { TeamsButton } from '@/components/input/TeamsButton'; +import { WebsiteSelect } from '@/components/input/WebsiteSelect'; export function TopNav() { + const { websiteId, teamId, router, renderUrl } = useNavigation(); + + const handleWebsiteChange = (value: string) => { + router.push(renderUrl(`/websites/${value}`)); + }; + return ( - - - - + + + {websiteId && ( + <> + + + + + + )} ); diff --git a/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx b/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx index fe37c9c1a..bd1d31f94 100644 --- a/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx @@ -1,19 +1,8 @@ -import { - Box, - Column, - Focusable, - Label, - Row, - Text, - Tooltip, - TooltipTrigger, -} from '@umami/react-zen'; +import { Column, Focusable, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen'; import Link from 'next/link'; import { IconLabel } from '@/components/common/IconLabel'; -import { NavMenu } from '@/components/common/NavMenu'; import { useMessages, useNavigation, useWebsiteNavItems } from '@/components/hooks'; import { ArrowLeft } from '@/components/icons'; -import { WebsiteSelect } from '@/components/input/WebsiteSelect'; export function WebsiteNav({ websiteId, @@ -25,16 +14,12 @@ export function WebsiteNav({ onItemClick?: () => void; }) { const { t, labels } = useMessages(); - const { teamId, router, renderUrl } = useNavigation(); + const { renderUrl } = useNavigation(); const { items, selectedKey } = useWebsiteNavItems(websiteId); - const handleChange = (value: string) => { - router.push(renderUrl(`/websites/${value}`)); - }; - return ( - + {t(labels.back)} - - - {items.map(({ label: sectionLabel, items: sectionItems }, index) => ( {!isCollapsed && ( @@ -68,7 +44,7 @@ export function WebsiteNav({ {sectionItems.map(({ id, path, label, icon }) => { const isSelected = selectedKey === id; return ( - + { - return isCollapsed ? '' : name; + if (isCollapsed) { + return ''; + } + + return ( + + + + + {name} + + ); }; return ( @@ -61,12 +74,24 @@ export function WebsiteSelect({ onChange={handleChange} onOpenChange={handleOpenChange} renderValue={renderValue} - listProps={{ - renderEmptyState: () => , - style: { maxHeight: 'calc(42vh - 65px)', width: 280 }, - }} buttonProps={{ - style: { minHeight: 40, gap: 0, justifyContent: isCollapsed ? 'start' : undefined }, + ...buttonProps, + style: { + minHeight: 40, + gap: 0, + justifyContent: isCollapsed ? 'start' : undefined, + ...buttonProps?.style, + }, + }} + listProps={{ + ...listProps, + renderEmptyState: + listProps?.renderEmptyState || (() => ), + style: { + maxHeight: 'calc(42vh - 65px)', + width: 280, + ...listProps?.style, + }, }} > {listItems.map(({ id, name }) => (