diff --git a/src/app/(main)/MobileNav.tsx b/src/app/(main)/MobileNav.tsx
index d3ff51ddc..a19449606 100644
--- a/src/app/(main)/MobileNav.tsx
+++ b/src/app/(main)/MobileNav.tsx
@@ -1,15 +1,19 @@
-import { Row, NavMenu, NavMenuItem, IconLabel, Text, Grid } from '@umami/react-zen';
-import { Globe, Grid2x2, LinkIcon } from '@/components/icons';
-import { useMessages, useNavigation } from '@/components/hooks';
-import Link from 'next/link';
import { WebsiteNav } from '@/app/(main)/websites/[websiteId]/WebsiteNav';
-import { Logo } from '@/components/svg';
-import { NavButton } from '@/components/input/NavButton';
+import { useMessages, useNavigation } from '@/components/hooks';
+import { Globe, Grid2x2, LinkIcon } from '@/components/icons';
import { MobileMenuButton } from '@/components/input/MobileMenuButton';
+import { NavButton } from '@/components/input/NavButton';
+import { Logo } from '@/components/svg';
+import { Grid, IconLabel, NavMenu, NavMenuItem, Row, Text } from '@umami/react-zen';
+import Link from 'next/link';
+import { AdminNav } from './admin/AdminNav';
+import { SettingsNav } from './settings/SettingsNav';
export function MobileNav() {
const { formatMessage, labels } = useMessages();
- const { websiteId, renderUrl } = useNavigation();
+ const { pathname, websiteId, renderUrl } = useNavigation();
+ const isAdmin = pathname.includes('/admin');
+ const isSettings = pathname.includes('/settings');
const links = [
{
@@ -51,6 +55,8 @@ export function MobileNav() {
})}
{websiteId && }
+ {isAdmin && }
+ {isSettings && }
>
);
}}
diff --git a/src/app/(main)/admin/AdminLayout.tsx b/src/app/(main)/admin/AdminLayout.tsx
index 8b1387854..3cc5aed39 100644
--- a/src/app/(main)/admin/AdminLayout.tsx
+++ b/src/app/(main)/admin/AdminLayout.tsx
@@ -1,61 +1,32 @@
'use client';
-import { ReactNode } from 'react';
-import { Grid, Column } from '@umami/react-zen';
-import { useLoginQuery, useMessages, useNavigation } from '@/components/hooks';
-import { User, Users, Globe } from '@/components/icons';
-import { SideMenu } from '@/components/common/SideMenu';
import { PageBody } from '@/components/common/PageBody';
+import { useLoginQuery } from '@/components/hooks';
+import { Column, Grid } from '@umami/react-zen';
+import { ReactNode } from 'react';
+import { AdminNav } from './AdminNav';
export function AdminLayout({ children }: { children: ReactNode }) {
const { user } = useLoginQuery();
- const { formatMessage, labels } = useMessages();
- const { pathname } = useNavigation();
if (!user.isAdmin || process.env.cloudMode) {
return null;
}
- const items = [
- {
- label: formatMessage(labels.manage),
- items: [
- {
- id: 'users',
- label: formatMessage(labels.users),
- path: '/admin/users',
- icon: ,
- },
- {
- id: 'websites',
- label: formatMessage(labels.websites),
- path: '/admin/websites',
- icon: ,
- },
- {
- id: 'teams',
- label: formatMessage(labels.teams),
- path: '/admin/teams',
- icon: ,
- },
- ],
- },
- ];
-
- const selectedKey = items
- .flatMap(e => e.items)
- ?.find(({ path }) => path && pathname.startsWith(path))?.id;
-
return (
-
-
-
+
+
+
+
+
+ {children}
- {children}
);
}
diff --git a/src/app/(main)/admin/AdminNav.tsx b/src/app/(main)/admin/AdminNav.tsx
new file mode 100644
index 000000000..20c011554
--- /dev/null
+++ b/src/app/(main)/admin/AdminNav.tsx
@@ -0,0 +1,48 @@
+import { SideMenu } from '@/components/common/SideMenu';
+import { useMessages, useNavigation } from '@/components/hooks';
+import { Globe, User, Users } from '@/components/icons';
+
+export function AdminNav({ onItemClick }: { onItemClick?: () => void }) {
+ const { formatMessage, labels } = useMessages();
+ const { pathname } = useNavigation();
+
+ const items = [
+ {
+ label: formatMessage(labels.manage),
+ items: [
+ {
+ id: 'users',
+ label: formatMessage(labels.users),
+ path: '/admin/users',
+ icon: ,
+ },
+ {
+ id: 'websites',
+ label: formatMessage(labels.websites),
+ path: '/admin/websites',
+ icon: ,
+ },
+ {
+ id: 'teams',
+ label: formatMessage(labels.teams),
+ path: '/admin/teams',
+ icon: ,
+ },
+ ],
+ },
+ ];
+
+ const selectedKey = items
+ .flatMap(e => e.items)
+ ?.find(({ path }) => path && pathname.startsWith(path))?.id;
+
+ return (
+
+ );
+}
diff --git a/src/app/(main)/admin/teams/AdminTeamsTable.tsx b/src/app/(main)/admin/teams/AdminTeamsTable.tsx
index d7c99a267..e54532583 100644
--- a/src/app/(main)/admin/teams/AdminTeamsTable.tsx
+++ b/src/app/(main)/admin/teams/AdminTeamsTable.tsx
@@ -1,11 +1,11 @@
-import { useState } from 'react';
-import { Row, Text, Icon, DataTable, DataColumn, MenuItem, Modal } from '@umami/react-zen';
-import Link from 'next/link';
-import { Trash } from '@/components/icons';
-import { useMessages } from '@/components/hooks';
-import { Edit } from '@/components/icons';
-import { MenuButton } from '@/components/input/MenuButton';
import { DateDistance } from '@/components/common/DateDistance';
+import { useMessages } from '@/components/hooks';
+import { Edit, Trash } from '@/components/icons';
+import { MenuButton } from '@/components/input/MenuButton';
+import { DataColumn, DataTable, Dialog, Icon, MenuItem, Modal, Row, Text } from '@umami/react-zen';
+import { TeamDeleteForm } from '../../teams/[teamId]/TeamDeleteForm';
+import Link from 'next/link';
+import { useState } from 'react';
export function AdminTeamsTable({
data = [],
@@ -15,7 +15,7 @@ export function AdminTeamsTable({
showActions?: boolean;
}) {
const { formatMessage, labels } = useMessages();
- const [deleteUser, setDeleteUser] = useState(null);
+ const [deleteTeam, setDeleteTeam] = useState(null);
return (
<>
@@ -60,7 +60,7 @@ export function AdminTeamsTable({