AW-490-remove-russian-words

remove russian words from ui
This commit is contained in:
gofnnp 2025-07-01 19:33:55 +04:00
parent 89675109f7
commit c3a0fdbfbf
8 changed files with 30 additions and 27 deletions

View File

@ -166,7 +166,8 @@
}, },
"offer_button": "Применить", "offer_button": "Применить",
"cancel_button": "Я подтверждаю свои действия", "cancel_button": "Я подтверждаю свои действия",
"error_message": "Something went wrong. Please try again later." "error_message": "Something went wrong. Please try again later.",
"toast_message": "Your subscription will be cancelled!"
}, },
"PlanCancelled": { "PlanCancelled": {
"title": "Стандартный план Отменен!", "title": "Стандартный план Отменен!",
@ -211,5 +212,8 @@
"breath_relax": "Breath & Relax", "breath_relax": "Breath & Relax",
"breath_in": "Breath in", "breath_in": "Breath in",
"breath_out": "Breath out" "breath_out": "Breath out"
},
"ActionFieldsForm": {
"required_field": "This field is required"
} }
} }

View File

@ -97,7 +97,7 @@ export default function Buttons() {
</RetainingButton> </RetainingButton>
{isToastVisible && ( {isToastVisible && (
<Toast classNameContainer={styles.toast} variant="success"> <Toast classNameContainer={styles.toast} variant="success">
Ваша подписка будет аннулирована! {t("toast_message")}
</Toast> </Toast>
)} )}
</> </>

View File

@ -98,7 +98,7 @@ function Toast({
<button <button
onClick={onClose} onClick={onClose}
className={styles.closeButton} className={styles.closeButton}
aria-label="Закрыть уведомление" aria-label="Close notification"
type="button" type="button"
> >
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none">

View File

@ -1,6 +1,7 @@
"use client"; "use client";
import { useCallback, useEffect, useMemo, useState } from "react"; import { useCallback, useEffect, useMemo, useState } from "react";
import { useTranslations } from "next-intl";
import { Button, Spinner, Typography } from "@/components/ui"; import { Button, Spinner, Typography } from "@/components/ui";
import { TextInput } from "@/components/ui/TextInput/TextInput"; import { TextInput } from "@/components/ui/TextInput/TextInput";
@ -10,19 +11,6 @@ import styles from "./ActionFieldsForm.module.scss";
import { DatePicker, TimePicker } from ".."; import { DatePicker, TimePicker } from "..";
const validate = (fields: ActionField[], values: FormValues): FormErrors => {
const errors: FormErrors = {};
for (const field of fields) {
const value = values[field.key];
if (value === null || value === "" || value === undefined) {
errors[field.key] = "Это поле обязательно для заполнения";
}
}
return errors;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
type FormValues = Record<string, any>; type FormValues = Record<string, any>;
type FormErrors = Record<string, string>; type FormErrors = Record<string, string>;
@ -41,6 +29,7 @@ export default function ActionFieldsForm({
isLoading, isLoading,
buttonText, buttonText,
}: ActionFieldsFormProps) { }: ActionFieldsFormProps) {
const t = useTranslations("ActionFieldsForm");
const initialValues = useMemo(() => { const initialValues = useMemo(() => {
return fields.reduce((acc, field) => { return fields.reduce((acc, field) => {
acc[field.key] = field.value ?? null; acc[field.key] = field.value ?? null;
@ -52,10 +41,26 @@ export default function ActionFieldsForm({
const [touched, setTouched] = useState<TouchedFields>({}); const [touched, setTouched] = useState<TouchedFields>({});
const [errors, setErrors] = useState<FormErrors>({}); const [errors, setErrors] = useState<FormErrors>({});
const validate = useCallback(
(fields: ActionField[], values: FormValues): FormErrors => {
const errors: FormErrors = {};
for (const field of fields) {
const value = values[field.key];
if (value === null || value === "" || value === undefined) {
errors[field.key] = t("required_field");
}
}
return errors;
},
[t]
);
useEffect(() => { useEffect(() => {
const validationErrors = validate(fields, formValues); const validationErrors = validate(fields, formValues);
setErrors(validationErrors); setErrors(validationErrors);
}, [formValues, fields]); }, [formValues, fields, validate]);
const handleBlur = useCallback((key: string) => { const handleBlur = useCallback((key: string) => {
setTouched(prev => ({ ...prev, [key]: true })); setTouched(prev => ({ ...prev, [key]: true }));

View File

@ -88,12 +88,6 @@ const ToastContainer = memo(() => {
</Toast> </Toast>
</div> </div>
))} ))}
{/* {toasts.length > maxVisible && (
<div className={styles.queueIndicator}>
+{toasts.length - maxVisible} в очереди
</div>
)} */}
</div> </div>
); );
}); });

View File

@ -28,7 +28,7 @@ export async function startGeneration(
} catch (error) { } catch (error) {
console.error("Failed to start generation:", error); console.error("Failed to start generation:", error);
const errorMessage = const errorMessage =
error instanceof Error ? error.message : "Произошла неизвестная ошибка."; error instanceof Error ? error.message : "Something went wrong.";
return { data: null, error: errorMessage }; return { data: null, error: errorMessage };
} }
} }
@ -48,7 +48,7 @@ export async function fetchGenerationStatus(
} catch (error) { } catch (error) {
console.error("Failed to fetch generation status:", error); console.error("Failed to fetch generation status:", error);
const errorMessage = const errorMessage =
error instanceof Error ? error.message : "Произошла неизвестная ошибка."; error instanceof Error ? error.message : "Something went wrong.";
return { data: null, error: errorMessage }; return { data: null, error: errorMessage };
} }
} }

View File

@ -28,7 +28,7 @@ export async function performUserSubscriptionAction(
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error("Failed to perform user subscription action:", error); console.error("Failed to perform user subscription action:", error);
const errorMessage = const errorMessage =
error instanceof Error ? error.message : "Произошла неизвестная ошибка."; error instanceof Error ? error.message : "Something went wrong.";
return { data: null, error: errorMessage }; return { data: null, error: errorMessage };
} }
} }

View File

@ -14,7 +14,7 @@ export function useGenerationPolling(id: string, interval = 3000) {
useEffect(() => { useEffect(() => {
if (!id) { if (!id) {
setError("ID генерации не найден."); setError("ID of generation not found.");
setIsLoading(false); setIsLoading(false);
return; return;
} }