From 54cd1d52ca2a423424c813157b47895ecad80f97 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sat, 18 Nov 2023 19:27:19 +0100 Subject: [PATCH] caption settings + working settings sidebar --- src/components/layout/Sidebar.tsx | 3 +- .../atoms/settings/CaptionSettingsView.tsx | 4 +- src/components/player/base/SubtitleView.tsx | 4 +- src/pages/Settings.tsx | 37 ++++++--- src/pages/settings/AccountActionsPart.tsx | 4 +- src/pages/settings/CaptionsPart.tsx | 78 ++++++++++++++++++ src/pages/settings/SidebarPart.tsx | 81 ++++++++++++++++--- src/pages/settings/ThemePart.tsx | 4 +- 8 files changed, 186 insertions(+), 29 deletions(-) create mode 100644 src/pages/settings/CaptionsPart.tsx diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 5f7a4e0b..87cc4db5 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -5,9 +5,10 @@ import { Icon, Icons } from "@/components/Icon"; export function SidebarSection(props: { title: string; children: React.ReactNode; + className?: string; }) { return ( -
+

{props.title}

diff --git a/src/components/player/atoms/settings/CaptionSettingsView.tsx b/src/components/player/atoms/settings/CaptionSettingsView.tsx index c175e747..bb29f329 100644 --- a/src/components/player/atoms/settings/CaptionSettingsView.tsx +++ b/src/components/player/atoms/settings/CaptionSettingsView.tsx @@ -33,7 +33,7 @@ export function ColorOption(props: { ); } -function CaptionSetting(props: { +export function CaptionSetting(props: { textTransformer?: (s: string) => string; value: number; onChange?: (val: number) => void; @@ -209,7 +209,7 @@ function CaptionSetting(props: { ); } -const colors = ["#ffffff", "#80b1fa", "#e2e535"]; +export const colors = ["#ffffff", "#80b1fa", "#e2e535"]; export function CaptionSettingsView({ id }: { id: string }) { const router = useOverlayRouter(id); diff --git a/src/components/player/base/SubtitleView.tsx b/src/components/player/base/SubtitleView.tsx index d1bf037f..dfc6767e 100644 --- a/src/components/player/base/SubtitleView.tsx +++ b/src/components/player/base/SubtitleView.tsx @@ -46,10 +46,10 @@ export function CaptionCue({ return (

diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 38bfe8c2..28a98b4a 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -1,3 +1,4 @@ +import classNames from "classnames"; import { useEffect } from "react"; import { useAsyncFn } from "react-use"; @@ -5,8 +6,10 @@ import { getSessions } from "@/backend/accounts/sessions"; import { WideContainer } from "@/components/layout/WideContainer"; import { Heading1 } from "@/components/utils/Text"; import { useBackendUrl } from "@/hooks/auth/useBackendUrl"; +import { useIsMobile } from "@/hooks/useIsMobile"; import { AccountActionsPart } from "@/pages/settings/AccountActionsPart"; import { AccountEditPart } from "@/pages/settings/AccountEditPart"; +import { CaptionsPart } from "@/pages/settings/CaptionsPart"; import { DeviceListPart } from "@/pages/settings/DeviceListPart"; import { RegisterCalloutPart } from "@/pages/settings/RegisterCalloutPart"; import { SidebarPart } from "@/pages/settings/SidebarPart"; @@ -17,9 +20,16 @@ import { useThemeStore } from "@/stores/theme"; import { SubPageLayout } from "./layouts/SubPageLayout"; function SettingsLayout(props: { children: React.ReactNode }) { + const { isMobile } = useIsMobile(); + return ( -

+
{props.children}
@@ -59,15 +69,22 @@ export function SettingsPage() { return ( - - Account - - {user.account ? ( - - ) : ( - - )} - +
+ + Account + + {user.account ? ( + + ) : ( + + )} +
+
+ +
+
+ +
); diff --git a/src/pages/settings/AccountActionsPart.tsx b/src/pages/settings/AccountActionsPart.tsx index 26449ee8..086d8cd4 100644 --- a/src/pages/settings/AccountActionsPart.tsx +++ b/src/pages/settings/AccountActionsPart.tsx @@ -25,7 +25,7 @@ export function AccountActionsPart() { Actions
Delete account @@ -34,7 +34,7 @@ export function AccountActionsPart() { can be recovered.

-
+