From 6367140708d5fdb4340d0ee333237047c39ba100 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:15:57 +0900 Subject: [PATCH 1/5] [Update] Config Page: VR Tab. Add section show only translated messages. --- locales/en.json | 5 +++- .../setting_section/setting_box/vr/Vr.jsx | 25 +++++++++++++++++ .../setting_box/vr/Vr.module.scss | 9 ++++++ src-ui/logics/configs/index.js | 1 + .../useOverlayShowOnlyTranslatedMessages.js | 28 +++++++++++++++++++ src-ui/logics/useReceiveRoutes.js | 6 ++++ src-ui/store.js | 1 + 7 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js diff --git a/locales/en.json b/locales/en.json index 97d74c3f..17660984 100644 --- a/locales/en.json +++ b/locales/en.json @@ -73,7 +73,10 @@ "ui_scaling": "UI Scaling", "display_duration": "Display duration", "fadeout_duration": "Fadeout duration", - "tracker": "Tracker" + "tracker": "Tracker", + "overlay_show_only_translated_messages": { + "label": "Show Only Translated Messages" + } }, "config_page": { "config_title": "Settings", 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 0d40346c..8e1eab2d 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 @@ -7,12 +7,19 @@ import { Slider } from "../_components/"; import { RadioButtonContainer, SwitchBoxContainer, + CheckboxContainer, } from "../_templates/Templates"; + +import { + SectionLabelComponent, +} from "../_components/"; + import { useIsEnabledOverlaySmallLog, useOverlaySmallLogSettings, useIsEnabledOverlayLargeLog, useOverlayLargeLogSettings, + useOverlayShowOnlyTranslatedMessages, } from "@logics_configs"; export const Vr = () => { @@ -56,6 +63,7 @@ export const Vr = () => { /> )} + ); }; @@ -311,4 +319,21 @@ const OtherControls = ({settings, onchangeFunction, ui_configs}) => { ); +}; + + +const CommonSettingsContainer = () => { + const { t } = useTranslation(); + const { currentOverlayShowOnlyTranslatedMessages, toggleOverlayShowOnlyTranslatedMessages } = useOverlayShowOnlyTranslatedMessages(); + + return ( +
+ + +
+ ); }; \ No newline at end of file diff --git a/src-ui/app/config_page/setting_section/setting_box/vr/Vr.module.scss b/src-ui/app/config_page/setting_section/setting_box/vr/Vr.module.scss index ba202ee0..e32a0fb2 100644 --- a/src-ui/app/config_page/setting_section/setting_box/vr/Vr.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/vr/Vr.module.scss @@ -6,6 +6,7 @@ position: relative; padding: 2rem; width: 100%; + gap: 4rem; } .wrapper { @@ -187,4 +188,12 @@ position: absolute; font-size: 1.6rem; width: 100%; +} + +.common_container { + width: 100%; +} + +.common_label { + font-size: 1.4rem; } \ No newline at end of file diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js index c38eda18..aff6b450 100644 --- a/src-ui/logics/configs/index.js +++ b/src-ui/logics/configs/index.js @@ -47,6 +47,7 @@ export { useSelectedCTranslate2ComputeDevice } from "./translation/useSelectedCT export { useIsEnabledOverlaySmallLog } from "./vr/useIsEnabledOverlaySmallLog"; export { useOverlaySmallLogSettings } from "./vr/useOverlaySmallLogSettings"; export { useIsEnabledOverlayLargeLog } from "./vr/useIsEnabledOverlayLargeLog"; +export { useOverlayShowOnlyTranslatedMessages } from "./vr/useOverlayShowOnlyTranslatedMessages"; export { useOverlayLargeLogSettings } from "./vr/useOverlayLargeLogSettings"; export { useOscIpAddress } from "./advanced_settings/useOscIpAddress"; diff --git a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js new file mode 100644 index 00000000..895581ae --- /dev/null +++ b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js @@ -0,0 +1,28 @@ +import { useStore_OverlayShowOnlyTranslatedMessages } from "@store"; +import { useStdoutToPython } from "@logics/useStdoutToPython"; + +export const useOverlayShowOnlyTranslatedMessages = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + const { currentOverlayShowOnlyTranslatedMessages, updateOverlayShowOnlyTranslatedMessages, pendingOverlayShowOnlyTranslatedMessages } = useStore_OverlayShowOnlyTranslatedMessages(); + + const getOverlayShowOnlyTranslatedMessages = () => { + pendingOverlayShowOnlyTranslatedMessages(); + asyncStdoutToPython("/get/data/overlay_show_only_translated_messages"); + }; + + const toggleOverlayShowOnlyTranslatedMessages = () => { + pendingOverlayShowOnlyTranslatedMessages(); + if (currentOverlayShowOnlyTranslatedMessages.data) { + asyncStdoutToPython("/set/disable/overlay_show_only_translated_messages"); + } else { + asyncStdoutToPython("/set/enable/overlay_show_only_translated_messages"); + } + }; + + return { + currentOverlayShowOnlyTranslatedMessages, + getOverlayShowOnlyTranslatedMessages, + updateOverlayShowOnlyTranslatedMessages, + toggleOverlayShowOnlyTranslatedMessages, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index f09c55e6..748b5061 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -64,6 +64,7 @@ import { useOverlaySmallLogSettings, useIsEnabledOverlayLargeLog, useOverlayLargeLogSettings, + useOverlayShowOnlyTranslatedMessages, useOscIpAddress, useOscPort, } from "@logics_configs"; @@ -161,6 +162,7 @@ export const useReceiveRoutes = () => { const { updateIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog(); const { updateOverlayLargeLogSettings } = useOverlayLargeLogSettings(); const { updateIsEnabledOverlayLargeLog } = useIsEnabledOverlayLargeLog(); + const { updateOverlayShowOnlyTranslatedMessages } = useOverlayShowOnlyTranslatedMessages(); const { updateOscIpAddress } = useOscIpAddress(); const { updateOscPort } = useOscPort(); @@ -414,6 +416,10 @@ export const useReceiveRoutes = () => { "/get/data/overlay_large_log_settings": updateOverlayLargeLogSettings, "/set/data/overlay_large_log_settings": updateOverlayLargeLogSettings, + "/get/data/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, + "/set/enable/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, + "/set/disable/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, + // Others Tab "/get/data/auto_clear_message_box": updateEnableAutoClearMessageInputBox, "/set/enable/auto_clear_message_box": updateEnableAutoClearMessageInputBox, diff --git a/src-ui/store.js b/src-ui/store.js index bdbd17ec..68f8ee78 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -242,6 +242,7 @@ export const { atomInstance: Atom_OverlayLargeLogSettings, useHook: useStore_Ove tracker: "HMD", }, "OverlayLargeLogSettings"); export const { atomInstance: Atom_IsEnabledOverlayLargeLog, useHook: useStore_IsEnabledOverlayLargeLog } = createAtomWithHook(false, "IsEnabledOverlayLargeLog"); +export const { atomInstance: Atom_OverlayShowOnlyTranslatedMessages, useHook: useStore_OverlayShowOnlyTranslatedMessages } = createAtomWithHook(false, "OverlayShowOnlyTranslatedMessages"); // Others export const { atomInstance: Atom_EnableAutoClearMessageInputBox, useHook: useStore_EnableAutoClearMessageInputBox } = createAtomWithHook(true, "EnableAutoClearMessageInputBox"); From 451391bcdb771e2537f9163a2aee56d23c91b5d2 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:00:34 +0900 Subject: [PATCH 2/5] [Update/Refactor] UI: Slider component. Adjust color and code. --- src-ui/app/_index_css/variables.css | 2 ++ .../setting_box/_components/slider/Slider.jsx | 27 +++++-------------- .../_components/slider/Slider.module.scss | 26 +++--------------- 3 files changed, 13 insertions(+), 42 deletions(-) diff --git a/src-ui/app/_index_css/variables.css b/src-ui/app/_index_css/variables.css index 652f1cd7..f4d235a4 100644 --- a/src-ui/app/_index_css/variables.css +++ b/src-ui/app/_index_css/variables.css @@ -16,6 +16,8 @@ --primary_800_color: #2c6759; --primary_900_color: #214b3f; + --primary_600_color_44: #36877744; + --sent_400_color: #6197b4; --received_300_color: #a861b4; 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 7f96bd86..504aa03e 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 @@ -1,22 +1,9 @@ -import React, { useState, useEffect } from "react"; +import React from "react"; import styles from "./Slider.module.scss"; import MUI_Slider from "@mui/material/Slider"; import { clsx } from "clsx"; export const Slider = (props) => { - const [baseColor, setBaseColor] = useState(""); - const [activeColor, setActiveColor] = useState(""); - const [toolTipColor, setToolTipColor] = useState(""); - - useEffect(() => { - const baseColor = getComputedStyle(document.documentElement).getPropertyValue("--dark_700_color"); - setBaseColor(baseColor.trim()); - const activeColor = getComputedStyle(document.documentElement).getPropertyValue("--primary_600_color"); - setActiveColor(activeColor.trim()); - const toolTipColor = getComputedStyle(document.documentElement).getPropertyValue("--dark_800_color"); - setToolTipColor(toolTipColor.trim()); - }, []); - return (
{ orientation={props.orientation} valueLabelFormat={`${props.valueLabelFormat ? props.valueLabelFormat : props.variable}`} sx={{ - color: baseColor, + color: "var(--dark_700_color)", "& .MuiSlider-thumb": { - backgroundColor: activeColor, + backgroundColor: "var(--primary_600_color)", "&:hover, &.Mui-focusVisible, &.Mui-active": { - boxShadow: `0 0 0 0.8rem ${activeColor}44`, + boxShadow: `0 0 0 0.8rem var(--primary_600_color_44)`, }, "& .MuiSlider-valueLabel": { fontSize: "1.4rem", - backgroundColor: toolTipColor, + backgroundColor: "var(--dark_800_color)", padding: "0.6rem 1rem", lineHeight: "1.15", // top: "-1.4rem", @@ -56,11 +43,11 @@ export const Slider = (props) => { }, "& .MuiSlider-markLabel": { fontSize: "1.4rem", - color: "white", + color: "var(--dark_550_color)", whiteSpace: "nowrap", }, "& .MuiSlider-markLabelActive": { - color: activeColor, + color: "var(--primary_300_color)", }, }} /> diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.module.scss b/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.module.scss index 645a3a24..dd672df8 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/_components/slider/Slider.module.scss @@ -1,30 +1,12 @@ .container { display: flex; flex-direction: column; - align-items: center; // 中央に揃え + align-items: center; justify-content: center; width: 100%; - // padding-left: 4rem; } .range_slider { - // スライダーの幅を調整(必要に応じて調整) - height: 200px; // 縦スライダーの高さ - padding: 10px 0; // スライダーの上下のパディング - - & .MuiSlider-thumb { - // スライダーのつまみのサイズを調整 - height: 24px; - width: 24px; - margin-top: -12px; // つまみが中心に来るように調整 - } - - & .MuiSlider-track { - height: 2px; // トラックの高さを調整 - } - - & .MuiSlider-vertical { - // 縦スライダー用のスタイル - height: 100%; // コンテナの高さにフィット - } -} + height: 200px; + padding: 10px 0; +} \ No newline at end of file From f4aea309cf41d2d8aca1c46c8a59a499445f1f56 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:27:37 +0900 Subject: [PATCH 3/5] [Update] Config Page: Add break point and change the design layout.(UI Scaling will apply) --- .../setting_box/_templates/Templates.jsx | 142 ++++++++---------- .../_templates/Templates.module.scss | 6 + .../setting_box/appearance/Appearance.jsx | 8 + src-ui/logics/common/useWindow.js | 21 ++- src-ui/store.js | 1 + 5 files changed, 95 insertions(+), 83 deletions(-) diff --git a/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.jsx b/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.jsx index bb412153..09b56263 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_templates/Templates.jsx @@ -1,6 +1,7 @@ -import styles from "./Templates.module.scss"; -import { useStore_IsOpenedDropdownMenu } from "@store"; +import clsx from "clsx"; +import styles from "./Templates.module.scss"; +import { useStore_IsOpenedDropdownMenu, useStore_IsBreakPoint } from "@store"; import { LabelComponent, DropdownMenu, @@ -17,6 +18,13 @@ import { DownloadModels, } from "../_components/"; +const LabeledContainer = ({ children, label, desc, custom_class_name }) => ( +
+ + {children} +
+); + export const useOnMouseLeaveDropdownMenu = () => { const { updateIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu(); @@ -29,7 +37,6 @@ export const useOnMouseLeaveDropdownMenu = () => { export const DropdownMenuContainer = (props) => { const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - return (
@@ -38,94 +45,67 @@ export const DropdownMenuContainer = (props) => { ); }; +const CommonContainer = ({ Component, ...props }) => { + const { currentIsBreakPoint } = useStore_IsBreakPoint(); + + const container_class = clsx(styles.container, { + [styles.is_break_point]: props.add_break_point ?? currentIsBreakPoint.data, + }); -export const SliderContainer = (props) => { return ( -
- - -
+ + + ); }; +export const SliderContainer = (props) => ( + +); -export const CheckboxContainer = (props) => { - return ( -
+export const CheckboxContainer = (props) => ( + +); + +export const SwitchBoxContainer = (props) => ( + +); + +export const EntryContainer = (props) => ( + +); + +export const RadioButtonContainer = (props) => ( + +); + +export const DeeplAuthKeyContainer = (props) => ( +
+
- +
- ); -}; + +
+); -export const SwitchBoxContainer = (props) => { - return ( -
- - -
- ); -}; +export const ActionButtonContainer = (props) => ( + +); -export const EntryContainer = (props) => { - return ( -
- - -
- ); -}; - -export const RadioButtonContainer = (props) => { - return ( -
- - -
- ); -}; - -export const DeeplAuthKeyContainer = (props) => { - return ( -
-
+export const WordFilterContainer = (props) => ( +
+
+
-
- +
- ); -}; +
+ +
+
+); -export const ActionButtonContainer = (props) => { - return ( -
- - -
- ); -}; - -export const WordFilterContainer = (props) => { - return ( -
-
-
- -
- -
-
- -
-
- ); -}; - -export const DownloadModelsContainer = (props) => { - return ( -
- - -
- ); -}; \ No newline at end of file +export const DownloadModelsContainer = (props) => ( + +); \ No newline at end of file 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 3f06df1b..3de7a81d 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 @@ -9,6 +9,12 @@ flex-direction: column; } border-bottom: solid 0.1rem var(--dark_800_color); + + &.is_break_point { + flex-direction: column; + gap: 2rem; + align-items: start; + } } .label_only_section { diff --git a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx index 2755cce9..26622941 100644 --- a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx @@ -4,6 +4,11 @@ import { useTranslation } from "react-i18next"; import styles from "./Appearance.module.scss"; import { ui_configs } from "@ui_configs"; import { useStore_SelectableFontFamilyList } from "@store"; + +import { + useWindow, +} from "@logics_common"; + import { useUiLanguage, useUiScaling, @@ -52,6 +57,8 @@ const UiLanguageContainer = () => { const UiScalingContainer = () => { const { t } = useTranslation(); const { currentUiScaling, setUiScaling } = useUiScaling(); + const { asyncUpdateBreakPoint } = useWindow(); + const [ui_ui_scaling, setUiUiScaling] = useState(currentUiScaling.data); const onchangeFunction = (value) => { @@ -62,6 +69,7 @@ const UiScalingContainer = () => { }; useEffect(() => { setUiUiScaling(currentUiScaling.data); + asyncUpdateBreakPoint(); }, [currentUiScaling.data]); const createMarks = (min, max) => { diff --git a/src-ui/logics/common/useWindow.js b/src-ui/logics/common/useWindow.js index 1ca764eb..7d04fd74 100644 --- a/src-ui/logics/common/useWindow.js +++ b/src-ui/logics/common/useWindow.js @@ -1,8 +1,14 @@ -import { useStdoutToPython } from "@logics/useStdoutToPython"; import { useEffect } from "react"; import { appWindow, currentMonitor, availableMonitors, LogicalPosition, LogicalSize } from "@tauri-apps/api/window"; +import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStore_IsBreakPoint } from "@store"; +import { useUiScaling } from "@logics_configs"; + export const useWindow = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { currentUiScaling } = useUiScaling(); + const { updateIsBreakPoint } = useStore_IsBreakPoint(); + const asyncGetWindowGeometry = async () => { try { const position = await appWindow.outerPosition(); @@ -82,13 +88,23 @@ export const useWindow = () => { } }; + const asyncUpdateBreakPoint = async () => { + const size = await appWindow.innerSize(); + const dynamicBreakPoint = 800 * (currentUiScaling.data / 100); + updateIsBreakPoint(size.width <= dynamicBreakPoint); + }; const WindowGeometryController = () => { useEffect(() => { let resizeTimeout; + const asyncFunction = () => { + asyncSaveWindowGeometry(); + asyncUpdateBreakPoint(); + }; + const unlistenResize = appWindow.onResized(() => { clearTimeout(resizeTimeout); - resizeTimeout = setTimeout(asyncSaveWindowGeometry, 200); + resizeTimeout = setTimeout(asyncFunction, 200); }); return () => { @@ -115,5 +131,6 @@ export const useWindow = () => { WindowGeometryController, asyncSaveWindowGeometry, restoreWindowGeometry, + asyncUpdateBreakPoint, }; }; diff --git a/src-ui/store.js b/src-ui/store.js index 68f8ee78..404f6a13 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -113,6 +113,7 @@ export const { atomInstance: Atom_MainFunctionsStateMemory, useHook: useStore_Ma export const { atomInstance: Atom_OpenedQuickSetting, useHook: useStore_OpenedQuickSetting } = createAtomWithHook("", "OpenedQuickSetting"); export const { atomInstance: Atom_IsSoftwareUpdateAvailable, useHook: useStore_IsSoftwareUpdateAvailable } = createAtomWithHook(false, "IsSoftwareUpdateAvailable"); export const { atomInstance: Atom_InitProgress, useHook: useStore_InitProgress } = createAtomWithHook(0, "InitProgress"); +export const { atomInstance: Atom_IsBreakPoint, useHook: useStore_IsBreakPoint } = createAtomWithHook(false, "IsBreakPoint"); // Main Page // Functions From a55e1dd59fb8096aeb65bd3b1b710b4a09bbb05a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:09:09 +0900 Subject: [PATCH 4/5] [Chore] Config Page: Adjust design a bit. --- .../_components/radio_button/RadioButton.module.scss | 1 + .../setting_box/_components/slider/Slider.jsx | 1 - .../setting_box/_components/slider/Slider.module.scss | 5 ----- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/radio_button/RadioButton.module.scss b/src-ui/app/config_page/setting_section/setting_box/_components/radio_button/RadioButton.module.scss index 081e892a..99d2bcc3 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/radio_button/RadioButton.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/_components/radio_button/RadioButton.module.scss @@ -5,6 +5,7 @@ gap: 0.4rem; position: relative; flex-shrink: 0; + flex-wrap: wrap; &.column { flex-direction: column; } 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 504aa03e..4a5e6edf 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 @@ -7,7 +7,6 @@ export const Slider = (props) => { return (
Date: Fri, 6 Dec 2024 13:07:00 +0900 Subject: [PATCH 5/5] [Update] Add updating display. --- src-ui/app/App.jsx | 9 +++- .../update_modal/UpdateModal.jsx | 9 +++- .../updating_component/UpdatingComponent.jsx | 22 ++++++++ .../UpdatingComponent.module.scss | 52 +++++++++++++++++++ src-ui/logics/common/index.js | 1 + src-ui/logics/common/useIsSoftwareUpdating.js | 10 ++++ src-ui/store.js | 1 + 7 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src-ui/app/updating_component/UpdatingComponent.jsx create mode 100644 src-ui/app/updating_component/UpdatingComponent.module.scss create mode 100644 src-ui/logics/common/useIsSoftwareUpdating.js diff --git a/src-ui/app/App.jsx b/src-ui/app/App.jsx index 46edc86a..896cbb34 100644 --- a/src-ui/app/App.jsx +++ b/src-ui/app/App.jsx @@ -6,9 +6,10 @@ import { WindowTitleBar } from "./window_title_bar/WindowTitleBar"; import { MainPage } from "./main_page/MainPage"; import { ConfigPage } from "./config_page/ConfigPage"; import { SplashComponent } from "./splash_component/SplashComponent"; +import { UpdatingComponent } from "./updating_component/UpdatingComponent"; import { ModalController } from "./modal_controller/ModalController"; import styles from "./App.module.scss"; -import { useIsBackendReady } from "@logics_common"; +import { useIsBackendReady, useIsSoftwareUpdating } from "@logics_common"; export const App = () => { const { currentIsBackendReady } = useIsBackendReady(); @@ -34,14 +35,20 @@ export const App = () => { }; const Contents = () => { + const { currentIsSoftwareUpdating } = useIsSoftwareUpdating(); return ( <> + {currentIsSoftwareUpdating.data === false + ?
+ : + + } ); }; diff --git a/src-ui/app/modal_controller/update_modal/UpdateModal.jsx b/src-ui/app/modal_controller/update_modal/UpdateModal.jsx index e158a65f..37f2fe0f 100644 --- a/src-ui/app/modal_controller/update_modal/UpdateModal.jsx +++ b/src-ui/app/modal_controller/update_modal/UpdateModal.jsx @@ -2,18 +2,25 @@ import styles from "./UpdateModal.module.scss"; import { useTranslation } from "react-i18next"; import { useStore_OpenedQuickSetting } from "@store"; import { useUpdateSoftware } from "@logics_common"; +import { useIsSoftwareUpdating } from "@logics_common"; export const UpdateModal = () => { const { t } = useTranslation(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); const { updateSoftware } = useUpdateSoftware(); + const { updateIsSoftwareUpdating } = useIsSoftwareUpdating(); + + const onClickUpdateSoftware = () => { + updateIsSoftwareUpdating(true); + updateSoftware(); + }; return (

{t("main_page.confirmation_message.update_software")}

- +
); diff --git a/src-ui/app/updating_component/UpdatingComponent.jsx b/src-ui/app/updating_component/UpdatingComponent.jsx new file mode 100644 index 00000000..97c774b1 --- /dev/null +++ b/src-ui/app/updating_component/UpdatingComponent.jsx @@ -0,0 +1,22 @@ +import styles from "./UpdatingComponent.module.scss"; +import { useTranslation } from "react-i18next"; +import CircularProgress from "@mui/material/CircularProgress"; +import chat_white_square from "@images/chato_white_square.png"; + +export const UpdatingComponent = () => { + const { t } = useTranslation(); + + return ( +
+
+ +
+
+ +
+

{t("main_page.confirmation_message.updating")}

+
+ ); +}; \ No newline at end of file diff --git a/src-ui/app/updating_component/UpdatingComponent.module.scss b/src-ui/app/updating_component/UpdatingComponent.module.scss new file mode 100644 index 00000000..87d7e39f --- /dev/null +++ b/src-ui/app/updating_component/UpdatingComponent.module.scss @@ -0,0 +1,52 @@ +.container { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + gap: 4rem; + position: relative; +} + +.label { + position: absolute; + top: 60%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 2rem; +} + +.circular_box { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.chato_box { + position: relative; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 100%; + height: 100%; + overflow: hidden; +} + +.chato_img { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 4.8rem; + animation: infinite-rotation 20s linear infinite 0.5s; +} +@keyframes infinite-rotation { + from { + transform: translate(-50%, -50%) rotate(0deg); + } + to { + transform: translate(-50%, -50%) rotate(360deg); + } +} \ No newline at end of file diff --git a/src-ui/logics/common/index.js b/src-ui/logics/common/index.js index 33ef2251..8f1cd737 100644 --- a/src-ui/logics/common/index.js +++ b/src-ui/logics/common/index.js @@ -4,6 +4,7 @@ export { useIsBackendReady } from "./useIsBackendReady"; export { useWindow } from "./useWindow"; export { useIsOpenedConfigPage } from "./useIsOpenedConfigPage"; export { useIsSoftwareUpdateAvailable } from "./useIsSoftwareUpdateAvailable"; +export { useIsSoftwareUpdating } from "./useIsSoftwareUpdating"; export { useOpenFolder } from "./useOpenFolder"; export { useMessage } from "./useMessage"; export { useUpdateSoftware } from "./useUpdateSoftware"; diff --git a/src-ui/logics/common/useIsSoftwareUpdating.js b/src-ui/logics/common/useIsSoftwareUpdating.js new file mode 100644 index 00000000..04507514 --- /dev/null +++ b/src-ui/logics/common/useIsSoftwareUpdating.js @@ -0,0 +1,10 @@ +import { useStore_IsSoftwareUpdating } from "@store"; + +export const useIsSoftwareUpdating = () => { + const { currentIsSoftwareUpdating, updateIsSoftwareUpdating } = useStore_IsSoftwareUpdating(); + + return { + currentIsSoftwareUpdating, + updateIsSoftwareUpdating, + }; +}; \ No newline at end of file diff --git a/src-ui/store.js b/src-ui/store.js index 404f6a13..cf63e236 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -114,6 +114,7 @@ export const { atomInstance: Atom_OpenedQuickSetting, useHook: useStore_OpenedQu export const { atomInstance: Atom_IsSoftwareUpdateAvailable, useHook: useStore_IsSoftwareUpdateAvailable } = createAtomWithHook(false, "IsSoftwareUpdateAvailable"); export const { atomInstance: Atom_InitProgress, useHook: useStore_InitProgress } = createAtomWithHook(0, "InitProgress"); export const { atomInstance: Atom_IsBreakPoint, useHook: useStore_IsBreakPoint } = createAtomWithHook(false, "IsBreakPoint"); +export const { atomInstance: Atom_IsSoftwareUpdating, useHook: useStore_IsSoftwareUpdating } = createAtomWithHook(false, "IsSoftwareUpdating"); // Main Page // Functions