mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Moved collapse button.
This commit is contained in:
parent
5d2c1e27c2
commit
adca3c36d0
7 changed files with 1883 additions and 37 deletions
|
|
@ -78,7 +78,7 @@
|
||||||
"@react-spring/web": "^9.7.5",
|
"@react-spring/web": "^9.7.5",
|
||||||
"@tanstack/react-query": "^5.68.0",
|
"@tanstack/react-query": "^5.68.0",
|
||||||
"@umami/prisma-client": "^0.16.0",
|
"@umami/prisma-client": "^0.16.0",
|
||||||
"@umami/react-zen": "^0.63.0",
|
"@umami/react-zen": "^0.66.0",
|
||||||
"@umami/redis-client": "^0.27.0",
|
"@umami/redis-client": "^0.27.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
|
|
@ -194,6 +194,7 @@
|
||||||
"esbuild",
|
"esbuild",
|
||||||
"prisma",
|
"prisma",
|
||||||
"sharp"
|
"sharp"
|
||||||
]
|
],
|
||||||
|
"overrides": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1848
pnpm-lock.yaml
generated
1848
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@ import Script from 'next/script';
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
import { UpdateNotice } from './UpdateNotice';
|
import { UpdateNotice } from './UpdateNotice';
|
||||||
import { Nav } from '@/app/(main)/Nav';
|
import { Nav } from '@/app/(main)/Nav';
|
||||||
import { NavBar } from '@/app/(main)/NavBar';
|
import { MenuBar } from '@/app/(main)/MenuBar';
|
||||||
import { Page } from '@/components/layout/Page';
|
import { Page } from '@/components/layout/Page';
|
||||||
import { useLogin, useConfig } from '@/components/hooks';
|
import { useLogin, useConfig } from '@/components/hooks';
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ export function App({ children }) {
|
||||||
return (
|
return (
|
||||||
<Grid height="100vh" width="100%" columns="auto 1fr" rows="auto 1fr" overflow="hidden">
|
<Grid height="100vh" width="100%" columns="auto 1fr" rows="auto 1fr" overflow="hidden">
|
||||||
<Nav gridColumn="1 / 2" gridRow="1 / 3" />
|
<Nav gridColumn="1 / 2" gridRow="1 / 3" />
|
||||||
<NavBar gridColumn="2 / 3" gridRow="1 / 2" />
|
<MenuBar gridColumn="2 / 3" gridRow="1 / 2" />
|
||||||
<Column gridColumn="2 / 3" gridRow="2 / 3" alignItems="center" overflow="auto">
|
<Column gridColumn="2 / 3" gridRow="2 / 3" alignItems="center" overflow="auto">
|
||||||
<Page>
|
<Page>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
import { ThemeButton, Row } from '@umami/react-zen';
|
import { ThemeButton, Row, Button, Icon } from '@umami/react-zen';
|
||||||
import { LanguageButton } from '@/components/input/LanguageButton';
|
import { LanguageButton } from '@/components/input/LanguageButton';
|
||||||
import { ProfileButton } from '@/components/input/ProfileButton';
|
import { ProfileButton } from '@/components/input/ProfileButton';
|
||||||
import { TeamsButton } from '@/components/input/TeamsButton';
|
import { TeamsButton } from '@/components/input/TeamsButton';
|
||||||
import type { RowProps } from '@umami/react-zen/Row';
|
import type { RowProps } from '@umami/react-zen/Row';
|
||||||
|
import useGlobalState from '@/components/hooks/useGlobalState';
|
||||||
|
import { Lucide } from '@/components/icons';
|
||||||
|
|
||||||
|
export function MenuBar(props: RowProps) {
|
||||||
|
const [isCollapsed, setCollapsed] = useGlobalState('sidenav-collapsed');
|
||||||
|
|
||||||
export function NavBar(props: RowProps) {
|
|
||||||
return (
|
return (
|
||||||
<Row
|
<Row
|
||||||
{...props}
|
{...props}
|
||||||
|
|
@ -14,7 +18,14 @@ export function NavBar(props: RowProps) {
|
||||||
paddingX="3"
|
paddingX="3"
|
||||||
paddingRight="5"
|
paddingRight="5"
|
||||||
>
|
>
|
||||||
<TeamsButton />
|
<Row>
|
||||||
|
<Button onPress={() => setCollapsed(!isCollapsed)} variant="quiet">
|
||||||
|
<Icon>
|
||||||
|
<Lucide.PanelLeft />
|
||||||
|
</Icon>
|
||||||
|
</Button>
|
||||||
|
<TeamsButton />
|
||||||
|
</Row>
|
||||||
<Row justifyContent="flex-end">
|
<Row justifyContent="flex-end">
|
||||||
<ThemeButton />
|
<ThemeButton />
|
||||||
<LanguageButton />
|
<LanguageButton />
|
||||||
|
|
@ -1,21 +1,13 @@
|
||||||
import { useState } from 'react';
|
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import {
|
import { SideNav, SideNavHeader, SideNavSection, SideNavItem } from '@umami/react-zen';
|
||||||
SideNav,
|
|
||||||
SideNavHeader,
|
|
||||||
SideNavSection,
|
|
||||||
SideNavItem,
|
|
||||||
Button,
|
|
||||||
Icon,
|
|
||||||
Row,
|
|
||||||
} from '@umami/react-zen';
|
|
||||||
import { Lucide, Icons } from '@/components/icons';
|
import { Lucide, Icons } from '@/components/icons';
|
||||||
import { useMessages, useTeamUrl } from '@/components/hooks';
|
import { useMessages, useTeamUrl } from '@/components/hooks';
|
||||||
|
import useGlobalState from '@/components/hooks/useGlobalState';
|
||||||
|
|
||||||
export function Nav(props: any) {
|
export function Nav(props: any) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { renderTeamUrl, pathname } = useTeamUrl();
|
const { renderTeamUrl, pathname } = useTeamUrl();
|
||||||
const [isCollapsed, setCollapsed] = useState(false);
|
const [isCollapsed] = useGlobalState('sidenav-collapsed');
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
|
|
@ -46,7 +38,7 @@ export function Nav(props: any) {
|
||||||
].filter(n => n);
|
].filter(n => n);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SideNav {...props} isCollapsed={isCollapsed} variant="3" showBorder={true}>
|
<SideNav {...props} isCollapsed={isCollapsed} variant="2" showBorder={true}>
|
||||||
<SideNavSection>
|
<SideNavSection>
|
||||||
<SideNavHeader label="umami" icon={<Icons.Logo />} />
|
<SideNavHeader label="umami" icon={<Icons.Logo />} />
|
||||||
</SideNavSection>
|
</SideNavSection>
|
||||||
|
|
@ -59,15 +51,7 @@ export function Nav(props: any) {
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</SideNavSection>
|
</SideNavSection>
|
||||||
<SideNavSection alignSelf="end">
|
<SideNavSection alignSelf="end"></SideNavSection>
|
||||||
<Row justifyContent="flex-start">
|
|
||||||
<Button onPress={() => setCollapsed(!isCollapsed)} variant="quiet">
|
|
||||||
<Icon>
|
|
||||||
<Lucide.PanelLeft />
|
|
||||||
</Icon>
|
|
||||||
</Button>
|
|
||||||
</Row>
|
|
||||||
</SideNavSection>
|
|
||||||
</SideNav>
|
</SideNav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/components/hooks/useGlobalState.ts
Normal file
13
src/components/hooks/useGlobalState.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { create } from 'zustand';
|
||||||
|
|
||||||
|
const store = create(() => ({}));
|
||||||
|
|
||||||
|
const useGlobalState = (key: string, value?: any) => {
|
||||||
|
if (value !== undefined && !store.getState()[key]) {
|
||||||
|
store.setState({ [key]: value });
|
||||||
|
}
|
||||||
|
|
||||||
|
return [store(state => state[key]), (value: any) => store.setState({ [key]: value })];
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useGlobalState;
|
||||||
|
|
@ -3,7 +3,7 @@ body {
|
||||||
font-family: var(--font-family), sans-serif;
|
font-family: var(--font-family), sans-serif;
|
||||||
color: var(--font-color);
|
color: var(--font-color);
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
background-color: var(--base-color-2);
|
background-color: var(--background-color);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
@ -29,19 +29,18 @@ svg {
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
border: 7px solid rgba(0, 0, 0, 0);
|
border: 7px solid rgba(0, 0, 0, 0);
|
||||||
background-color: var(--base-color-3);
|
background-color: var(--base-color-4);
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
border: 7px solid rgba(0, 0, 0, 0);
|
border: 7px solid rgba(0, 0, 0, 0);
|
||||||
background-color: var(--base-color-8);
|
background-color: var(--base-color-9);
|
||||||
border-radius: var(--border-radius-full);
|
border-radius: var(--border-radius-full);
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
::-webkit-scrollbar-thumb:hover {
|
||||||
border: 4px solid rgba(0, 0, 0, 0);
|
border: 4px solid rgba(0, 0, 0, 0);
|
||||||
background-color: var(--base-color-8);
|
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue