From 402d6d6041cfd895139f88843940de507efda383 Mon Sep 17 00:00:00 2001 From: LynithDev <61880709+LynithDev@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:22:09 +0200 Subject: [PATCH] feat: More settings --- desktop/src/globals.css | 6 +- desktop/src/ui/components/SettingsRow.tsx | 21 ++++--- desktop/src/ui/components/base/TextField.tsx | 2 +- .../src/ui/pages/settings/SettingsRoot.tsx | 4 +- .../settings/about/SettingsDeveloper.tsx | 56 +++++++++++++++++++ .../pages/settings/game/SettingsMinecraft.tsx | 42 ++++++++++++-- .../settings/launcher/SettingsAppearance.tsx | 4 +- .../settings/launcher/SettingsGeneral.tsx | 45 ++++++++++++++- 8 files changed, 157 insertions(+), 23 deletions(-) create mode 100644 desktop/src/ui/pages/settings/about/SettingsDeveloper.tsx diff --git a/desktop/src/globals.css b/desktop/src/globals.css index 86523798..bb9d797a 100644 --- a/desktop/src/globals.css +++ b/desktop/src/globals.css @@ -73,7 +73,7 @@ h4 { @apply text-lg font-medium; } transform: translateX(0); } -body.reduce-motion * { - transition-duration: 0.0001ms !important; - animation-duration: 0.0001ms !important; +body.reduce-motion *, body.reduce-motion *::after, body.reduce-motion *::before { + transition-duration: 0.00001ms !important; + animation-duration: 0.00001ms !important; } diff --git a/desktop/src/ui/components/SettingsRow.tsx b/desktop/src/ui/components/SettingsRow.tsx index d71f430b..d5bb35c1 100644 --- a/desktop/src/ui/components/SettingsRow.tsx +++ b/desktop/src/ui/components/SettingsRow.tsx @@ -1,17 +1,18 @@ -import { type JSX, type ParentProps, createEffect } from 'solid-js'; +import type { JSX, ParentProps } from 'solid-js'; type SettingsRowProps = ParentProps & { - title: string; - description: string; + title: JSX.Element; + description: JSX.Element; icon: JSX.Element; - clickable?: () => any; + onClick?: () => any; }; function SettingsRow(props: SettingsRowProps) { - const interactableClass = createEffect(() => props.clickable ? 'hover:bg-component-bg-hover active:bg-component-bg-pressed' : ''); - return ( -
+
{props.icon}
@@ -21,11 +22,15 @@ function SettingsRow(props: SettingsRowProps) {

{props.description}

-
+
{props.children}
); } +SettingsRow.Header = (props: JSX.HTMLAttributes) => { + return

; +}; + export default SettingsRow; diff --git a/desktop/src/ui/components/base/TextField.tsx b/desktop/src/ui/components/base/TextField.tsx index 2d9b42eb..1ca3e993 100644 --- a/desktop/src/ui/components/base/TextField.tsx +++ b/desktop/src/ui/components/base/TextField.tsx @@ -1,5 +1,5 @@ import type { JSX } from 'solid-js'; -import { createEffect, createSignal, createUniqueId, splitProps } from 'solid-js'; +import { createSignal, createUniqueId, splitProps } from 'solid-js'; import styles from './TextField.module.scss'; type TextFieldProps = { diff --git a/desktop/src/ui/pages/settings/SettingsRoot.tsx b/desktop/src/ui/pages/settings/SettingsRoot.tsx index 751e2880..08f460ab 100644 --- a/desktop/src/ui/pages/settings/SettingsRoot.tsx +++ b/desktop/src/ui/pages/settings/SettingsRoot.tsx @@ -6,6 +6,7 @@ import SettingsGeneral from './launcher/SettingsGeneral'; import SettingsAppearance from './launcher/SettingsAppearance'; import SettingsAccounts from './game/SettingsAccounts'; import SettingsMinecraft from './game/SettingsMinecraft'; +import SettingsDeveloper from './about/SettingsDeveloper'; import AnimatedRoutes from '~ui/components/AnimatedRoutes'; import ErrorBoundary from '~ui/components/ErrorBoundary'; @@ -21,6 +22,7 @@ function SettingsRoutes() { {/* About */} + ); } @@ -44,9 +46,9 @@ function SettingsRoot(props: ParentProps) { [, 'Accounts', '/accounts'], ], 'About': [ - [, 'Developer Options', '/developer'], [, 'Changelog', '/changelog'], [, 'Feedback', '/feedback'], + [, 'Developer Options', '/developer'], ], }} /> diff --git a/desktop/src/ui/pages/settings/about/SettingsDeveloper.tsx b/desktop/src/ui/pages/settings/about/SettingsDeveloper.tsx new file mode 100644 index 00000000..2e61d784 --- /dev/null +++ b/desktop/src/ui/pages/settings/about/SettingsDeveloper.tsx @@ -0,0 +1,56 @@ +import { CodeBrowserIcon, GitMergeIcon, LinkExternal01Icon, RefreshCcw05Icon } from '@untitled-theme/icons-solid'; +import Button from '~ui/components/base/Button'; +import Toggle from '~ui/components/base/Toggle'; +import ScrollableContainer from '~ui/components/ScrollableContainer'; +import SettingsRow from '~ui/components/SettingsRow'; +import Sidebar from '~ui/components/Sidebar'; +import useSettingsContext from '~ui/hooks/useSettings'; + +function SettingsDeveloper() { + const settings = useSettingsContext(); + + return ( + +

Developer Options

+

You probably shouldn't mess with any of these if you don't know what you're doing!

+ + } + > +

+ } + > + settings.disable_discord = !value} + /> + + } > + } + > + settings.disable_analytics = !value} + /> + + + Folders and Files + + } + > +