From 8f2b29abb590e9b282362f3bcfe418c2d9d98dbc Mon Sep 17 00:00:00 2001 From: Ategon Dev Date: Mon, 15 Jul 2024 18:29:36 +0000 Subject: [PATCH] Settings redesign --- .../client/src/components/Info/InfoHeader.tsx | 29 --------- .../src/components/Info/InfoSidebar.tsx | 40 +++---------- .../components/Overlay/OverlaySettings.tsx | 11 ++-- .../src/components/Settings/ChatSettings.tsx | 27 +++++---- .../components/Settings/SettingsSidebar.tsx | 59 ++++++++----------- .../components/Settings/TemplateSettings.tsx | 25 ++++---- .../client/src/components/SidebarBase.tsx | 56 ++++++++++++++++++ 7 files changed, 128 insertions(+), 119 deletions(-) delete mode 100644 packages/client/src/components/Info/InfoHeader.tsx create mode 100644 packages/client/src/components/SidebarBase.tsx diff --git a/packages/client/src/components/Info/InfoHeader.tsx b/packages/client/src/components/Info/InfoHeader.tsx deleted file mode 100644 index 90101b5..0000000 --- a/packages/client/src/components/Info/InfoHeader.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Button } from "@nextui-org/react"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faXmark } from "@fortawesome/free-solid-svg-icons"; -import { faInfoCircle } from "@fortawesome/free-solid-svg-icons"; - -export type InfoHeaderProps = { - setInfoSidebar: (value: boolean) => void -} - -export const InfoHeader = ({ setInfoSidebar }: InfoHeaderProps) => { - return ( -
-
-
- -
-

Info

-

Information about the event

-
-
- -
- - -
- ); -}; diff --git a/packages/client/src/components/Info/InfoSidebar.tsx b/packages/client/src/components/Info/InfoSidebar.tsx index 24a18c2..6abb8b3 100644 --- a/packages/client/src/components/Info/InfoSidebar.tsx +++ b/packages/client/src/components/Info/InfoSidebar.tsx @@ -1,9 +1,8 @@ -import { Divider } from "@nextui-org/react"; import { useAppContext } from "../../contexts/AppContext"; -import { InfoHeader } from "./InfoHeader"; import { InfoText } from "./InfoText"; import { InfoButtons } from "./InfoButtons"; -import { motion } from "framer-motion" +import { SidebarBase } from "../SidebarBase"; +import { faInfoCircle } from "@fortawesome/free-solid-svg-icons"; /** * Information sidebar @@ -16,39 +15,18 @@ export const InfoSidebar = () => { const { infoSidebar, setInfoSidebar } = useAppContext(); return ( -
- - - + +
- - - -
-

Build {__COMMIT_HASH__}

- -
- ); -}; +
+ + + ) +}; \ No newline at end of file diff --git a/packages/client/src/components/Overlay/OverlaySettings.tsx b/packages/client/src/components/Overlay/OverlaySettings.tsx index 889ed5d..01c02ec 100644 --- a/packages/client/src/components/Overlay/OverlaySettings.tsx +++ b/packages/client/src/components/Overlay/OverlaySettings.tsx @@ -6,11 +6,12 @@ export const OverlaySettings = () => { useAppContext(); return ( - <> -
-

Overlays

+
+
+

Overlays

+

Overlays to display additional info over the canvas

-
+
@@ -56,6 +57,6 @@ export const OverlaySettings = () => { /> )}
- +
); }; diff --git a/packages/client/src/components/Settings/ChatSettings.tsx b/packages/client/src/components/Settings/ChatSettings.tsx index fa90cb8..8653355 100644 --- a/packages/client/src/components/Settings/ChatSettings.tsx +++ b/packages/client/src/components/Settings/ChatSettings.tsx @@ -8,18 +8,25 @@ export const ChatSettings = () => { const { loadChat, setLoadChat } = useAppContext(); return ( - <> -
- -

Chat

+
+
+
+ +

Chat

+
+

Chatting with other canvas users

- {loadChat && } + {loadChat && +
+ +
+ }
- +
); }; diff --git a/packages/client/src/components/Settings/SettingsSidebar.tsx b/packages/client/src/components/Settings/SettingsSidebar.tsx index cc00779..7334faa 100644 --- a/packages/client/src/components/Settings/SettingsSidebar.tsx +++ b/packages/client/src/components/Settings/SettingsSidebar.tsx @@ -1,41 +1,34 @@ -import { Button } from "@nextui-org/react"; +import { faGear } from "@fortawesome/free-solid-svg-icons"; import { useAppContext } from "../../contexts/AppContext"; +import { SidebarBase } from "../SidebarBase"; +import { Button, Divider } from "@nextui-org/react"; import { TemplateSettings } from "./TemplateSettings"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faXmark } from "@fortawesome/free-solid-svg-icons/faXmark"; import { ChatSettings } from "./ChatSettings"; import { OverlaySettings } from "../Overlay/OverlaySettings"; export const SettingsSidebar = () => { - const { settingsSidebar, setSettingsSidebar, setShowKeybinds } = - useAppContext(); + const { settingsSidebar, setSettingsSidebar, setShowKeybinds } = useAppContext(); return ( -
-
-

Settings

-
- -
-
- abc - -
- - - -
- ); -}; + +
+ + + + + + +
+ +
+
+
+ ) +}; \ No newline at end of file diff --git a/packages/client/src/components/Settings/TemplateSettings.tsx b/packages/client/src/components/Settings/TemplateSettings.tsx index 3bd7ae1..e7027e9 100644 --- a/packages/client/src/components/Settings/TemplateSettings.tsx +++ b/packages/client/src/components/Settings/TemplateSettings.tsx @@ -22,16 +22,19 @@ export const TemplateSettings = () => { } = useTemplateContext(); return ( - <> -
- -

Template

+
+
+
+ +

Template

+
+

Displaying an image over the canvas to help guide placing

-
+ {enable &&
{ > Show Mobile Tools -
- +
} +
); }; diff --git a/packages/client/src/components/SidebarBase.tsx b/packages/client/src/components/SidebarBase.tsx new file mode 100644 index 0000000..b29d87f --- /dev/null +++ b/packages/client/src/components/SidebarBase.tsx @@ -0,0 +1,56 @@ +import { motion } from "framer-motion" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { IconProp } from "@fortawesome/fontawesome-svg-core"; +import { Button, Divider } from "@nextui-org/react"; +import { faXmark } from "@fortawesome/free-solid-svg-icons"; + +/** + * Information sidebar + * + * TODO: add customization for this post-event (#46) + * + * @returns + */ +export const SidebarBase = ({children, shown, icon, setSidebarShown, title, description, side}: { children: string | JSX.Element | JSX.Element[], icon: IconProp, shown: boolean, setSidebarShown: (value: boolean) => void, title: string, description: string, side: "Left" | "Right" }) => { + return ( +
+ + + +
+
+
+ +
+

{title}

+

{description}

+
+
+ +
+ + +
+ + {children} +
+
+ ); +};