-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update settings sidebar
- Loading branch information
Showing
19 changed files
with
486 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Link } from '@tanstack/react-router'; | ||
import clsx from 'clsx'; | ||
import { | ||
LuBrain, | ||
LuClock, | ||
LuHardDrive, | ||
LuKey, | ||
LuScroll, | ||
LuSearch, | ||
LuSettings, | ||
} from 'react-icons/lu'; | ||
|
||
export const SettingsNav = () => { | ||
return ( | ||
<ul className="flex flex-col divide-y"> | ||
{( | ||
[ | ||
['', [['/settings', 'General', <LuSettings />]]], | ||
[ | ||
'Instance Settings', | ||
[ | ||
['/settings/search', 'Search', <LuSearch />], | ||
[ | ||
'/settings/intelligence', | ||
'Intelligence', | ||
<LuBrain />, | ||
], | ||
['/settings/storage', 'Storage', <LuHardDrive />], | ||
], | ||
], | ||
[ | ||
'Authentication', | ||
[ | ||
['/settings/sessions', 'Sessions', <LuClock />], | ||
[ | ||
'/settings/pat', | ||
'Personal Access Token', | ||
<LuKey />, | ||
], | ||
], | ||
], | ||
[ | ||
'System', | ||
[['/settings/build', 'Software Info', <LuScroll />]], | ||
], | ||
] as const | ||
).map(([group, items]) => ( | ||
<div key={group}> | ||
{group != '' && ( | ||
<h3 className="text-sm pt-4 px-2 pl-4 pb-1 text-neutral-500 font-bold"> | ||
{group} | ||
</h3> | ||
)} | ||
<ul className="flex flex-col pb-4 pl-2"> | ||
{items.map(([path, label, icon]) => ( | ||
<li | ||
key={path} | ||
className={clsx('gap-1 flex items-center')} | ||
> | ||
<Link | ||
to={path} | ||
activeOptions={{ exact: true }} | ||
className={clsx( | ||
'py-1 px-2 hover:bg-neutral-100 rounded-md flex items-center relative gap-2 cursor-pointer w-full text-neutral-700', | ||
'[&.active]:text-primary [&.active]:bg-neutral-500/10', | ||
// eslint-disable-next-line quotes | ||
"[&.active]:before:content-['']", | ||
'[&.active]:before:absolute [&.active]:before:-left-3 [&.active]:before:top-[12%] [&.active]:before:w-1 [&.active]:before:bottom-[12%] [&.active]:before:bg-blue-500 [&.active]:before:rounded-md' | ||
)} | ||
> | ||
{icon} | ||
{label} | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
))} | ||
</ul> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { ClassValue } from 'clsx'; | ||
import { FC, PropsWithChildren, ReactNode, useEffect } from 'react'; | ||
|
||
import { cn } from '@/util/style'; | ||
import { getTitle } from '@/util/title'; | ||
|
||
export type SidePageProperties = PropsWithChildren<{ | ||
title: string; | ||
width?: 'xl' | '2xl' | '3xl' | '4xl'; | ||
suffix?: ReactNode; | ||
className?: ClassValue; | ||
sidebar?: ReactNode; | ||
}>; | ||
|
||
export const SidePage: FC<SidePageProperties> = ({ | ||
children, | ||
title, | ||
width = '2xl', | ||
suffix, | ||
className, | ||
sidebar, | ||
}) => { | ||
useEffect(() => { | ||
document.title = getTitle(title); | ||
}, [title]); | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
'p-4 mt-8 mx-auto w-full space-y-4 pb-64 flex gap-8 justify-center md:flex-row flex-col', | ||
className | ||
)} | ||
> | ||
{sidebar && <div className="w-full md:max-w-64">{sidebar}</div>} | ||
<div className="w-full max-w-xl lg:max-w-2xl space-y-4"> | ||
<div className="flex items-end justify-between"> | ||
<h1 className="h1 pl-4">{title}</h1> | ||
{suffix} | ||
</div> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.