Enhance localization support by integrating i18next for translations across various components and pages. Update UI elements to utilize translated strings for improved user experience in both English and Russian. Additionally, refactor the Toaster component to support a context-based approach for toast notifications.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
DialogRoot,
|
||||
DialogContent,
|
||||
@@ -27,10 +28,14 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
||||
onConfirm,
|
||||
title,
|
||||
message,
|
||||
confirmLabel = 'Подтвердить',
|
||||
cancelLabel = 'Отмена',
|
||||
confirmLabel,
|
||||
cancelLabel,
|
||||
isLoading = false,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const confirm = confirmLabel || t('challenge.admin.common.confirm')
|
||||
const cancel = cancelLabel || t('challenge.admin.common.cancel')
|
||||
return (
|
||||
<DialogRoot open={isOpen} onOpenChange={(e) => !e.open && onClose()}>
|
||||
<DialogContent>
|
||||
@@ -43,15 +48,15 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
||||
<DialogFooter>
|
||||
<DialogActionTrigger asChild>
|
||||
<Button variant="outline" onClick={onClose} disabled={isLoading}>
|
||||
{cancelLabel}
|
||||
{cancel}
|
||||
</Button>
|
||||
</DialogActionTrigger>
|
||||
<Button
|
||||
colorPalette="red"
|
||||
onClick={onConfirm}
|
||||
loading={isLoading}
|
||||
disabled={isLoading}
|
||||
>
|
||||
{confirmLabel}
|
||||
{confirm}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
Reference in New Issue
Block a user