diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_dropdown_menu/_DropdownMenu.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_dropdown_menu/_DropdownMenu.jsx new file mode 100644 index 00000000..6b429209 --- /dev/null +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_dropdown_menu/_DropdownMenu.jsx @@ -0,0 +1,76 @@ +import styles from "./_DropdownMenu.module.scss"; +import clsx from "clsx"; +import ArrowLeftSvg from "@images/arrow_left.svg?react"; +import { useStore_IsOpenedDropdownMenu } from "@store"; + +export const _DropdownMenu = (props) => { + const { updateIsOpenedDropdownMenu, currentIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu(); + + const toggleDropdownMenu = () => { + if (currentIsOpenedDropdownMenu.data === props.dropdown_id) { + updateIsOpenedDropdownMenu(""); + } else { + if (props.openListFunction !== undefined) props.openListFunction(); + updateIsOpenedDropdownMenu(props.dropdown_id); + } + }; + + const selectValue = (key) => { + updateIsOpenedDropdownMenu(""); + props.selectFunction({ + dropdown_id: props.dropdown_id, + selected_id: key, + }); + }; + + const dropdown_content_wrapper_class_name = clsx(styles["dropdown_content_wrapper"], { + [styles.is_opened]: (currentIsOpenedDropdownMenu.data === props.dropdown_id) ? true : false, + [styles.is_disabled]: props.is_disabled, + }); + + const dropdown_toggle_button_class_name = clsx(styles["dropdown_toggle_button"], { + [styles.is_pending]: (props.state === "pending") ? true : false, + [styles.is_disabled]: props.is_disabled, + }); + + const arrow_class_names = clsx(styles["arrow_left_svg"], { + [styles.is_opened]: (currentIsOpenedDropdownMenu.data === props.dropdown_id) ? true : false + }); + + const getSelectedText = () => { + if (props.state !== "ok") return; + if (props.list[props.selected_id] === undefined) return props.selected_id; // [Fix me] + + return props.list[props.selected_id]; + }; + const list = (props.list === undefined) ? {} : props.list; + + return ( +
+
+ {(props.state === "pending") + ?

Loading...

+ :

{getSelectedText()}

+ } + {(props.state === "pending") + ? + : + } +
+
+
+ {(props.state === "ok") + ? Object.entries(list).map(([key, value]) => { + return ( +
selectValue(key)}> +

{value}

+
+ ); + }) + : null + } +
+
+
+ ); +}; \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_dropdown_menu/_DropdownMenu.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_dropdown_menu/_DropdownMenu.module.scss new file mode 100644 index 00000000..386ee592 --- /dev/null +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_dropdown_menu/_DropdownMenu.module.scss @@ -0,0 +1,97 @@ +@import "@scss_mixins"; + +.container { + position: relative; +} + +.dropdown_toggle_button { + position: relative; + background-color: var(--dark_950_color); + min-width: 20rem; + padding: 0.8rem 1.4rem; + cursor: pointer; + border-radius: 0.4rem; + &:hover { + background-color: var(--dark_925_color); + } + &:active { + background-color: var(--dark_975_color); + } + &.is_pending { + pointer-events: none; + } + &.is_disabled { + pointer-events: none; + .dropdown_selected_text, .arrow_left_svg { + color: var(--dark_550_color); + } + } +} + +.dropdown_selected_text { + font-size: 1.4rem; + padding-right: 2.8rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.dropdown_content_wrapper { + display: none; + position: absolute; + top: 100%; // Position it below the toggle button + right: 0; + min-width: 20rem; + z-index: 1; + &.is_opened { + display: block; + } + &.is_disabled { + pointer-events: none; + .value_text { + color: var(--dark_550_color); + } + } +} + +.dropdown_content { + background-color: var(--dark_900_color); + border: 0.1rem solid var(--dark_600_color); + display: flex; + flex-direction: column; + gap: 0.1rem; + white-space: nowrap; + max-height: 20rem; + overflow-y: scroll; +} + +.value_button { + background-color: var(--dark_875_color); + padding: 1.2rem; + cursor: pointer; + &:hover { + background-color: var(--dark_800_color); + } + &:active { + background-color: var(--dark_900_color); + } +} + +.value_text { + font-size: 1.4rem; +} + +.loader { + @include loader(2rem, 0.2rem, right, 0); +} + +.arrow_left_svg { + position: absolute; + top: 50%; + right: 0; + transform: translate(-50%, -50%) rotate(-90deg); + width: 1.4rem; + &.is_opened { + transform: translate(-50%, -50%) rotate(90deg); + } +} \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.jsx new file mode 100644 index 00000000..042864c1 --- /dev/null +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.jsx @@ -0,0 +1,44 @@ +import clsx from "clsx"; +import { useState } from "react"; +import styles from "./_SwitchBox.module.scss"; + +export const _SwitchBox = (props) => { + const [is_hovered, setIsHovered] = useState(false); + const [is_mouse_down, setIsMouseDown] = useState(false); + + const is_pending = (props.variable.state === "pending"); + + const getClassNames = (base_class) => clsx(base_class, { + [styles.is_active]: (props.variable.data === true), + [styles.is_pending]: is_pending, + [styles.is_hovered]: is_hovered, + [styles.is_mouse_down]: is_mouse_down, + }); + + const onMouseEnter = () => setIsHovered(true); + const onMouseLeave = () => setIsHovered(false); + const onMouseDown = () => setIsMouseDown(true); + const onMouseUp = () => setIsMouseDown(false); + + const toggleFunction = () => { + props.toggleFunction(); + }; + + + return ( +
+
+
+ + {is_pending && } +
+
+
+ ); +}; diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.module.scss new file mode 100644 index 00000000..87bf6600 --- /dev/null +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/_atoms/_switch_box/_SwitchBox.module.scss @@ -0,0 +1,33 @@ +@import "@scss_mixins"; + +.switchbox_container { + display: flex; + justify-content: end; + align-items: center; + height: 2rem; +} + +.switchbox_wrapper { + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + padding: 2rem; + height: 100%; + flex-shrink: 0; + &.is_pending { + pointer-events: none; + } +} + +.toggle_control { + position: relative; + @include toggle_control_styles; + display: flex; + justify-content: center; + align-items: center; +} + +.loader { + @include loader(2rem, 0.2rem, right, -4rem); +} \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.jsx index 423de2ef..915502a2 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.jsx @@ -1,76 +1,28 @@ import styles from "./DropdownMenu.module.scss"; -import clsx from "clsx"; -import ArrowLeftSvg from "@images/arrow_left.svg?react"; -import { useStore_IsOpenedDropdownMenu } from "@store"; +import { _DropdownMenu } from "../_atoms/_dropdown_menu/_DropdownMenu"; export const DropdownMenu = (props) => { - const { updateIsOpenedDropdownMenu, currentIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu(); - - const toggleDropdownMenu = () => { - if (currentIsOpenedDropdownMenu.data === props.dropdown_id) { - updateIsOpenedDropdownMenu(""); - } else { - if (props.openListFunction !== undefined) props.openListFunction(); - updateIsOpenedDropdownMenu(props.dropdown_id); - } - }; - - const selectValue = (key) => { - updateIsOpenedDropdownMenu(""); - props.selectFunction({ - dropdown_id: props.dropdown_id, - selected_id: key, - }); - }; - - const dropdown_content_wrapper_class_name = clsx(styles["dropdown_content_wrapper"], { - [styles.is_opened]: (currentIsOpenedDropdownMenu.data === props.dropdown_id) ? true : false, - [styles.is_disabled]: props.is_disabled, - }); - - const dropdown_toggle_button_class_name = clsx(styles["dropdown_toggle_button"], { - [styles.is_pending]: (props.state === "pending") ? true : false, - [styles.is_disabled]: props.is_disabled, - }); - - const arrow_class_names = clsx(styles["arrow_left_svg"], { - [styles.is_opened]: (currentIsOpenedDropdownMenu.data === props.dropdown_id) ? true : false - }); - - const getSelectedText = () => { - if (props.state !== "ok") return; - if (props.list[props.selected_id] === undefined) return props.selected_id; // [Fix me] - - return props.list[props.selected_id]; - }; - const list = (props.list === undefined) ? {} : props.list; + return ( +
+ {props.secondary_label &&

{props.secondary_label}

} + <_DropdownMenu {...props} /> +
+ ); +}; +export const MultiDropdownMenu = (props) => { return (
-
- {(props.state === "pending") - ?

Loading...

- :

{getSelectedText()}

+ {props.dropdown_settings.map((dropdown_props, index) => { + if (dropdown_props.insert_component) { + const InsertComponent = dropdown_props.insert_component; + return ; } - {(props.state === "pending") - ? - : - } -
-
-
- {(props.state === "ok") - ? Object.entries(list).map(([key, value]) => { - return ( -
selectValue(key)}> -

{value}

-
- ); - }) - : null - } -
-
+ return ( + + ); + } + )}
); }; \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.module.scss index 386ee592..cbb1723f 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/dropdown_menu/DropdownMenu.module.scss @@ -1,97 +1,26 @@ @import "@scss_mixins"; .container { - position: relative; + display: flex; + flex-direction: row; + gap: 2.8rem; } -.dropdown_toggle_button { - position: relative; - background-color: var(--dark_950_color); - min-width: 20rem; - padding: 0.8rem 1.4rem; - cursor: pointer; - border-radius: 0.4rem; - &:hover { - background-color: var(--dark_925_color); - } - &:active { - background-color: var(--dark_975_color); - } - &.is_pending { - pointer-events: none; - } - &.is_disabled { - pointer-events: none; - .dropdown_selected_text, .arrow_left_svg { - color: var(--dark_550_color); - } - } -} - -.dropdown_selected_text { - font-size: 1.4rem; - padding-right: 2.8rem; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.dropdown_content_wrapper { - display: none; - position: absolute; - top: 100%; // Position it below the toggle button - right: 0; - min-width: 20rem; - z-index: 1; - &.is_opened { - display: block; - } - &.is_disabled { - pointer-events: none; - .value_text { - color: var(--dark_550_color); - } - } -} - -.dropdown_content { - background-color: var(--dark_900_color); - border: 0.1rem solid var(--dark_600_color); +.each_dropdown_menu_wrapper { display: flex; flex-direction: column; - gap: 0.1rem; + gap: 0.6rem; white-space: nowrap; - max-height: 20rem; - overflow-y: scroll; -} - -.value_button { - background-color: var(--dark_875_color); - padding: 1.2rem; - cursor: pointer; - &:hover { - background-color: var(--dark_800_color); - } - &:active { - background-color: var(--dark_900_color); + max-width: 24rem; + &.is_disabled { + pointer-events: none; } } -.value_text { +.secondary_label { + padding-left: 0.2rem; + padding-right: 0.4rem; font-size: 1.4rem; -} - -.loader { - @include loader(2rem, 0.2rem, right, 0); -} - -.arrow_left_svg { - position: absolute; - top: 50%; - right: 0; - transform: translate(-50%, -50%) rotate(-90deg); - width: 1.4rem; - &.is_opened { - transform: translate(-50%, -50%) rotate(90deg); - } + color: var(--dark_500_color); + white-space: nowrap; } \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/index.js b/src-ui/views/app/config_page/setting_section/setting_box/_components/index.js index e1a7ab32..db5ad1cb 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/index.js +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/index.js @@ -1,7 +1,7 @@ export { ActionButton } from "./action_button/ActionButton"; export { ComputeDevice } from "./compute_device/ComputeDevice"; export { DeeplAuthKey, OpenWebpage_DeeplAuthKey } from "./deepl_auth_key/DeeplAuthKey"; -export { DropdownMenu } from "./dropdown_menu/DropdownMenu"; +export { DropdownMenu, MultiDropdownMenu } from "./dropdown_menu/DropdownMenu"; export { Entry } from "./entry/Entry"; export { EntryWithSaveButton } from "./entry_with_save_button/EntryWithSaveButton"; export { HotkeysEntry } from "./hotkeys_entry/HotkeysEntry"; diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.jsx index 2d77a673..686d3b9b 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.jsx @@ -1,44 +1,13 @@ import clsx from "clsx"; import { useState } from "react"; import styles from "./SwitchBox.module.scss"; +import { _SwitchBox } from "../_atoms/_switch_box/_SwitchBox"; export const SwitchBox = (props) => { - const [is_hovered, setIsHovered] = useState(false); - const [is_mouse_down, setIsMouseDown] = useState(false); - - const is_pending = (props.variable.state === "pending"); - - const getClassNames = (base_class) => clsx(base_class, { - [styles.is_active]: (props.variable.data === true), - [styles.is_pending]: is_pending, - [styles.is_hovered]: is_hovered, - [styles.is_mouse_down]: is_mouse_down, - }); - - const onMouseEnter = () => setIsHovered(true); - const onMouseLeave = () => setIsHovered(false); - const onMouseDown = () => setIsMouseDown(true); - const onMouseUp = () => setIsMouseDown(false); - - const toggleFunction = () => { - props.toggleFunction(); - }; - - return ( -
-
-
- - {is_pending && } -
-
+
+ {props.secondary_label &&

{props.secondary_label}

} + <_SwitchBox {...props} />
); -}; +}; \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.module.scss index 87bf6600..c07a373f 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/switch_box/SwitchBox.module.scss @@ -1,33 +1,17 @@ @import "@scss_mixins"; -.switchbox_container { - display: flex; - justify-content: end; - align-items: center; - height: 2rem; -} - -.switchbox_wrapper { +.container { display: flex; + flex-direction: column; justify-content: center; align-items: center; - cursor: pointer; - padding: 2rem; - height: 100%; - flex-shrink: 0; - &.is_pending { - pointer-events: none; - } + gap: 1rem; } -.toggle_control { - position: relative; - @include toggle_control_styles; - display: flex; - justify-content: center; - align-items: center; -} - -.loader { - @include loader(2rem, 0.2rem, right, -4rem); +.secondary_label { + padding-left: 0.2rem; + padding-right: 0.4rem; + font-size: 1.4rem; + color: var(--dark_500_color); + white-space: nowrap; } \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx index 9369488b..17e08a53 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx @@ -50,14 +50,14 @@ export const WordFilter = () => { return (
- { currentIsOpenedMicWordFilterList.data && -
- { - currentMicWordFilterList.data.map((item, index) => { - return ; - }) - } -
+ { currentIsOpenedMicWordFilterList.data && currentMicWordFilterList.data.length > 0 && +
+ { + currentMicWordFilterList.data.map((item, index) => { + return ; + }) + } +
}
<_Entry width="30rem" onChange={onChangeEntry} ui_variable={input_value}/> diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.module.scss index 2fe9600d..842fee46 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.module.scss @@ -4,11 +4,13 @@ align-items: center; flex-direction: column; gap: 2rem; + width: 100%; } .list_section_wrapper { display: flex; + justify-content: center; flex-wrap: wrap; width: 100%; gap: 0.6rem; diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx b/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx index 6faf882c..96378587 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.jsx @@ -5,6 +5,7 @@ import { useStore_IsOpenedDropdownMenu, useStore_IsBreakPoint } from "@store"; import { LabelComponent, DropdownMenu, + MultiDropdownMenu, Slider, SwitchBox, Entry, @@ -22,13 +23,6 @@ import { } from "../_components"; import { Checkbox } from "@common_components"; -const LabeledContainer = ({ children, label, desc, custom_class_name }) => ( -
- - {children} -
-); - export const useOnMouseLeaveDropdownMenu = () => { const { updateIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu(); @@ -41,27 +35,87 @@ export const useOnMouseLeaveDropdownMenu = () => { export const DropdownMenuContainer = (props) => { const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); + return ( -
+ + + ); +}; + +export const MultiDropdownMenuContainer = (props) => { + const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); + + return ( + + + + + ); +}; + +const TemplatesContainerWrapper = ({ + children, + add_break_point = true, + flex_column = false, + remove_border_bottom = false, + onMouseLeaveFunction = null, +}) => { + const { currentIsBreakPoint } = useStore_IsBreakPoint(); + + const container_class = clsx(styles.container, { + [styles.is_break_point]: add_break_point && currentIsBreakPoint.data, + [styles.flex_column]: flex_column, + [styles.remove_border_bottom]: remove_border_bottom, + }); + + return ( +
+ {children}
); }; -const CommonContainer = ({ Component, ...props }) => { +const CommonContainer = ({ + label_type = "label_component", + add_break_point = true, + flex_column = false, + remove_border_bottom = false, + Component, + ...props +}) => { const { currentIsBreakPoint } = useStore_IsBreakPoint(); - const container_class = clsx(styles.container, { - [styles.is_break_point]: props.add_break_point ?? currentIsBreakPoint.data, - }); + const container_wrapper_props = { + add_break_point: add_break_point, + flex_column: flex_column, + remove_border_bottom: remove_border_bottom, + }; - return ( - - - - ); + if (label_type === "label_component") { + return ( + + + + + ); + } else if (label_type === "no_label") { + return ( + + + + ); + } else if (label_type === "label_only") { + return ( + + + + ); + } }; + + export const SliderContainer = (props) => ( ); @@ -90,19 +144,14 @@ export const RadioButtonContainer = (props) => ( ); export const DeeplAuthKeyContainer = (props) => { - const { currentIsBreakPoint } = useStore_IsBreakPoint(); - const container_class = clsx(styles.container, { - [styles.is_break_point]: currentIsBreakPoint.data, - }); - return ( -
+
-
+ ); }; @@ -114,19 +163,22 @@ export const ComputeDeviceContainer = (props) => ( ); -export const WordFilterContainer = (props) => ( -
-
-
- -
- -
-
- -
-
-); +export const WordFilterContainer = (props) => { + return ( + <> + + + + ); +}; export const DownloadModelsContainer = (props) => ( @@ -134,13 +186,17 @@ export const DownloadModelsContainer = (props) => ( export const MessageFormatContainer = (props) => { return ( -
-
- -
-
- -
-
+ <> + + + ); }; \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.module.scss index cab3118a..6767471d 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/_templates/Templates.module.scss @@ -8,7 +8,9 @@ &.flex_column { flex-direction: column; } - border-bottom: solid 0.1rem var(--dark_800_color); + &:not(.remove_border_bottom) { + border-bottom: solid 0.1rem var(--dark_800_color); + } &.is_break_point { flex-direction: column; @@ -17,10 +19,6 @@ } } -.label_only_section { - width: 100%; -} - .deepl_auth_key_label_section { max-width: 34rem; display: flex; @@ -28,30 +26,4 @@ justify-content: space-between; align-items: center; gap: 1.4rem; -} - -.message_format_section { - width: 100%; -} - - -.word_filter_container { - display: flex; - width: 100%; - flex-direction: column; - justify-content: space-between; - align-items: center; - gap: 2rem; - padding: 2rem; -} - -.word_filter_switch_section { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; -} - -.word_filter_label_wrapper { - max-width: 34rem; } \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/device/Device.jsx b/src-ui/views/app/config_page/setting_section/setting_box/device/Device.jsx index 9211bf37..fe468d57 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/device/Device.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/device/Device.jsx @@ -9,11 +9,13 @@ import { import { useOnMouseLeaveDropdownMenu, + MultiDropdownMenuContainer, } from "../_templates/Templates"; import { LabelComponent, DropdownMenu, + MultiDropdownMenu, ThresholdComponent, SwitchBox, } from "../_components"; @@ -70,53 +72,41 @@ const Mic_Container = () => { } }; - const { currentIsBreakPoint } = useStore_IsBreakPoint(); - const device_container_class = clsx(styles.device_container, { - [styles.is_break_point]: currentIsBreakPoint.data, - }); - return (
-
- -
- -
-

{t("config_page.device.label_auto_select")}

- -
- -
-
-

{t("config_page.device.label_host")}

- -
- -
-

{t("config_page.device.label_device")}

- -
-
-
-
+
@@ -181,27 +171,21 @@ const Speaker_Container = () => {
- -
-

{t("config_page.device.label_auto_select")}

- -
- -
-

{t("config_page.device.label_device")}

- -
+ +
diff --git a/src-ui/views/app/config_page/setting_section/setting_box/device/Device.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/device/Device.module.scss index 5497b661..e88ae147 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/device/Device.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/device/Device.module.scss @@ -77,29 +77,4 @@ gap: 1.2rem; justify-content: center; align-items: center; -} - -.device_dropdown_wrapper { - display: flex; - flex-direction: row; - gap: 2.8rem; -} - -.device_dropdown { - display: flex; - flex-direction: column; - gap: 0.6rem; - white-space: nowrap; - max-width: 24rem; - &.is_disabled { - pointer-events: none; - } -} - -.device_secondary_label { - padding-left: 0.2rem; - padding-right: 0.4rem; - font-size: 1.4rem; - color: var(--dark_500_color); - white-space: nowrap; } \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx b/src-ui/views/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx index addd08c1..bf27774e 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx @@ -1,5 +1,5 @@ -import { SwitchBox } from "../../_components"; import { _DownloadButton } from "../../_components/_atoms/_download_button/_DownloadButton"; +import { _SwitchBox } from "../../_components/_atoms/_switch_box/_SwitchBox"; import styles from "./PluginsControlComponent.module.scss"; import { useI18n } from "@useI18n"; @@ -90,7 +90,7 @@ const DownloadedPluginControl = ({ return (

{t("config_page.plugins.no_latest_info")}

- + <_SwitchBox variable={option} toggleFunction={togglePlugin} />
); } else if (plugin_status.is_latest_version_already) { @@ -98,7 +98,7 @@ const DownloadedPluginControl = ({

{latest_version_label}

{t("config_page.plugins.using_latest_version")}

- + <_SwitchBox variable={option} toggleFunction={togglePlugin} />
); } else if (plugin_status.is_latest_version_available) { @@ -107,14 +107,14 @@ const DownloadedPluginControl = ({

{latest_version_label}

{t("config_page.plugins.available_latest_version")}

<_DownloadButton option={option} downloadStartFunction={downloadStartFunction} /> - + <_SwitchBox variable={option} toggleFunction={togglePlugin} />
); } else { return (

{t("config_page.plugins.available_latest_version")}

- + <_SwitchBox variable={option} toggleFunction={togglePlugin} />
); } diff --git a/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.jsx b/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.jsx index 255183a8..3731dbad 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.jsx @@ -11,6 +11,7 @@ import { import { WordFilterContainer, DownloadModelsContainer, + MultiDropdownMenuContainer, RadioButtonContainer, DropdownMenuContainer, SliderContainer, @@ -20,6 +21,7 @@ import { import { DropdownMenu, + MultiDropdownMenu, LabelComponent, SectionLabelComponent, } from "../_components"; @@ -281,8 +283,6 @@ const TranscriptionComputeDevice_Box = () => { currentSelectedTranscriptionComputeType, setSelectedTranscriptionComputeType, } = useTranscription(); - const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - const { currentIsBreakPoint } = useStore_IsBreakPoint(); const list_for_ui = transformDeviceArray(currentSelectableTranscriptionComputeDeviceList.data); @@ -364,50 +364,34 @@ const TranscriptionComputeDevice_Box = () => { setSelectedTranscriptionComputeType(selected_data.selected_id); }; - const device_container_class = clsx(styles.device_container, { - [styles.is_break_point]: currentIsBreakPoint.data, - }); - const is_disabled_selector = currentSelectedTranscriptionComputeDevice.state === "pending" || currentSelectedTranscriptionComputeType.state === "pending"; return ( -
-
- -
- -
-
-

{t("config_page.common.compute_device.label_device")}

- -
- -
-

{t("config_page.common.compute_device.label_type")}

- -
-
-
-
-
+ ); }; diff --git a/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.module.scss index 8eed1df9..1170a41c 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/transcription/Transcription.module.scss @@ -2,120 +2,4 @@ display: flex; flex-direction: column; gap: 6.4rem; -} - - - - - - - - - - -// [Fix me] Need refactor. -.mic_container { - display: flex; - flex-direction: column; - border-bottom: solid 0.1rem var(--dark_800_color); - padding-bottom: 1rem; -} - -.speaker_container { - padding-top: 0rem; -} - -.device_container { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; - padding: 2rem; - margin-bottom: 0rem; - &.is_break_point { - flex-direction: column; - gap: 2rem; - align-items: start; - & .device_contents { - display: flex; - width: 100%; - justify-content: space-between; - padding-left: 0rem; - } - } -} - -.threshold_container { - padding: 2rem; -} - - - -.threshold_container { - display: flex; - width: 100%; - flex-direction: column; - justify-content: space-between; - align-items: center; - gap: 2rem; -} - -.threshold_switch_section { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; - flex-shrink: 0; -} - -.threshold_section { - width: 100%; -} - - - - -.device_label { - font-size: 1.8rem; -} - -.device_contents { - display: flex; - width: 100%; - justify-content: end; - padding-left: 2rem; - gap: 2rem; -} - -.device_auto_select_wrapper { - display: flex; - flex-direction: column; - gap: 1.2rem; - justify-content: center; - align-items: center; -} - -.device_dropdown_wrapper { - display: flex; - flex-direction: row; - gap: 2.8rem; -} - -.device_dropdown { - display: flex; - flex-direction: column; - gap: 0.6rem; - white-space: nowrap; - max-width: 24rem; - &.is_disabled { - pointer-events: none; - } -} - -.device_secondary_label { - padding-left: 0.2rem; - padding-right: 0.4rem; - font-size: 1.4rem; - color: var(--dark_500_color); - white-space: nowrap; } \ No newline at end of file diff --git a/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx b/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx index 459b4e10..cb5ad232 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx @@ -11,12 +11,14 @@ import { import { DownloadModelsContainer, DeeplAuthKeyContainer, + MultiDropdownMenuContainer, useOnMouseLeaveDropdownMenu, } from "../_templates/Templates"; import { DropdownMenu, + MultiDropdownMenu, LabelComponent, } from "../_components"; @@ -89,8 +91,6 @@ const TranslationComputeDevice_Box = () => { currentSelectedTranslationComputeType, setSelectedTranslationComputeType, } = useTranslation(); - const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - const { currentIsBreakPoint } = useStore_IsBreakPoint(); const list_for_ui = transformDeviceArray(currentSelectableTranslationComputeDeviceList.data); @@ -172,50 +172,34 @@ const TranslationComputeDevice_Box = () => { setSelectedTranslationComputeType(selected_data.selected_id); }; - const device_container_class = clsx(styles.device_container, { - [styles.is_break_point]: currentIsBreakPoint.data, - }); - const is_disabled_selector = currentSelectedTranslationComputeDevice.state === "pending" || currentSelectedTranslationComputeType.state === "pending"; return ( -
-
- -
- -
-
-

{t("config_page.common.compute_device.label_device")}

- -
- -
-

{t("config_page.common.compute_device.label_type")}

- -
-
-
-
-
+ ); }; diff --git a/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.module.scss b/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.module.scss index 7486c466..e69de29b 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.module.scss +++ b/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.module.scss @@ -1,106 +0,0 @@ -// [Fix me] Need refactor. -.mic_container { - display: flex; - flex-direction: column; - border-bottom: solid 0.1rem var(--dark_800_color); - padding-bottom: 1rem; -} - -.speaker_container { - padding-top: 0rem; -} - -.device_container { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; - padding: 2rem; - margin-bottom: 0rem; - &.is_break_point { - flex-direction: column; - gap: 2rem; - align-items: start; - & .device_contents { - display: flex; - width: 100%; - justify-content: space-between; - padding-left: 0rem; - } - } -} - -.threshold_container { - padding: 2rem; -} - - - -.threshold_container { - display: flex; - width: 100%; - flex-direction: column; - justify-content: space-between; - align-items: center; - gap: 2rem; -} - -.threshold_switch_section { - display: flex; - width: 100%; - justify-content: space-between; - align-items: center; - flex-shrink: 0; -} - -.threshold_section { - width: 100%; -} - - - - -.device_label { - font-size: 1.8rem; -} - -.device_contents { - display: flex; - width: 100%; - justify-content: end; - padding-left: 2rem; - gap: 2rem; -} - -.device_auto_select_wrapper { - display: flex; - flex-direction: column; - gap: 1.2rem; - justify-content: center; - align-items: center; -} - -.device_dropdown_wrapper { - display: flex; - flex-direction: row; - gap: 2.8rem; -} - -.device_dropdown { - display: flex; - flex-direction: column; - gap: 0.6rem; - white-space: nowrap; - max-width: 24rem; - &.is_disabled { - pointer-events: none; - } -} - -.device_secondary_label { - padding-left: 0.2rem; - padding-right: 0.4rem; - font-size: 1.4rem; - color: var(--dark_500_color); - white-space: nowrap; -} \ No newline at end of file