[Refactor] Introduce AuthKey component and update related containers and styles.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import styles from "./DeeplAuthKey.module.scss";
|
import styles from "./AuthKey.module.scss";
|
||||||
import { useI18n } from "@useI18n";
|
import { useI18n } from "@useI18n";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
@@ -6,7 +6,7 @@ import { _Entry } from "../_atoms/_entry/_Entry";
|
|||||||
import { useState, useRef } from "react";
|
import { useState, useRef } from "react";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
export const DeeplAuthKey = (props) => {
|
export const AuthKey = (props) => {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const [is_editable, seIsEditable] = useState(false);
|
const [is_editable, seIsEditable] = useState(false);
|
||||||
const entryRef = useRef(null);
|
const entryRef = useRef(null);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
export { ActionButton } from "./action_button/ActionButton";
|
export { ActionButton } from "./action_button/ActionButton";
|
||||||
export { ComputeDevice } from "./compute_device/ComputeDevice";
|
export { ComputeDevice } from "./compute_device/ComputeDevice";
|
||||||
export { DeeplAuthKey } from "./deepl_auth_key/DeeplAuthKey";
|
export { AuthKey } from "./auth_key/AuthKey";
|
||||||
export { DropdownMenu, MultiDropdownMenu } from "./dropdown_menu/DropdownMenu";
|
export { DropdownMenu, MultiDropdownMenu } from "./dropdown_menu/DropdownMenu";
|
||||||
export { Entry } from "./entry/Entry";
|
export { Entry } from "./entry/Entry";
|
||||||
export { EntryWithSaveButton } from "./entry_with_save_button/EntryWithSaveButton";
|
export { EntryWithSaveButton } from "./entry_with_save_button/EntryWithSaveButton";
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import styles from "./LabelComponent.module.scss";
|
import styles from "./LabelComponent.module.scss";
|
||||||
|
import { _OpenWebpageButton } from "../_atoms/_open_webpage_button/_OpenWebpageButton";
|
||||||
|
|
||||||
export const LabelComponent = (props) => {
|
export const LabelComponent = (props) => {
|
||||||
return (
|
return (
|
||||||
@@ -8,6 +9,7 @@ export const LabelComponent = (props) => {
|
|||||||
? <p className={styles.desc}>{props.desc}</p>
|
? <p className={styles.desc}>{props.desc}</p>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
{props.webpage_url && <_OpenWebpageButton webpage_url={props.webpage_url} open_webpage_label={props.open_webpage_label} /> }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
EntryWithSaveButton,
|
EntryWithSaveButton,
|
||||||
HotkeysEntry,
|
HotkeysEntry,
|
||||||
RadioButton,
|
RadioButton,
|
||||||
DeeplAuthKey,
|
AuthKey,
|
||||||
ActionButton,
|
ActionButton,
|
||||||
ComputeDevice,
|
ComputeDevice,
|
||||||
WordFilter,
|
WordFilter,
|
||||||
@@ -22,8 +22,6 @@ import {
|
|||||||
} from "../_components";
|
} from "../_components";
|
||||||
import { Checkbox } from "@common_components";
|
import { Checkbox } from "@common_components";
|
||||||
|
|
||||||
import { _OpenWebpageButton } from "../_components/_atoms/_open_webpage_button/_OpenWebpageButton";
|
|
||||||
|
|
||||||
export const useOnMouseLeaveDropdownMenu = () => {
|
export const useOnMouseLeaveDropdownMenu = () => {
|
||||||
const { updateIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu();
|
const { updateIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu();
|
||||||
|
|
||||||
@@ -97,7 +95,7 @@ const CommonContainer = ({
|
|||||||
if (label_type === "label_component") {
|
if (label_type === "label_component") {
|
||||||
return (
|
return (
|
||||||
<TemplatesContainerWrapper {...container_wrapper_props}>
|
<TemplatesContainerWrapper {...container_wrapper_props}>
|
||||||
<LabelComponent label={props.label} desc={props.desc} />
|
<LabelComponent {...props} />
|
||||||
<Component {...props} is_break_point={currentIsBreakPoint.data} />
|
<Component {...props} is_break_point={currentIsBreakPoint.data} />
|
||||||
</TemplatesContainerWrapper>
|
</TemplatesContainerWrapper>
|
||||||
);
|
);
|
||||||
@@ -110,7 +108,7 @@ const CommonContainer = ({
|
|||||||
} else if (label_type === "label_only") {
|
} else if (label_type === "label_only") {
|
||||||
return (
|
return (
|
||||||
<TemplatesContainerWrapper {...container_wrapper_props}>
|
<TemplatesContainerWrapper {...container_wrapper_props}>
|
||||||
<LabelComponent label={props.label} desc={props.desc} />
|
<LabelComponent {...props} />
|
||||||
</TemplatesContainerWrapper>
|
</TemplatesContainerWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -144,15 +142,13 @@ export const RadioButtonContainer = (props) => (
|
|||||||
<CommonContainer Component={RadioButton} {...props} />
|
<CommonContainer Component={RadioButton} {...props} />
|
||||||
);
|
);
|
||||||
|
|
||||||
export const DeeplAuthKeyContainer = (props) => {
|
export const AuthKeyContainer = (props) => {
|
||||||
|
const webpage_settings = {
|
||||||
|
webpage_url: props.webpage_url,
|
||||||
|
open_webpage_label: props.open_webpage_label,
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<TemplatesContainerWrapper>
|
<CommonContainer Component={AuthKey} {...props} {...webpage_settings} />
|
||||||
<div className={styles.deepl_auth_key_label_section}>
|
|
||||||
<LabelComponent label={props.label} desc={props.desc} />
|
|
||||||
<_OpenWebpageButton {...props} />
|
|
||||||
</div>
|
|
||||||
<DeeplAuthKey {...props} />
|
|
||||||
</TemplatesContainerWrapper>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
DownloadModelsContainer,
|
DownloadModelsContainer,
|
||||||
DeeplAuthKeyContainer,
|
AuthKeyContainer,
|
||||||
MultiDropdownMenuContainer,
|
MultiDropdownMenuContainer,
|
||||||
|
|
||||||
useOnMouseLeaveDropdownMenu,
|
useOnMouseLeaveDropdownMenu,
|
||||||
@@ -226,7 +226,7 @@ const DeeplAuthKey_Box = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DeeplAuthKeyContainer
|
<AuthKeyContainer
|
||||||
label={t("config_page.translation.deepl_auth_key.label")}
|
label={t("config_page.translation.deepl_auth_key.label")}
|
||||||
desc={t(
|
desc={t(
|
||||||
"config_page.translation.deepl_auth_key.desc",
|
"config_page.translation.deepl_auth_key.desc",
|
||||||
|
|||||||
Reference in New Issue
Block a user