|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import { Option, Select } from "@mui/joy";
|
|
|
|
|
import { CogIcon, DatabaseIcon, KeyIcon, LibraryIcon, LucideIcon, Settings2Icon, UserIcon, UsersIcon } from "lucide-react";
|
|
|
|
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
|
|
import { useLocation } from "react-router-dom";
|
|
|
|
|
import MobileHeader from "@/components/MobileHeader";
|
|
|
|
|
import MemberSection from "@/components/Settings/MemberSection";
|
|
|
|
|
import MemoRelatedSettings from "@/components/Settings/MemoRelatedSettings";
|
|
|
|
@ -37,6 +38,7 @@ const SECTION_ICON_MAP: Record<SettingSection, LucideIcon> = {
|
|
|
|
|
|
|
|
|
|
const Setting = () => {
|
|
|
|
|
const t = useTranslate();
|
|
|
|
|
const location = useLocation();
|
|
|
|
|
const commonContext = useCommonContext();
|
|
|
|
|
const user = useCurrentUser();
|
|
|
|
|
const workspaceSettingStore = useWorkspaceSettingStore();
|
|
|
|
@ -53,6 +55,17 @@ const Setting = () => {
|
|
|
|
|
return settingList;
|
|
|
|
|
}, [isHost]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
let hash = location.hash.slice(1) as SettingSection;
|
|
|
|
|
// If the hash is not a valid section, redirect to the default section.
|
|
|
|
|
if (![...BASIC_SECTIONS, ...ADMIN_SECTIONS].includes(hash)) {
|
|
|
|
|
hash = "my-account";
|
|
|
|
|
}
|
|
|
|
|
setState({
|
|
|
|
|
selectedSection: hash,
|
|
|
|
|
});
|
|
|
|
|
}, [location.hash]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isHost) {
|
|
|
|
|
return;
|
|
|
|
@ -67,9 +80,7 @@ const Setting = () => {
|
|
|
|
|
}, [isHost]);
|
|
|
|
|
|
|
|
|
|
const handleSectionSelectorItemClick = useCallback((settingSection: SettingSection) => {
|
|
|
|
|
setState({
|
|
|
|
|
selectedSection: settingSection,
|
|
|
|
|
});
|
|
|
|
|
window.location.hash = settingSection;
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|