[Update] Config Window: Add MessageFormat component.
This commit is contained in:
BIN
src-ui/assets/swap_icon.png
Normal file
BIN
src-ui/assets/swap_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -15,6 +15,7 @@ export const Appearance = () => {
|
|||||||
ThresholdContainer,
|
ThresholdContainer,
|
||||||
RadioButtonContainer,
|
RadioButtonContainer,
|
||||||
DeeplAuthKeyContainer,
|
DeeplAuthKeyContainer,
|
||||||
|
MessageFormatContainer,
|
||||||
} = useSettingBox();
|
} = useSettingBox();
|
||||||
|
|
||||||
const selectFunction = (selected_data) => {
|
const selectFunction = (selected_data) => {
|
||||||
@@ -44,6 +45,10 @@ export const Appearance = () => {
|
|||||||
<ThresholdContainer label="Transparent" desc="description" id="mic_threshold" min="0" max="3000"/>
|
<ThresholdContainer label="Transparent" desc="description" id="mic_threshold" min="0" max="3000"/>
|
||||||
|
|
||||||
<DeeplAuthKeyContainer label={t(`config_window.deepl_auth_key.label`)} desc={t(`config_window.deepl_auth_key.desc`)}/>
|
<DeeplAuthKeyContainer label={t(`config_window.deepl_auth_key.label`)} desc={t(`config_window.deepl_auth_key.desc`)}/>
|
||||||
|
|
||||||
|
<MessageFormatContainer label={t(`config_window.send_message_format.label`)} desc={t(`config_window.send_message_format.desc`)}/>
|
||||||
|
|
||||||
|
<MessageFormatContainer label={t(`config_window.send_message_format_with_t.label`)} desc={t(`config_window.send_message_format_with_t.desc`)} with_t={true}/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
.entry_container {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.entry_wrapper {
|
.entry_wrapper {
|
||||||
width: 10rem;
|
width: 10rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import styles from "./MessageFormat.module.scss";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
export const MessageFormat = (props) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.container}>
|
||||||
|
<ExampleComponent {...props}/>
|
||||||
|
<InputComponent {...props}/>
|
||||||
|
{
|
||||||
|
props.with_t
|
||||||
|
? <SwapButton/>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ExampleComponent = (props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const createExampleMessage = () => {
|
||||||
|
return t("config_window.send_message_format.example_text");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.example_container}>
|
||||||
|
<p className={styles.example_text}>{createExampleMessage()}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
import { _Entry } from "../_atoms/_Entry";
|
||||||
|
const InputComponent = (props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const onChangeInput = (e) => {
|
||||||
|
console.log(e.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.input_wrapper}>
|
||||||
|
<_Entry width="100%" onChange={onChangeInput} />
|
||||||
|
<p className={styles.preset_text}>[message]</p>
|
||||||
|
<_Entry width="100%" onChange={onChangeInput} />
|
||||||
|
{
|
||||||
|
props.with_t
|
||||||
|
? (<>
|
||||||
|
<p className={styles.preset_text}>[translation]</p>
|
||||||
|
<_Entry width="100%" onChange={onChangeInput} />
|
||||||
|
</>)
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
import SwapImg from "@images/swap_icon.png";
|
||||||
|
const SwapButton = () => {
|
||||||
|
const swapMessageAndTranslate = () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.swap_button_container}>
|
||||||
|
<div className={styles.swap_button_wrapper} onClick={swapMessageAndTranslate}>
|
||||||
|
<p className={styles.swap_text}>[message]</p>
|
||||||
|
<img className={styles.swap_img} src={SwapImg} />
|
||||||
|
<p className={styles.swap_text}>[translate]</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
gap: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example_container {
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: #3A4554;
|
||||||
|
border-radius: 1.4rem;
|
||||||
|
max-width: 30rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example_text {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input_wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset_text {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.swap_button_container {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swap_button_wrapper {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.8rem;
|
||||||
|
padding: 0.6rem 1.2rem;
|
||||||
|
border-radius: 0.4rem;
|
||||||
|
background-color: var(--dark_850_color);
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--dark_800_color);
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
background-color: var(--dark_900_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.swap_text {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swap_img {
|
||||||
|
width: 2rem;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import styles from "./useSettingBox.module.scss";
|
import styles from "./useSettingBox.module.scss";
|
||||||
import { useIsOpenedDropdownMenu } from "@store";
|
import { useIsOpenedDropdownMenu } from "@store";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
import { LabelComponent } from "./label_component/LabelComponent";
|
import { LabelComponent } from "./label_component/LabelComponent";
|
||||||
import { DropdownMenu } from "./dropdown_menu/DropdownMenu";
|
import { DropdownMenu } from "./dropdown_menu/DropdownMenu";
|
||||||
@@ -10,6 +11,7 @@ import { Entry } from "./entry/Entry";
|
|||||||
import { ThresholdComponent } from "./threshold_component/ThresholdComponent";
|
import { ThresholdComponent } from "./threshold_component/ThresholdComponent";
|
||||||
import { RadioButton } from "./radio_button/RadioButton";
|
import { RadioButton } from "./radio_button/RadioButton";
|
||||||
import { OpenWebpage_DeeplAuthKey, DeeplAuthKey } from "./deepl_auth_key/DeeplAuthKey";
|
import { OpenWebpage_DeeplAuthKey, DeeplAuthKey } from "./deepl_auth_key/DeeplAuthKey";
|
||||||
|
import { MessageFormat } from "./message_format/MessageFormat";
|
||||||
|
|
||||||
export const useSettingBox = () => {
|
export const useSettingBox = () => {
|
||||||
const { updateIsOpenedDropdownMenu } = useIsOpenedDropdownMenu();
|
const { updateIsOpenedDropdownMenu } = useIsOpenedDropdownMenu();
|
||||||
@@ -98,6 +100,20 @@ export const useSettingBox = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const MessageFormatContainer = (props) => {
|
||||||
|
return (
|
||||||
|
<div className={clsx(styles.container, styles.flex_column)}>
|
||||||
|
<div className={styles.label_only_section}>
|
||||||
|
<LabelComponent label={props.label} desc={props.desc} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.message_format_section}>
|
||||||
|
<MessageFormat {...props}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
DropdownMenuContainer,
|
DropdownMenuContainer,
|
||||||
SliderContainer,
|
SliderContainer,
|
||||||
@@ -107,5 +123,6 @@ export const useSettingBox = () => {
|
|||||||
ThresholdContainer,
|
ThresholdContainer,
|
||||||
RadioButtonContainer,
|
RadioButtonContainer,
|
||||||
DeeplAuthKeyContainer,
|
DeeplAuthKeyContainer,
|
||||||
|
MessageFormatContainer,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -8,6 +8,14 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 2rem;
|
||||||
|
&.flex_column {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.label_only_section {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.threshold_container {
|
.threshold_container {
|
||||||
@@ -40,3 +48,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1.4rem;
|
gap: 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message_format_section {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user