mirror of
https://github.com/docmost/docmost.git
synced 2025-11-14 00:32:59 +10:00
account preferences
This commit is contained in:
@ -21,6 +21,7 @@ import { useEffect } from "react";
|
|||||||
import { io } from "socket.io-client";
|
import { io } from "socket.io-client";
|
||||||
import { authTokensAtom } from "@/features/auth/atoms/auth-tokens-atom.ts";
|
import { authTokensAtom } from "@/features/auth/atoms/auth-tokens-atom.ts";
|
||||||
import { SOCKET_URL } from "@/features/websocket/types";
|
import { SOCKET_URL } from "@/features/websocket/types";
|
||||||
|
import AccountPreferences from "@/pages/settings/account/account-preferences.tsx";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [, setSocket] = useAtom(socketAtom);
|
const [, setSocket] = useAtom(socketAtom);
|
||||||
@ -66,8 +67,11 @@ export default function App() {
|
|||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route path={"/settings"} element={<SettingsLayout />}>
|
<Route path={"/settings"} element={<SettingsLayout />}>
|
||||||
<Route path={"profile"} element={<AccountSettings />} />
|
<Route path={"account/profile"} element={<AccountSettings />} />
|
||||||
<Route path={"profile/preferences"} element={<AccountSettings />} />
|
<Route
|
||||||
|
path={"account/preferences"}
|
||||||
|
element={<AccountPreferences />}
|
||||||
|
/>
|
||||||
<Route path={"workspace"} element={<WorkspaceSettings />} />
|
<Route path={"workspace"} element={<WorkspaceSettings />} />
|
||||||
<Route path={"members"} element={<WorkspaceMembers />} />
|
<Route path={"members"} element={<WorkspaceMembers />} />
|
||||||
<Route path={"groups"} element={<Groups />} />
|
<Route path={"groups"} element={<Groups />} />
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Group, Text, ScrollArea, ActionIcon, rem } from "@mantine/core";
|
import { Group, Text, ScrollArea, ActionIcon, rem } from "@mantine/core";
|
||||||
import {
|
import {
|
||||||
IconFingerprint,
|
|
||||||
IconUser,
|
IconUser,
|
||||||
IconSettings,
|
IconSettings,
|
||||||
IconUsers,
|
IconUsers,
|
||||||
IconArrowLeft,
|
IconArrowLeft,
|
||||||
IconUsersGroup,
|
IconUsersGroup,
|
||||||
IconSpaces,
|
IconSpaces,
|
||||||
|
IconBrush,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
import classes from "./settings.module.css";
|
import classes from "./settings.module.css";
|
||||||
@ -27,8 +27,12 @@ const groupedData: DataGroup[] = [
|
|||||||
{
|
{
|
||||||
heading: "Account",
|
heading: "Account",
|
||||||
items: [
|
items: [
|
||||||
{ label: "Profile", icon: IconUser, path: "/settings/profile" },
|
{ label: "Profile", icon: IconUser, path: "/settings/account/profile" },
|
||||||
{ label: "Preferences", icon: IconUser, path: "/settings/preferences" },
|
{
|
||||||
|
label: "Preferences",
|
||||||
|
icon: IconBrush,
|
||||||
|
path: "/settings/account/preferences",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
45
apps/client/src/features/user/components/account-theme.tsx
Normal file
45
apps/client/src/features/user/components/account-theme.tsx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import {
|
||||||
|
Group,
|
||||||
|
Text,
|
||||||
|
useMantineColorScheme,
|
||||||
|
Select,
|
||||||
|
MantineColorScheme,
|
||||||
|
} from "@mantine/core";
|
||||||
|
|
||||||
|
export default function AccountTheme() {
|
||||||
|
return (
|
||||||
|
<Group justify="space-between" wrap="nowrap" gap="xl">
|
||||||
|
<div>
|
||||||
|
<Text size="md">Theme</Text>
|
||||||
|
<Text size="sm" c="dimmed">
|
||||||
|
Choose your preferred color scheme.
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ThemeSwitcher />
|
||||||
|
</Group>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ThemeSwitcher() {
|
||||||
|
const { colorScheme, setColorScheme } = useMantineColorScheme();
|
||||||
|
|
||||||
|
const handleChange = (value: MantineColorScheme) => {
|
||||||
|
setColorScheme(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
label="Select theme"
|
||||||
|
data={[
|
||||||
|
{ value: "light", label: "Light" },
|
||||||
|
{ value: "dark", label: "Dark" },
|
||||||
|
{ value: "auto", label: "System settings" },
|
||||||
|
]}
|
||||||
|
value={colorScheme}
|
||||||
|
onChange={handleChange}
|
||||||
|
allowDeselect={false}
|
||||||
|
checkIconPosition="right"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import SettingsTitle from "@/components/layouts/settings/settings-title.tsx";
|
||||||
|
import AccountTheme from "@/features/user/components/account-theme.tsx";
|
||||||
|
|
||||||
|
export default function AccountPreferences() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SettingsTitle title="Preferences" />
|
||||||
|
<AccountTheme />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user