From 9e057d4395e8eddfcbb984a81f3fec247139cced Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 28 Dec 2024 05:49:30 +0900 Subject: [PATCH 1/2] [bugfix] Config Page: To reset scroll position to top when the tabs are changed. --- .../app/config_page/setting_section/SettingSection.jsx | 10 +++++++++- src-ui/logics/configs/useSettingBoxScrollPosition.js | 10 ++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src-ui/app/config_page/setting_section/SettingSection.jsx b/src-ui/app/config_page/setting_section/SettingSection.jsx index c39e6221..b70b7763 100644 --- a/src-ui/app/config_page/setting_section/SettingSection.jsx +++ b/src-ui/app/config_page/setting_section/SettingSection.jsx @@ -2,14 +2,22 @@ import { useRef, useLayoutEffect, useEffect } from "react"; import styles from "./SettingSection.module.scss"; import { SettingBox } from "./setting_box/SettingBox"; -import { store } from "@store"; +import { store, useStore_SelectedConfigTabId } from "@store"; +import { useSettingBoxScrollPosition } from "@logics_configs"; export const SettingSection = () => { + const { currentSelectedConfigTabId } = useStore_SelectedConfigTabId(); + const { resetScrollPosition } = useSettingBoxScrollPosition(); const scrollContainerRef = useRef(null); + useLayoutEffect(() => { store.setting_box_scroll_container = scrollContainerRef; }, []); + useEffect(() => { + resetScrollPosition(); + }, [currentSelectedConfigTabId.data]); + return (
diff --git a/src-ui/logics/configs/useSettingBoxScrollPosition.js b/src-ui/logics/configs/useSettingBoxScrollPosition.js index c0a19b98..87d8365c 100644 --- a/src-ui/logics/configs/useSettingBoxScrollPosition.js +++ b/src-ui/logics/configs/useSettingBoxScrollPosition.js @@ -9,19 +9,25 @@ export const useSettingBoxScrollPosition = () => { } }; const restoreScrollPosition = () => { - if (store.setting_box_scroll_container.current) { updateSettingBoxScrollPosition((pre) => { store.setting_box_scroll_container.current.scrollTop = pre.data; return pre.data; }) } - }; + const resetScrollPosition = () => { + if (store.setting_box_scroll_container.current) { + store.setting_box_scroll_container.current.scrollTop = 0; + updateSettingBoxScrollPosition(0); + } + } + return { saveScrollPosition, restoreScrollPosition, + resetScrollPosition, currentSettingBoxScrollPosition, updateSettingBoxScrollPosition, }; From 833fa24545dc061dd0c6b3bd4672c31e02b226ae Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 28 Dec 2024 07:31:16 +0900 Subject: [PATCH 2/2] [Update] Config Page: Adjust slider component and deepL auth key component width. --- .../deepl_auth_key/DeeplAuthKey.module.scss | 5 ++++- .../label_component/LabelComponent.module.scss | 1 + .../setting_box/_components/slider/Slider.jsx | 2 +- .../setting_box/_components/slider/Slider.module.scss | 4 ++++ .../setting_box/_templates/Templates.jsx | 2 +- .../setting_box/_templates/Templates.module.scss | 2 +- .../config_page/setting_section/setting_box/vr/Vr.jsx | 10 ++++++++++ .../setting_section/setting_box/vr/Vr.module.scss | 10 ++++++---- 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.module.scss b/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.module.scss index 575ec8bc..915f300c 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.module.scss @@ -4,6 +4,7 @@ justify-content: center; align-items: center; gap: 1rem; + flex-shrink: 0; } .entry_section_wrapper { @@ -72,13 +73,14 @@ } .open_webpage_button { - padding: 0.6rem 3.2rem; + padding: 0.6rem 2.8rem; display: flex; gap: 1rem; justify-content: center; align-items: center; border-radius: 0.4rem; cursor: pointer; + flex-shrink: 0; &:hover { background-color: var(--dark_825_color); } @@ -95,4 +97,5 @@ .external_link_svg { color: var(--dark_500_color); width: 1.6rem; + flex-shrink: 0; } \ No newline at end of file diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/label_component/LabelComponent.module.scss b/src-ui/app/config_page/setting_section/setting_box/_components/label_component/LabelComponent.module.scss index 7aa82d3c..c49055a8 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/label_component/LabelComponent.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/_components/label_component/LabelComponent.module.scss @@ -10,6 +10,7 @@ font-weight: 400; color: var(--dark_basic_text_color); white-space: nowrap; + width: max-content; } .desc { diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.jsx index 4a5e6edf..3e896a59 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.jsx @@ -5,7 +5,7 @@ import { clsx } from "clsx"; export const Slider = (props) => { return ( -
+
{ return ( - + ); }; diff --git a/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.module.scss b/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.module.scss index 66bb6464..cab3118a 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.module.scss @@ -4,7 +4,7 @@ justify-content: space-between; align-items: center; padding: 2rem; - gap: 10rem; + gap: 2rem; &.flex_column { flex-direction: column; } diff --git a/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx b/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx index cf19c1ab..e1197b22 100644 --- a/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx @@ -199,6 +199,7 @@ const PositionControls = ({settings, onchangeFunction, selectFunction, ui_config

{

{

{

{t("config_page.vr.display_duration")}

{

{t("config_page.vr.fadeout_duration")}