mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Merged nav menus.
This commit is contained in:
parent
2f5e69229c
commit
554054d3a1
12 changed files with 164 additions and 47 deletions
|
|
@ -1,22 +1,25 @@
|
|||
'use client';
|
||||
import { Grid, Loading, Column } from '@umami/react-zen';
|
||||
import Script from 'next/script';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { UpdateNotice } from './UpdateNotice';
|
||||
import { SideNav } from '@/app/(main)/SideNav';
|
||||
import { useLoginQuery, useConfig } from '@/components/hooks';
|
||||
import { useLoginQuery, useConfig, useNavigation } from '@/components/hooks';
|
||||
|
||||
export function App({ children }) {
|
||||
const { user, isLoading, error } = useLoginQuery();
|
||||
const config = useConfig();
|
||||
const pathname = usePathname();
|
||||
const { pathname, router } = useNavigation();
|
||||
|
||||
if (isLoading || !config) {
|
||||
return <Loading placement="absolute" />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
window.location.href = `${process.env.basePath || ''}/login`;
|
||||
if (process.env.cloudMode) {
|
||||
window.location.href = '/login';
|
||||
} else {
|
||||
router.push('/login');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { Key } from 'react';
|
||||
import Link from 'next/link';
|
||||
import {
|
||||
Sidebar,
|
||||
|
|
@ -12,8 +13,7 @@ import { Globe, LinkIcon, LogoSvg, Grid2x2, PanelLeft } from '@/components/icons
|
|||
import { useMessages, useNavigation, useGlobalState } from '@/components/hooks';
|
||||
import { NavButton } from '@/components/input/NavButton';
|
||||
import { PanelButton } from '@/components/input/PanelButton';
|
||||
import { Key } from 'react';
|
||||
import { SettingsButton } from '@/components/input/SettingsButton';
|
||||
import { LanguageButton } from '@/components/input/LanguageButton';
|
||||
|
||||
export function SideNav(props: SidebarProps) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
|
@ -77,9 +77,9 @@ export function SideNav(props: SidebarProps) {
|
|||
})}
|
||||
</SidebarSection>
|
||||
<SidebarSection justifyContent="flex-start">
|
||||
<Row>
|
||||
<SettingsButton />
|
||||
{!isCollapsed && !hasNav && <ThemeButton />}
|
||||
<Row wrap="wrap">
|
||||
<LanguageButton />
|
||||
<ThemeButton />
|
||||
</Row>
|
||||
</SidebarSection>
|
||||
</Sidebar>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue