From 613611cea3df3797cc17e2a547f983f22c2d7be7 Mon Sep 17 00:00:00 2001 From: shatfield4 Date: Mon, 26 Feb 2024 21:05:31 -0800 Subject: [PATCH] main and settings sidebar UI updates & improve performance using Link instead of --- frontend/src/components/Footer/index.jsx | 1 - .../src/components/SettingsButton/index.jsx | 24 +++++-- .../src/components/SettingsSidebar/index.jsx | 65 ++++++++----------- .../Sidebar/ActiveWorkspaces/index.jsx | 13 ++-- frontend/src/components/Sidebar/index.jsx | 9 ++- 5 files changed, 59 insertions(+), 53 deletions(-) diff --git a/frontend/src/components/Footer/index.jsx b/frontend/src/components/Footer/index.jsx index 4b175405..17048980 100644 --- a/frontend/src/components/Footer/index.jsx +++ b/frontend/src/components/Footer/index.jsx @@ -1,6 +1,5 @@ import System from "@/models/system"; import paths from "@/utils/paths"; -import { safeJsonParse } from "@/utils/request"; import { BookOpen, DiscordLogo, diff --git a/frontend/src/components/SettingsButton/index.jsx b/frontend/src/components/SettingsButton/index.jsx index 18c7b1a1..ae3aeb9f 100644 --- a/frontend/src/components/SettingsButton/index.jsx +++ b/frontend/src/components/SettingsButton/index.jsx @@ -1,17 +1,29 @@ import useUser from "@/hooks/useUser"; import paths from "@/utils/paths"; -import { Wrench } from "@phosphor-icons/react"; +import { ArrowUUpLeft, Wrench } from "@phosphor-icons/react"; +import { Link } from "react-router-dom"; +import { useMatch } from "react-router-dom"; export default function SettingsButton() { + const isInSettings = !!useMatch("/settings/*"); const { user } = useUser(); + + if (isInSettings) + return ( + + + + ); + return ( - - + ); } diff --git a/frontend/src/components/SettingsSidebar/index.jsx b/frontend/src/components/SettingsSidebar/index.jsx index ea488711..96610d4d 100644 --- a/frontend/src/components/SettingsSidebar/index.jsx +++ b/frontend/src/components/SettingsSidebar/index.jsx @@ -13,7 +13,6 @@ import { Database, Lock, House, - X, List, FileCode, Plugs, @@ -25,6 +24,7 @@ import useUser from "@/hooks/useUser"; import { USER_BACKGROUND_COLOR } from "@/utils/constants"; import { isMobile } from "react-device-detect"; import Footer from "../Footer"; +import { Link } from "react-router-dom"; export default function SettingsSidebar() { const { logo } = useLogo(); @@ -124,50 +124,40 @@ export default function SettingsSidebar() { } return ( - <> +
+ + Logo +
-
- {/* Header Information */} -
-
- Logo -
-
- - - -
+
+
+ Instance Settings
-
- Settings -
- {/* Primary Body */} -
+
- {/* Options */}
-
+
- +
); } @@ -196,15 +186,16 @@ const Option = ({ return ( <> {!!subOptions && (isActive || hasActiveChild) && (
{ async function getWorkspaces() { @@ -92,12 +91,12 @@ export default function ActiveWorkspaces() { href={isActive ? null : paths.workspace.chat(workspace.slug)} className={` transition-all duration-[200ms] - flex flex-grow w-[75%] gap-x-2 py-[6px] px-[12px] rounded-[4px] text-slate-200 justify-start items-center - hover:bg-workspace-item-selected-gradient + flex flex-grow w-[75%] gap-x-2 py-[6px] px-[12px] rounded-[4px] text-white justify-start items-center + hover:bg-workspace-item-selected-gradient hover:font-bold border-2 border-outline ${ isActive - ? "bg-workspace-item-selected-gradient" - : "border-[2px] border-outline" + ? "bg-workspace-item-selected-gradient font-bold" + : "" }`} >
@@ -108,7 +107,7 @@ export default function ActiveWorkspaces() { size={24} />

diff --git a/frontend/src/components/Sidebar/index.jsx b/frontend/src/components/Sidebar/index.jsx index 0c38eb77..13aaeee1 100644 --- a/frontend/src/components/Sidebar/index.jsx +++ b/frontend/src/components/Sidebar/index.jsx @@ -9,6 +9,8 @@ import useLogo from "@/hooks/useLogo"; import useUser from "@/hooks/useUser"; import Footer from "../Footer"; import SettingsButton from "../SettingsButton"; +import { Link } from "react-router-dom"; +import paths from "@/utils/paths"; export default function Sidebar() { const { user } = useUser(); @@ -22,14 +24,17 @@ export default function Sidebar() { return (

-
+ Logo -
+