[Refactor] Tidy up utils' files and functions.
This commit is contained in:
@@ -66,7 +66,7 @@ const PresetContainer = () => {
|
||||
title: t("main_page.your_language"),
|
||||
is_opened: currentIsOpenedLanguageSelector.data.your_language,
|
||||
onClickFunction: () => toggleSelector("your_language", currentIsOpenedLanguageSelector.data.your_language, updateIsOpenedLanguageSelector),
|
||||
TurnedOnSvgComponent: <MicSvg />,
|
||||
TurnedOnSvgComponent: MicSvg,
|
||||
is_turned_on: currentTranscriptionSendStatus.data,
|
||||
variable: your_language_data?.primary,
|
||||
};
|
||||
@@ -75,7 +75,7 @@ const PresetContainer = () => {
|
||||
title: t("main_page.target_language"),
|
||||
is_opened: currentIsOpenedLanguageSelector.data.target_language,
|
||||
onClickFunction: () => toggleSelector("target_language", currentIsOpenedLanguageSelector.data.target_language, updateIsOpenedLanguageSelector),
|
||||
TurnedOnSvgComponent: <HeadphonesSvg />,
|
||||
TurnedOnSvgComponent: HeadphonesSvg,
|
||||
is_turned_on: currentTranscriptionReceiveStatus.data,
|
||||
variable: target_language_data?.primary,
|
||||
};
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import clsx from "clsx";
|
||||
import styles from "./LanguageSelectorOpenButton.module.scss";
|
||||
import ArrowLeftSvg from "@images/arrow_left.svg?react";
|
||||
import { useSvg } from "@utils/useSvg";
|
||||
|
||||
export const LanguageSelectorOpenButton = ({ title, onClickFunction, is_opened, TurnedOnSvgComponent, is_turned_on, variable }) => {
|
||||
const classNames = clsx(styles.arrow_left_svg, {
|
||||
const arrow_class_names = clsx(styles.arrow_left_svg, {
|
||||
[styles.reverse]: is_opened,
|
||||
});
|
||||
|
||||
const SvgComponent = useSvg(TurnedOnSvgComponent, {
|
||||
className: clsx(styles.category_svg, {
|
||||
[styles.is_turned_on]: is_turned_on,
|
||||
}),
|
||||
const category_class_names = clsx(styles.category_svg, {
|
||||
[styles.is_turned_on]: is_turned_on,
|
||||
});
|
||||
|
||||
const languageText = variable?.language ?? "Loading...";
|
||||
@@ -20,13 +17,13 @@ export const LanguageSelectorOpenButton = ({ title, onClickFunction, is_opened,
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={styles.title_container}>
|
||||
{SvgComponent}
|
||||
<TurnedOnSvgComponent className={category_class_names} />
|
||||
<p className={styles.title}>{title}</p>
|
||||
</div>
|
||||
<div className={styles.dropdown_menu_container} onClick={onClickFunction}>
|
||||
<p className={styles.selected_language}>{languageText}</p>
|
||||
<p className={styles.selected_language}>({countryText})</p>
|
||||
<ArrowLeftSvg className={classNames} />
|
||||
<ArrowLeftSvg className={arrow_class_names} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { updateLabelsById } from "@utils/updateLabelsById";
|
||||
import { updateLabelsById } from "@utils";
|
||||
import styles from "./TranslatorSelectorOpenButton.module.scss";
|
||||
import { TranslatorSelector } from "./translator_selector/TranslatorSelector";
|
||||
import { useStore_IsOpenedTranslatorSelector } from "@store";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import clsx from "clsx";
|
||||
import styles from "./TranslatorSelector.module.scss";
|
||||
import { chunkArray } from "@utils/chunkArray";
|
||||
import { chunkArray } from "@utils";
|
||||
|
||||
import { useStore_IsOpenedTranslatorSelector } from "@store";
|
||||
import { useLanguageSettings } from "@logics_main";
|
||||
|
||||
Reference in New Issue
Block a user