mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-23 19:05:16 +02:00
refactor: implement UserSettingsPage and UserSettingsPanel components, replacing UserSettingsDialog and enhancing user settings navigation
This commit is contained in:
parent
5bcda6b83b
commit
08142f9add
8 changed files with 357 additions and 205 deletions
|
|
@ -0,0 +1,36 @@
|
|||
import { UserSettingsPanel, type UserSettingsTab } from "@/components/settings/user-settings-panel";
|
||||
|
||||
const USER_SETTINGS_TABS = new Set<string>([
|
||||
"profile",
|
||||
"api-key",
|
||||
"prompts",
|
||||
"community-prompts",
|
||||
"memory",
|
||||
"agent-permissions",
|
||||
"agent-status",
|
||||
"purchases",
|
||||
"desktop",
|
||||
"desktop-shortcuts",
|
||||
]);
|
||||
|
||||
function getInitialTab(tab: string | string[] | undefined): UserSettingsTab {
|
||||
const value = Array.isArray(tab) ? tab[0] : tab;
|
||||
return value && USER_SETTINGS_TABS.has(value) ? (value as UserSettingsTab) : "profile";
|
||||
}
|
||||
|
||||
export default async function UserSettingsPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ search_space_id: string }>;
|
||||
searchParams: Promise<{ tab?: string | string[] }>;
|
||||
}) {
|
||||
const [{ search_space_id }, resolvedSearchParams] = await Promise.all([params, searchParams]);
|
||||
|
||||
return (
|
||||
<UserSettingsPanel
|
||||
searchSpaceId={search_space_id}
|
||||
initialTab={getInitialTab(resolvedSearchParams.tab)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue