Merge pull request #4 from pennyteenycat/AW-490-remove-russian-words

AW-490-remove-russian-words
This commit is contained in:
pennyteenycat 2025-07-01 21:55:04 +02:00 committed by GitHub
commit c6f1b48e63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 30 additions and 27 deletions

View File

@ -166,7 +166,8 @@
},
"offer_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": {
"title": "Стандартный план Отменен!",
@ -211,5 +212,8 @@
"breath_relax": "Breath & Relax",
"breath_in": "Breath in",
"breath_out": "Breath out"
},
"ActionFieldsForm": {
"required_field": "This field is required"
}
}

View File

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

View File

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

View File

@ -1,6 +1,7 @@
"use client";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useTranslations } from "next-intl";
import { Button, Spinner, Typography } from "@/components/ui";
import { TextInput } from "@/components/ui/TextInput/TextInput";
@ -10,19 +11,6 @@ import styles from "./ActionFieldsForm.module.scss";
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
type FormValues = Record<string, any>;
type FormErrors = Record<string, string>;
@ -41,6 +29,7 @@ export default function ActionFieldsForm({
isLoading,
buttonText,
}: ActionFieldsFormProps) {
const t = useTranslations("ActionFieldsForm");
const initialValues = useMemo(() => {
return fields.reduce((acc, field) => {
acc[field.key] = field.value ?? null;
@ -52,10 +41,26 @@ export default function ActionFieldsForm({
const [touched, setTouched] = useState<TouchedFields>({});
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(() => {
const validationErrors = validate(fields, formValues);
setErrors(validationErrors);
}, [formValues, fields]);
}, [formValues, fields, validate]);
const handleBlur = useCallback((key: string) => {
setTouched(prev => ({ ...prev, [key]: true }));

View File

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

View File

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

View File

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

View File

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