Fixed nav display.

This commit is contained in:
Mike Cao 2025-07-20 00:38:15 -07:00
parent 2f7f8911cd
commit 25f96f6b6b
5 changed files with 30 additions and 32 deletions

View file

@ -21,8 +21,9 @@ import { WebsiteNav } from '@/app/(main)/websites/[websiteId]/WebsiteNav';
export function SideNav(props: SidebarProps) {
const { formatMessage, labels } = useMessages();
const { pathname, renderUrl, websiteId } = useNavigation();
const { pathname, renderUrl, websiteId, teamId } = useNavigation();
const [isCollapsed] = useGlobalState('sidenav-collapsed');
const isWebsite = websiteId && !pathname.includes('/settings');
const links = [
{
@ -67,10 +68,10 @@ export function SideNav(props: SidebarProps) {
];
return (
<Row height="100%" margin="2" backgroundColor border borderRadius>
<Row height="100%" backgroundColor border="right">
<Sidebar
{...props}
isCollapsed={isCollapsed || websiteId}
isCollapsed={isCollapsed || isWebsite}
muteItems={false}
variant="quiet"
showBorder={false}
@ -88,16 +89,17 @@ export function SideNav(props: SidebarProps) {
})}
</SidebarSection>
<SidebarSection>
{bottomLinks.map(({ id, path, label, icon }) => {
return (
<Link key={id} href={path} role="button">
<SidebarItem label={label} icon={icon} isSelected={pathname.startsWith(path)} />
</Link>
);
})}
{!teamId &&
bottomLinks.map(({ id, path, label, icon }) => {
return (
<Link key={id} href={path} role="button">
<SidebarItem label={label} icon={icon} isSelected={pathname.startsWith(path)} />
</Link>
);
})}
</SidebarSection>
</Sidebar>
{websiteId && <WebsiteNav websiteId={websiteId} />}
{isWebsite && <WebsiteNav websiteId={websiteId} />}
</Row>
);
}

View file

@ -9,7 +9,7 @@ import { PanelButton } from '@/components/input/PanelButton';
export function TopNav() {
const { teamId, websiteId, pathname } = useNavigation();
const isSettings = pathname.includes('/settings');
const isWebsite = websiteId && !pathname.includes('/settings');
return (
<Row
@ -24,21 +24,19 @@ export function TopNav() {
zIndex={1}
>
<Row alignItems="center">
<PanelButton />
<PanelButton isDisabled={!!isWebsite} />
<Seperator />
<Row alignItems="center" gap="1">
<TeamsButton />
{websiteId && !isSettings && (
<>
<Seperator />
<WebsiteSelect
buttonProps={{ variant: 'quiet' }}
websiteId={websiteId}
teamId={teamId}
/>
</>
)}
</Row>
<TeamsButton />
{isWebsite && (
<>
<Seperator />
<WebsiteSelect
buttonProps={{ variant: 'quiet' }}
websiteId={websiteId}
teamId={teamId}
/>
</>
)}
</Row>
<Row alignItems="center" justifyContent="flex-end">
<ThemeButton />

View file

@ -134,7 +134,7 @@ export function WebsiteNav({ websiteId }: { websiteId: string }) {
'overview';
return (
<Column gap padding width="240px" border="left">
<Column gap padding width="240px" border="left" overflowY="auto">
<NavMenu highlightColor="2">
{links.map(({ label, items }) => {
return (

View file

@ -1,11 +1,11 @@
import { Button, Icon } from '@umami/react-zen';
import { Button, Icon, ButtonProps } from '@umami/react-zen';
import { PanelLeft } from '@/components/icons';
import { useGlobalState } from '@/components/hooks';
export function PanelButton() {
export function PanelButton(props: ButtonProps) {
const [isCollapsed, setIsCollapsed] = useGlobalState('sidenav-collapsed');
return (
<Button onPress={() => setIsCollapsed(!isCollapsed)} variant="quiet">
<Button onPress={() => setIsCollapsed(!isCollapsed)} variant="quiet" {...props}>
<Icon>
<PanelLeft />
</Icon>

View file

@ -170,8 +170,6 @@ async function clickhouseQuery(
from (
select session_id s,
${columnQuery} as t
from website_event_stats_hourly website_event
select ${columnQuery} as t
from website_event_stats_hourly as website_event
${cohortQuery}
where website_id = {websiteId:UUID}