Move checklist to admin settings
This commit is contained in:
parent
bb94f75270
commit
8e18eb7766
@ -1,9 +1,15 @@
|
||||
'use client';
|
||||
|
||||
import SiteGrid from '@/components/SiteGrid';
|
||||
import {
|
||||
PATH_ADMIN_SETTINGS,
|
||||
checkPathPrefix,
|
||||
isPathAdminSettings,
|
||||
} from '@/site/paths';
|
||||
import { cc } from '@/utility/css';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { BiCog } from 'react-icons/bi';
|
||||
|
||||
export default function AdminNav({
|
||||
items,
|
||||
@ -20,10 +26,12 @@ export default function AdminNav({
|
||||
<SiteGrid
|
||||
contentMain={
|
||||
<div className={cc(
|
||||
'flex gap-2 md:gap-4',
|
||||
'border-b border-gray-200 dark:border-gray-800 pb-3',
|
||||
)}>
|
||||
<div className={cc(
|
||||
'flex gap-2 md:gap-4',
|
||||
'flex-grow',
|
||||
)}>
|
||||
{items.map(({ label, href, count }) =>
|
||||
<Link
|
||||
@ -31,13 +39,21 @@ export default function AdminNav({
|
||||
href={href}
|
||||
className={cc(
|
||||
'flex gap-0.5',
|
||||
pathname.startsWith(href) ? 'font-bold' : 'text-dim',
|
||||
checkPathPrefix(pathname, href) ? 'font-bold' : 'text-dim',
|
||||
)}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<span>({count})</span>
|
||||
</Link>)}
|
||||
</div>
|
||||
<Link
|
||||
href={PATH_ADMIN_SETTINGS}
|
||||
className={isPathAdminSettings(pathname)
|
||||
? 'font-bold'
|
||||
: 'text-dim'}
|
||||
>
|
||||
<BiCog />
|
||||
</Link>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
@ -4,7 +4,7 @@ import SiteChecklist from '@/site/SiteChecklist';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
export default async function ChecklistPage() {
|
||||
export default async function AdminSettingsPage() {
|
||||
return (
|
||||
<SiteGrid
|
||||
contentMain={<InfoBlock>
|
||||
@ -207,7 +207,7 @@ export default function SiteChecklistClient({
|
||||
</ChecklistRow>
|
||||
</Checklist>
|
||||
<Checklist
|
||||
title="Settings"
|
||||
title="Configuration"
|
||||
icon={<BiCog size={16} />}
|
||||
>
|
||||
<ChecklistRow
|
||||
|
||||
@ -17,7 +17,6 @@ export const PATH_GRID = '/grid';
|
||||
export const PATH_ADMIN = '/admin';
|
||||
export const PATH_SIGN_IN = '/sign-in';
|
||||
export const PATH_OG = '/og';
|
||||
export const PATH_CHECKLIST = '/checklist';
|
||||
|
||||
// Admin paths
|
||||
export const PATH_ADMIN_PHOTOS = `${PATH_ADMIN}/photos`;
|
||||
@ -25,6 +24,7 @@ export const PATH_ADMIN_UPLOADS = `${PATH_ADMIN}/uploads`;
|
||||
export const PATH_ADMIN_TAGS = `${PATH_ADMIN}/tags`;
|
||||
export const PATH_ADMIN_UPLOAD = `${PATH_ADMIN}/uploads`;
|
||||
export const PATH_ADMIN_UPLOAD_BLOB = `${PATH_ADMIN_UPLOAD}/blob`;
|
||||
export const PATH_ADMIN_SETTINGS = `${PATH_ADMIN}/settings`;
|
||||
|
||||
// Modifiers
|
||||
const SHARE = 'share';
|
||||
@ -158,18 +158,23 @@ export const isPathCameraPhoto = (pathname = '') =>
|
||||
export const isPathCameraPhotoShare = (pathname = '') =>
|
||||
new RegExp(`^${PREFIX_CAMERA}/[^/]+/[^/]+/${SHARE}/?$`).test(pathname);
|
||||
|
||||
export const isPathGrid = (pathname = '') =>
|
||||
pathname.startsWith(PATH_GRID);
|
||||
export const checkPathPrefix = (pathname = '', prefix: string) =>
|
||||
pathname.toLowerCase().startsWith(prefix);
|
||||
|
||||
export const isPathSignIn = (pathname = '') =>
|
||||
pathname.startsWith(PATH_SIGN_IN);
|
||||
export const isPathGrid = (pathname?: string) =>
|
||||
checkPathPrefix(pathname, PATH_GRID);
|
||||
|
||||
export const isPathAdmin = (pathname = '') =>
|
||||
pathname.startsWith(PATH_ADMIN);
|
||||
export const isPathSignIn = (pathname?: string) =>
|
||||
checkPathPrefix(pathname, PATH_SIGN_IN);
|
||||
|
||||
export const isPathProtected = (pathname = '') =>
|
||||
pathname.startsWith(PATH_ADMIN) ||
|
||||
pathname === PATH_CHECKLIST;
|
||||
export const isPathAdmin = (pathname?: string) =>
|
||||
checkPathPrefix(pathname, PATH_ADMIN);
|
||||
|
||||
export const isPathAdminSettings = (pathname?: string) =>
|
||||
checkPathPrefix(pathname, PATH_ADMIN_SETTINGS);
|
||||
|
||||
export const isPathProtected = (pathname?: string) =>
|
||||
checkPathPrefix(pathname, PATH_ADMIN);
|
||||
|
||||
export const getPathComponents = (pathname = ''): {
|
||||
photoId?: string
|
||||
|
||||
Loading…
Reference in New Issue
Block a user