From 923f99fe7a0723e5673ac57279dbdc4ed8a50bd7 Mon Sep 17 00:00:00 2001 From: Ivan Evans <74743263+Pasithea0@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:43:03 -0700 Subject: [PATCH] Add source order edit button --- .../atoms/settings/SourceSelectingView.tsx | 8 ++++ src/pages/Settings.tsx | 10 +++++ src/pages/parts/settings/PreferencesPart.tsx | 42 ++++++++++--------- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/components/player/atoms/settings/SourceSelectingView.tsx b/src/components/player/atoms/settings/SourceSelectingView.tsx index f995308e..478b5cdc 100644 --- a/src/components/player/atoms/settings/SourceSelectingView.tsx +++ b/src/components/player/atoms/settings/SourceSelectingView.tsx @@ -2,6 +2,7 @@ import { ReactNode, useEffect, useMemo, useRef } from "react"; import { useTranslation } from "react-i18next"; import { getCachedMetadata } from "@/backend/helpers/providerApi"; +import { Button } from "@/components/buttons/Button"; import { Loading } from "@/components/layout/Loading"; import { useEmbedScraping, @@ -146,6 +147,13 @@ export function SourceSelectionView({ <> router.navigate("/")}> {t("player.menus.sources.title")} + {sources.map((v) => ( diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index c7aac318..c26277b0 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -103,6 +103,16 @@ export function AccountSettings(props: { } export function SettingsPage() { + useEffect(() => { + const hash = window.location.hash; + if (hash) { + const element = document.querySelector(hash); + if (element) { + element.scrollIntoView({ behavior: "smooth" }); + } + } + }, []); + const { t } = useTranslation(); const activeTheme = useThemeStore((s) => s.theme); const setTheme = useThemeStore((s) => s.setTheme); diff --git a/src/pages/parts/settings/PreferencesPart.tsx b/src/pages/parts/settings/PreferencesPart.tsx index d127655f..a734d784 100644 --- a/src/pages/parts/settings/PreferencesPart.tsx +++ b/src/pages/parts/settings/PreferencesPart.tsx @@ -112,27 +112,29 @@ export function PreferencesPart(props: { -
-

- {t("settings.preferences.sourceOrder")} -

-

- {t("settings.preferences.sourceOrderDescription")} -

+
+
+

+ {t("settings.preferences.sourceOrder")} +

+

+ {t("settings.preferences.sourceOrderDescription")} +

- - props.setSourceOrder(items.map((item) => item.id)) - } - /> - + + props.setSourceOrder(items.map((item) => item.id)) + } + /> + +
);