mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-01 19:59:44 +00:00
chore: split setting pages
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
import { Alert, Divider } from "@mui/joy";
|
||||
import PreferenceSection from "@/components/setting/PreferenceSection";
|
||||
import AccessTokenSection from "../components/setting/AccessTokenSection";
|
||||
import AccountSection from "../components/setting/AccountSection";
|
||||
import { Alert } from "@mui/joy";
|
||||
import { useEffect } from "react";
|
||||
import MemberSection from "../components/setting/MemberSection";
|
||||
import WorkspaceSection from "../components/setting/WorkspaceSection";
|
||||
import useUserStore from "../stores/v1/user";
|
||||
@ -10,21 +8,23 @@ const Setting: React.FC = () => {
|
||||
const currentUser = useUserStore().getCurrentUser();
|
||||
const isAdmin = currentUser.role === "ADMIN";
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAdmin) {
|
||||
window.location.href = "/";
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (!isAdmin) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl w-full px-3 md:px-12 py-6 flex flex-col justify-start items-start gap-y-12">
|
||||
<AccountSection />
|
||||
<AccessTokenSection />
|
||||
<PreferenceSection />
|
||||
{isAdmin && (
|
||||
<>
|
||||
<Divider />
|
||||
<Alert variant="soft" color="warning">
|
||||
You can see the settings items below because you are an Admin.
|
||||
</Alert>
|
||||
<MemberSection />
|
||||
<WorkspaceSection />
|
||||
</>
|
||||
)}
|
||||
<Alert variant="soft" color="warning">
|
||||
You can see the settings items below because you are an Admin.
|
||||
</Alert>
|
||||
<MemberSection />
|
||||
<WorkspaceSection />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
15
frontend/web/src/pages/UserSetting.tsx
Normal file
15
frontend/web/src/pages/UserSetting.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import PreferenceSection from "@/components/setting/PreferenceSection";
|
||||
import AccessTokenSection from "../components/setting/AccessTokenSection";
|
||||
import AccountSection from "../components/setting/AccountSection";
|
||||
|
||||
const Setting: React.FC = () => {
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl w-full px-3 md:px-12 py-6 flex flex-col justify-start items-start gap-y-12">
|
||||
<AccountSection />
|
||||
<AccessTokenSection />
|
||||
<PreferenceSection />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Setting;
|
Reference in New Issue
Block a user