[Update] Config Page: Translation Tab: DeeplAuthKey. to be editable when input box is empty.

This commit is contained in:
Sakamoto Shiina
2024-12-06 13:59:06 +09:00
parent 2a9a905794
commit 9c5625ac85
2 changed files with 8 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import clsx from "clsx";
import ExternalLink from "@images/external_link.svg?react";
import { _Entry } from "../_atoms/_entry/_Entry";
import { useState, useRef } from "react";
import { useEffect } from "react";
export const DeeplAuthKey = (props) => {
const { t } = useTranslation();
@@ -22,6 +23,12 @@ export const DeeplAuthKey = (props) => {
props.saveFunction();
};
useEffect(() => {
if (props.variable === "" || props.variable === null) {
seIsEditable(true);
}
}, [props.variable]);
return (
<div className={styles.container}>
<div className={styles.entry_section_wrapper}>

View File

@@ -98,9 +98,9 @@ const CTranslation2ComputeDevice_Box = () => {
};
const DeeplAuthKey_Box = () => {
const [input_value, seInputValue] = useState("");
const { t } = useTranslation();
const { currentDeepLAuthKey, setDeepLAuthKey, deleteDeepLAuthKey } = useDeepLAuthKey();
const [input_value, seInputValue] = useState(currentDeepLAuthKey.data);
const onChangeFunction = (value) => {
seInputValue(value);