Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fixed nav display.

Mike Cao25f96f6b6bce
diff --git a/src/app/(main)/SideNav.tsx b/src/app/(main)/SideNav.tsx
index 4cfe78a73..d11d80d34 100644
--- a/src/app/(main)/SideNav.tsx
+++ b/src/app/(main)/SideNav.tsx
@@ -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>
);
}
diff --git a/src/app/(main)/TopNav.tsx b/src/app/(main)/TopNav.tsx
index ff2b8f544..c537e2783 100644
--- a/src/app/(main)/TopNav.tsx
+++ b/src/app/(main)/TopNav.tsx
@@ -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 />
diff --git a/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx b/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx
index 37411c0a7..dd5515536 100644
--- a/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx
+++ b/src/app/(main)/websites/[websiteId]/WebsiteNav.tsx
@@ -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 (
diff --git a/src/components/input/PanelButton.tsx b/src/components/input/PanelButton.tsx
index fe6c8b665..04a9b01c2 100644
--- a/src/components/input/PanelButton.tsx
+++ b/src/components/input/PanelButton.tsx
@@ -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>
diff --git a/src/queries/sql/pageviews/getPageviewMetrics.ts b/src/queries/sql/pageviews/getPageviewMetrics.ts
index 59ca63094..fd4856854 100644
--- a/src/queries/sql/pageviews/getPageviewMetrics.ts
+++ b/src/queries/sql/pageviews/getPageviewMetrics.ts
@@ -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}