diff --git a/prediqo_web/package-lock.json b/prediqo_web/package-lock.json
index ef9bd15b..ce07fed1 100644
--- a/prediqo_web/package-lock.json
+++ b/prediqo_web/package-lock.json
@@ -16,9 +16,12 @@
"@tanstack/react-query": "^5.87.1",
"axios": "^1.11.0",
"dayjs": "^1.11.13",
+ "i18next": "^26.3.4",
+ "i18next-browser-languagedetector": "^8.2.1",
"lightweight-charts": "^5.2.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
+ "react-i18next": "^17.0.8",
"react-qr-code": "^2.2.0",
"react-router-dom": "^7.15.0",
"recharts": "^3.9.0",
@@ -2262,6 +2265,52 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"license": "MIT"
},
+ "node_modules/html-parse-stringify": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
+ "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==",
+ "license": "MIT",
+ "dependencies": {
+ "void-elements": "3.1.0"
+ }
+ },
+ "node_modules/i18next": {
+ "version": "26.3.4",
+ "resolved": "https://registry.npmjs.org/i18next/-/i18next-26.3.4.tgz",
+ "integrity": "sha512-pa7m0d7pBDqGHZxljT+WPFeyFgQ7P7SciPPo1tTqYuO0z4sqADYhwnBESmmGp/wEof1inwdls/k8ZgTg8rxFHA==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://www.locize.com/i18next"
+ },
+ {
+ "type": "individual",
+ "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project"
+ },
+ {
+ "type": "individual",
+ "url": "https://www.locize.com"
+ }
+ ],
+ "license": "MIT",
+ "peerDependencies": {
+ "typescript": "^5 || ^6"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/i18next-browser-languagedetector": {
+ "version": "8.2.1",
+ "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.2.1.tgz",
+ "integrity": "sha512-bZg8+4bdmaOiApD7N7BPT9W8MLZG+nPTOFlLiJiT8uzKXFjhxw4v2ierCXOwB5sFDMtuA5G4kgYZ0AznZxQ/cw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.23.2"
+ }
+ },
"node_modules/immer": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz",
@@ -2870,6 +2919,33 @@
"react": "^19.2.6"
}
},
+ "node_modules/react-i18next": {
+ "version": "17.0.8",
+ "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-17.0.8.tgz",
+ "integrity": "sha512-0ooKbGLU8JXhe1zwpQUWIeXSgLPOfwJmgheWRIUpcoA0CpyabpGhayjdG+/eA5esC1AQ8h2jWpXjJfzQzeDOCw==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.29.2",
+ "html-parse-stringify": "^3.0.1",
+ "use-sync-external-store": "^1.6.0"
+ },
+ "peerDependencies": {
+ "i18next": ">= 26.2.0",
+ "react": ">= 16.8.0",
+ "typescript": "^5 || ^6"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ },
+ "react-native": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
"node_modules/react-is": {
"version": "19.2.6",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.6.tgz",
@@ -3197,7 +3273,7 @@
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
"integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
- "dev": true,
+ "devOptional": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
@@ -3347,6 +3423,15 @@
}
}
},
+ "node_modules/void-elements": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
+ "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
diff --git a/prediqo_web/package.json b/prediqo_web/package.json
index 19b3fde5..5c1f8278 100644
--- a/prediqo_web/package.json
+++ b/prediqo_web/package.json
@@ -25,9 +25,12 @@
"@tanstack/react-query": "^5.87.1",
"axios": "^1.11.0",
"dayjs": "^1.11.13",
+ "i18next": "^26.3.4",
+ "i18next-browser-languagedetector": "^8.2.1",
"lightweight-charts": "^5.2.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
+ "react-i18next": "^17.0.8",
"react-qr-code": "^2.2.0",
"react-router-dom": "^7.15.0",
"recharts": "^3.9.0",
diff --git a/prediqo_web/src/app/App.tsx b/prediqo_web/src/app/App.tsx
index 02d0027d..5a443be9 100644
--- a/prediqo_web/src/app/App.tsx
+++ b/prediqo_web/src/app/App.tsx
@@ -4,6 +4,8 @@
*/
import { CssBaseline, ThemeProvider } from '@mui/material';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import { RouterProvider } from 'react-router-dom';
import { createAppTheme } from './theme/theme';
import { router } from './router/router';
@@ -21,8 +23,10 @@ const queryClient = new QueryClient({
*
* @returns The fully configured admin application tree.
*/
-export function App() {
- const theme = createAppTheme();
+function AppProviders() {
+ const { i18n } = useTranslation();
+ const theme = useMemo(() => createAppTheme(i18n.language), [i18n.language]);
+
return (
@@ -35,3 +39,7 @@ export function App() {
);
}
+
+export function App() {
+ return ;
+}
diff --git a/prediqo_web/src/app/theme/theme.ts b/prediqo_web/src/app/theme/theme.ts
index da8be460..9512e739 100644
--- a/prediqo_web/src/app/theme/theme.ts
+++ b/prediqo_web/src/app/theme/theme.ts
@@ -2,15 +2,11 @@
* MUI theme factory for the web admin console.
* Provides a dark, game-ready visual baseline with consistent palette, typography, and component overrides.
*/
-import { createTheme } from '@mui/material/styles';
+import { createTheme, type ThemeOptions } from '@mui/material/styles';
+import { enUS, frFR } from '@mui/material/locale';
+import { normalizeLocale } from '../../shared/i18n';
-/**
- * Builds the application MUI theme with a dark palette, gold accent, and shared component styling.
- *
- * @returns A configured MUI theme instance for the admin console.
- */
-export function createAppTheme() {
- return createTheme({
+const baseThemeOptions: ThemeOptions = {
palette: {
mode: 'dark',
primary: { main: '#D6B25E' }, // gold accent
@@ -44,5 +40,14 @@ export function createAppTheme() {
defaultProps: { disableElevation: true },
},
},
- });
+};
+
+/**
+ * Builds the application MUI theme with a dark palette, gold accent, and shared component styling.
+ *
+ * @returns A configured MUI theme instance for the admin console.
+ */
+export function createAppTheme(language?: string) {
+ const muiLocale = normalizeLocale(language) === 'fr' ? frFR : enUS;
+ return createTheme(baseThemeOptions, muiLocale);
}
diff --git a/prediqo_web/src/features/approvals/ApprovalsPage.tsx b/prediqo_web/src/features/approvals/ApprovalsPage.tsx
index d4daf572..9236594d 100644
--- a/prediqo_web/src/features/approvals/ApprovalsPage.tsx
+++ b/prediqo_web/src/features/approvals/ApprovalsPage.tsx
@@ -22,6 +22,7 @@ import {
import GavelRoundedIcon from '@mui/icons-material/GavelRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader';
import { useAuth } from '../../shared/auth/AuthContext';
@@ -38,15 +39,16 @@ type FundRequest = {
createdAt: string;
};
-const OP_LABELS: Record = {
- ledger_credit: 'Ledger credit',
- treasury_cold_to_hot: 'Cold → Hot funding',
- bonus_pool_fund: 'Bonus pool fund',
- sweep_manual: 'Manual sweeps',
- sweep_batch: 'Auto sweep batch',
-};
+const OP_TYPE_KEYS = [
+ 'ledger_credit',
+ 'treasury_cold_to_hot',
+ 'bonus_pool_fund',
+ 'sweep_manual',
+ 'sweep_batch',
+] as const;
export function ApprovalsPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const { canApproveFundOps } = useAuth();
const [rejectId, setRejectId] = useState(null);
@@ -67,7 +69,7 @@ export function ApprovalsPage() {
const approveMut = useMutation({
mutationFn: (id: string) => api.post(`/api/v1/admin/fund-requests/${id}/approve`),
onSuccess: () => {
- setMessage('Request approved and executed.');
+ setMessage(t('admin.approvals.approved'));
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
},
});
@@ -78,15 +80,20 @@ export function ApprovalsPage() {
onSuccess: () => {
setRejectId(null);
setRejectReason('');
- setMessage('Request rejected.');
+ setMessage(t('admin.approvals.rejected'));
void qc.invalidateQueries({ queryKey: ['admin-fund-requests'] });
},
});
+ const opLabel = (operationType: string) => {
+ if ((OP_TYPE_KEYS as readonly string[]).includes(operationType)) {
+ return t(`admin.approvals.opTypes.${operationType as (typeof OP_TYPE_KEYS)[number]}`);
+ }
+ return operationType;
+ };
+
if (!canApproveFundOps) {
- return (
- You do not have permission to approve fund operations.
- );
+ return {t('admin.approvals.noPermission')};
}
const items = listQ.data?.items ?? [];
@@ -95,10 +102,10 @@ export function ApprovalsPage() {
}
- title="Approvals"
- subtitle="Review and approve sensitive fund operations"
+ title={t('admin.approvals.title')}
+ subtitle={t('admin.approvals.subtitle')}
actions={
- void listQ.refetch()} />
+ void listQ.refetch()} />
}
/>
@@ -110,7 +117,7 @@ export function ApprovalsPage() {
{listQ.isError && (
- Failed to load approval queue.
+ {t('admin.approvals.loadError')}
)}
@@ -118,11 +125,11 @@ export function ApprovalsPage() {
- Type
- Requested by
- Created
- Status
- Actions
+ {t('admin.approvals.type')}
+ {t('admin.approvals.requestedBy')}
+ {t('admin.approvals.created')}
+ {t('common.status')}
+ {t('admin.approvals.actions')}
@@ -130,14 +137,14 @@ export function ApprovalsPage() {
- No pending approvals.
+ {t('admin.approvals.noPending')}
) : (
items.map((r) => (
- {OP_LABELS[r.operationType] ?? r.operationType}
+ {opLabel(r.operationType)}
{r.requestedBy.slice(0, 8)}…
@@ -153,10 +160,10 @@ export function ApprovalsPage() {
disabled={approveMut.isPending}
onClick={() => void approveMut.mutateAsync(r.id)}
>
- Approve
+ {t('admin.approvals.approve')}
@@ -168,13 +175,13 @@ export function ApprovalsPage() {
diff --git a/prediqo_web/src/features/auth/ForgotPasswordPage.tsx b/prediqo_web/src/features/auth/ForgotPasswordPage.tsx
index 8be05a80..dbf20880 100644
--- a/prediqo_web/src/features/auth/ForgotPasswordPage.tsx
+++ b/prediqo_web/src/features/auth/ForgotPasswordPage.tsx
@@ -4,9 +4,12 @@
import { Alert, Box, Button, Card, CardContent, Link, Stack, TextField, Typography } from '@mui/material';
import { useState } from 'react';
import { Link as RouterLink } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
+import { LanguageSwitcher } from '../../shared/i18n/LanguageSwitcher';
export function ForgotPasswordPage() {
+ const { t } = useTranslation();
const [email, setEmail] = useState('');
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
@@ -18,7 +21,7 @@ export function ForgotPasswordPage() {
setSuccess(null);
setDevUrl(null);
if (!email.trim()) {
- setError('Email is required.');
+ setError(t('auth.emailRequiredShort'));
return;
}
setLoading(true);
@@ -31,22 +34,23 @@ export function ForgotPasswordPage() {
if (res.data.devResetUrl) setDevUrl(res.data.devResetUrl);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setError(err?.response?.data?.error ?? err?.message ?? 'Request failed');
+ setError(err?.response?.data?.error ?? err?.message ?? t('auth.requestFailed'));
} finally {
setLoading(false);
}
};
return (
-
+
+
+
+
- Reset password
-
-
- Enter your email and we'll send you a secure link to choose a new password.
+ {t('auth.resetPassword')}
+ {t('auth.resetPasswordSubtitle')}
{error && {error}}
@@ -54,7 +58,7 @@ export function ForgotPasswordPage() {
{devUrl && (
- Local / console mode — no email is sent. Open this link to reset your password:
+ {t('auth.consoleResetHint')}
{devUrl}
@@ -62,7 +66,7 @@ export function ForgotPasswordPage() {
)}
setEmail(e.target.value)}
@@ -70,11 +74,11 @@ export function ForgotPasswordPage() {
autoComplete="email"
/>
- Back to sign in
+ {t('auth.backToSignIn')}
diff --git a/prediqo_web/src/features/auth/LoginPage.tsx b/prediqo_web/src/features/auth/LoginPage.tsx
index 18d12c14..edf04807 100644
--- a/prediqo_web/src/features/auth/LoginPage.tsx
+++ b/prediqo_web/src/features/auth/LoginPage.tsx
@@ -7,8 +7,10 @@ import { Alert, Box, Button, Card, CardContent, Link, Stack, TextField, Typograp
import { useState } from 'react';
import { useLocation, useNavigate, Link as RouterLink } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { useAuth } from '../../shared/auth/AuthContext';
+import { LanguageSwitcher } from '../../shared/i18n/LanguageSwitcher';
type LoginResponse = {
accessToken: string;
@@ -26,6 +28,7 @@ type LoginResponse = {
/** Sign-in form with optional TOTP; redirects to `from` route on success. */
export function LoginPage() {
+ const { t } = useTranslation();
const nav = useNavigate();
const loc = useLocation() as any;
const { setAuth } = useAuth();
@@ -55,7 +58,7 @@ export function LoginPage() {
setResendSuccess(null);
setDevVerifyUrl(null);
if (!email.trim()) {
- setError('Enter your email address first.');
+ setError(t('auth.enterEmailFirst'));
return;
}
setResendLoading(true);
@@ -68,7 +71,7 @@ export function LoginPage() {
if (res.data.devVerifyUrl) setDevVerifyUrl(res.data.devVerifyUrl);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setError(err?.response?.data?.error ?? err?.message ?? 'Failed to resend verification email');
+ setError(err?.response?.data?.error ?? err?.message ?? t('auth.resendFailed'));
} finally {
setResendLoading(false);
}
@@ -81,7 +84,7 @@ export function LoginPage() {
setResendSuccess(null);
setDevVerifyUrl(null);
if (!email.trim() || !password) {
- setError('Email and password are required.');
+ setError(t('auth.emailPasswordRequired'));
return;
}
setLoading(true);
@@ -101,7 +104,7 @@ export function LoginPage() {
});
nav(from, { replace: true });
} catch (e: any) {
- const msg = e?.response?.data?.error ?? e?.message ?? 'Login failed';
+ const msg = e?.response?.data?.error ?? e?.message ?? t('auth.loginFailed');
const code = e?.response?.data?.code;
setError(String(msg));
setEmailNotVerified(code === 'EMAIL_NOT_VERIFIED');
@@ -111,27 +114,24 @@ export function LoginPage() {
};
return (
-
+
+
+
+
Prediqo
-
- Prediction games platform — sign in to manage or play.
-
+ {t('auth.brandSubtitle')}
- {verifyHint && (
-
- We sent a confirmation link to your email. Verify your address before signing in.
-
- )}
+ {verifyHint && {t('auth.verifyEmailHint')}}
{setupQ.data?.needsSetup && (
- Aucun administrateur n'est configuré.{' '}
+ {t('auth.noAdminConfigured')}{' '}
- Initialiser la plateforme
+ {t('auth.initializePlatform')}
)}
@@ -139,8 +139,7 @@ export function LoginPage() {
{emailNotVerified && (
- Your account exists but the email is not verified yet. Request a new confirmation
- link below (check spam if nothing arrives).
+ {t('auth.emailNotVerified')}
)}
{resendSuccess && {resendSuccess}}
{devVerifyUrl && (
- Dev link:{' '}
+ {t('auth.devVerifyLink')}{' '}
- Open verification URL
+ {t('auth.openVerificationUrl')}
)}
setEmail(e.target.value)}
autoComplete="email"
fullWidth
/>
setPassword(e.target.value)}
type="password"
@@ -177,29 +176,29 @@ export function LoginPage() {
fullWidth
/>
setTotpCode(e.target.value)}
slotProps={{ htmlInput: { inputMode: 'numeric', pattern: '[0-9]*' } as any }}
fullWidth
/>
- Forgot password?
+ {t('auth.forgotPassword')}
- Foire aux questions
+ {t('auth.faqLink')}
- No account yet?{' '}
+ {t('auth.noAccount')}{' '}
- Create one
+ {t('auth.createOne')}
@@ -208,4 +207,3 @@ export function LoginPage() {
);
}
-
diff --git a/prediqo_web/src/features/auth/RegisterPage.tsx b/prediqo_web/src/features/auth/RegisterPage.tsx
index 41e0242a..1a76908b 100644
--- a/prediqo_web/src/features/auth/RegisterPage.tsx
+++ b/prediqo_web/src/features/auth/RegisterPage.tsx
@@ -15,10 +15,12 @@ import {
import { useEffect, useState } from 'react';
import { Link as RouterLink, useNavigate, useSearchParams } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
+import { Trans, useTranslation } from 'react-i18next';
import { CountryAutocomplete, type CountryOption } from '../../shared/components/CountryAutocomplete';
import { GenderSelect } from '../../shared/components/GenderSelect';
import type { UserGender } from '../../shared/constants/userGender';
import { api } from '../../shared/services/api';
+import { LanguageSwitcher } from '../../shared/i18n/LanguageSwitcher';
type RegisterResponse = {
message: string;
@@ -28,6 +30,7 @@ type RegisterResponse = {
};
export function RegisterPage() {
+ const { t } = useTranslation();
const nav = useNavigate();
const [searchParams] = useSearchParams();
const refFromUrl = searchParams.get('ref') ?? '';
@@ -65,7 +68,7 @@ export function RegisterPage() {
setReferralValid(null);
return;
}
- const t = setTimeout(async () => {
+ const timer = setTimeout(async () => {
try {
const res = await api.get<{ valid: boolean }>(`/api/v1/auth/referral/validate/${encodeURIComponent(code)}`);
setReferralValid(res.data.valid);
@@ -73,7 +76,7 @@ export function RegisterPage() {
setReferralValid(false);
}
}, 400);
- return () => clearTimeout(t);
+ return () => clearTimeout(timer);
}, [referralCode]);
const resolvedCountry = country;
@@ -82,11 +85,11 @@ export function RegisterPage() {
setError(null);
setSuccess(null);
if (!fullName.trim() || !email.trim() || !password || !resolvedCountry || !gender) {
- setError('Full name, email, password, country of residence, and gender are required.');
+ setError(t('auth.registerFieldsRequired'));
return;
}
if (!/^[A-Z]{2}$/.test(resolvedCountry)) {
- setError('Country must be a 2-letter ISO code (e.g. FR).');
+ setError(t('auth.countryIsoInvalid'));
return;
}
setLoading(true);
@@ -101,33 +104,31 @@ export function RegisterPage() {
gender,
referralCode: referralCode.trim() || undefined,
});
- setSuccess(
- res.data.message ||
- 'Account created. Check your email and click the verification link before signing in.'
- );
+ setSuccess(res.data.message || t('auth.registerSuccess'));
setTimeout(() => nav('/login', { replace: true, state: { verifyEmail: true } }), 4000);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setError(err?.response?.data?.error ?? err?.message ?? 'Registration failed');
+ setError(err?.response?.data?.error ?? err?.message ?? t('auth.registerFailed'));
} finally {
setLoading(false);
}
};
return (
-
+
+
+
+
- Create account
-
-
- Join Prediqo — use a friend's referral link or sign up directly.
+ {t('auth.createAccount')}
+ {t('auth.registerSubtitle')}
{refFromUrl && (
- You were invited with referral code {refFromUrl}.
+ }} />
)}
@@ -136,14 +137,14 @@ export function RegisterPage() {
{success && {success}}
setFullName(e.target.value)}
fullWidth
autoComplete="name"
/>
setEmail(e.target.value)}
@@ -151,14 +152,14 @@ export function RegisterPage() {
autoComplete="email"
/>
setPhone(e.target.value)}
fullWidth
autoComplete="tel"
/>
setPassword(e.target.value)}
@@ -167,60 +168,51 @@ export function RegisterPage() {
/>
-
+
- {countriesQ.isError && (
-
- Could not load country list. Ask an admin to sync countries, then refresh.
-
- )}
+ {countriesQ.isError && {t('auth.countriesLoadFailed')}}
setReferralCode(e.target.value.toUpperCase())}
fullWidth
helperText={
referralValid === true
- ? 'Valid referral code'
+ ? t('auth.referralValid')
: referralValid === false
- ? 'Unknown code — you can still register (default referrer will apply)'
- : 'Leave empty to use the platform default referrer'
+ ? t('auth.referralUnknown')
+ : t('auth.referralEmpty')
}
error={referralValid === false && !!referralCode.trim()}
/>
- Already have an account?{' '}
+ {t('auth.alreadyHaveAccount')}{' '}
- Sign in
+ {t('auth.signIn')}
diff --git a/prediqo_web/src/features/auth/ResetPasswordPage.tsx b/prediqo_web/src/features/auth/ResetPasswordPage.tsx
index aa83ee36..dfca9eb2 100644
--- a/prediqo_web/src/features/auth/ResetPasswordPage.tsx
+++ b/prediqo_web/src/features/auth/ResetPasswordPage.tsx
@@ -15,9 +15,12 @@ import {
} from '@mui/material';
import { useEffect, useState } from 'react';
import { Link as RouterLink, useSearchParams } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
+import { LanguageSwitcher } from '../../shared/i18n/LanguageSwitcher';
export function ResetPasswordPage() {
+ const { t } = useTranslation();
const [params] = useSearchParams();
const token = params.get('token') ?? '';
const [tokenValid, setTokenValid] = useState(null);
@@ -51,7 +54,7 @@ export function ResetPasswordPage() {
const submit = async () => {
setError(null);
if (!password || password !== confirm) {
- setError('Passwords must match.');
+ setError(t('auth.passwordsMustMatch'));
return;
}
setLoading(true);
@@ -63,18 +66,21 @@ export function ResetPasswordPage() {
setSuccess(res.data.message);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setError(err?.response?.data?.error ?? err?.message ?? 'Reset failed');
+ setError(err?.response?.data?.error ?? err?.message ?? t('auth.resetFailed'));
} finally {
setLoading(false);
}
};
return (
-
+
+
+
+
- Choose new password
+ {t('auth.chooseNewPassword')}
{tokenValid === null && (
@@ -85,7 +91,7 @@ export function ResetPasswordPage() {
{tokenValid === false && !success && (
- Invalid or expired reset link. Request a new one from the forgot password page.
+ {t('auth.invalidResetLink')}
)}
@@ -93,7 +99,7 @@ export function ResetPasswordPage() {
{success}
)}
@@ -102,7 +108,7 @@ export function ResetPasswordPage() {
{error && {error}}
setPassword(e.target.value)}
@@ -110,7 +116,7 @@ export function ResetPasswordPage() {
autoComplete="new-password"
/>
setConfirm(e.target.value)}
@@ -118,14 +124,14 @@ export function ResetPasswordPage() {
autoComplete="new-password"
/>
)}
- Request a new link
+ {t('auth.requestNewLink')}
diff --git a/prediqo_web/src/features/auth/SetupPage.tsx b/prediqo_web/src/features/auth/SetupPage.tsx
index 1a15f3ec..80117687 100644
--- a/prediqo_web/src/features/auth/SetupPage.tsx
+++ b/prediqo_web/src/features/auth/SetupPage.tsx
@@ -17,12 +17,16 @@ import {
import AdminPanelSettingsRoundedIcon from '@mui/icons-material/AdminPanelSettingsRounded';
import { useQuery } from '@tanstack/react-query';
import { useState } from 'react';
+import type { ReactNode } from 'react';
import { Link as RouterLink, useNavigate } from 'react-router-dom';
+import { Trans, useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
+import { LanguageSwitcher } from '../../shared/i18n/LanguageSwitcher';
type SetupTab = 'create' | 'promote';
export function SetupPage() {
+ const { t } = useTranslation();
const nav = useNavigate();
const [tab, setTab] = useState('create');
const [setupToken, setSetupToken] = useState('');
@@ -59,7 +63,7 @@ export function SetupPage() {
setTimeout(() => nav('/login', { replace: true }), 2000);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setError(err?.response?.data?.error ?? err?.message ?? 'Setup failed');
+ setError(err?.response?.data?.error ?? err?.message ?? t('setup.setupFailed'));
} finally {
setLoading(false);
}
@@ -78,102 +82,101 @@ export function SetupPage() {
setTimeout(() => nav('/login', { replace: true }), 2000);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setError(err?.response?.data?.error ?? err?.message ?? 'Promotion failed');
+ setError(err?.response?.data?.error ?? err?.message ?? t('setup.promotionFailed'));
} finally {
setLoading(false);
}
};
- if (statusQ.isLoading) {
- return (
-
- Chargement…
+ const shell = (children: ReactNode) => (
+
+
+
- );
+ {children}
+
+ );
+
+ if (statusQ.isLoading) {
+ return shell({t('setup.loading')});
}
if (statusQ.isError) {
- return (
-
-
-
-
- Impossible de vérifier l'état d'initialisation
-
-
- L'API n'a pas répondu. Vérifiez que{' '}
- VITE_API_BASE_URL correspond à l'URL publique (ex.{' '}
- http://prediqo.redirectme.net:9080) puis reconstruisez le frontend.
-
-
-
-
-
+ return shell(
+
+
+
+ {t('setup.statusCheckFailed')}
+
+
+ , code: }}
+ />
+
+
+
+
);
}
if (!needsSetup) {
- return (
-
-
-
-
- Configuration terminée
-
-
- Un compte administrateur existe déjà. Connectez-vous pour accéder à la plateforme.
-
-
-
-
-
+ return shell(
+
+
+
+ {t('setup.setupComplete')}
+
+ {t('setup.adminExists')}
+
+
+
);
}
return (
-
+
+
+
+
- Initialisation Prediqo
+ {t('setup.title')}
-
- Créez le premier compte administrateur pour configurer la plateforme en production.
-
+ {t('setup.subtitle')}
{!setupEnabled && (
- Définissez la variable d'environnement{' '}
- INITIAL_SETUP_TOKEN sur le serveur (min. 16 caractères aléatoires), puis
- redémarrez l'API.
+ }} />
)}
setSetupToken(e.target.value)}
- helperText="Secret configuré uniquement sur le serveur — ne le partagez pas."
+ helperText={t('setup.setupTokenHelper')}
sx={{ mb: 2 }}
/>
setTab(v)} sx={{ mb: 2 }}>
-
-
+
+
setEmail(e.target.value)}
@@ -181,25 +184,24 @@ export function SetupPage() {
{tab === 'create' && (
<>
setFullName(e.target.value)}
/>
setPassword(e.target.value)}
- helperText="Minimum 8 caractères"
+ helperText={t('setup.passwordMin')}
/>
>
)}
{tab === 'promote' && (
- L'utilisateur doit déjà s'être inscrit via la page Register. Son email sera
- marqué comme vérifié et son rôle passera à administrateur.
+ {t('setup.promoteHint')}
)}
@@ -222,12 +224,16 @@ export function SetupPage() {
disabled={loading || !setupEnabled || !setupToken.trim() || !email.trim()}
onClick={() => void (tab === 'create' ? submitCreate() : submitPromote())}
>
- {loading ? 'En cours…' : tab === 'create' ? 'Créer l’administrateur' : 'Promouvoir en admin'}
+ {loading
+ ? t('setup.inProgress')
+ : tab === 'create'
+ ? t('setup.createAdmin')
+ : t('setup.promoteAdmin')}
- Retour à la connexion
+ {t('setup.backToLogin')}
diff --git a/prediqo_web/src/features/auth/VerifyEmailPage.tsx b/prediqo_web/src/features/auth/VerifyEmailPage.tsx
index 4cbc5954..e7b20f38 100644
--- a/prediqo_web/src/features/auth/VerifyEmailPage.tsx
+++ b/prediqo_web/src/features/auth/VerifyEmailPage.tsx
@@ -15,12 +15,15 @@ import MarkEmailReadRoundedIcon from '@mui/icons-material/MarkEmailReadRounded';
import ErrorOutlineRoundedIcon from '@mui/icons-material/ErrorOutlineRounded';
import { useEffect, useState } from 'react';
import { Link as RouterLink, useSearchParams } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
+import { LanguageSwitcher } from '../../shared/i18n/LanguageSwitcher';
type Status = 'loading' | 'success' | 'error' | 'missing';
/** Standalone route opened from the verification email link. */
export function VerifyEmailPage() {
+ const { t } = useTranslation();
const [params] = useSearchParams();
const token = params.get('token');
const [status, setStatus] = useState(token ? 'loading' : 'missing');
@@ -41,7 +44,7 @@ export function VerifyEmailPage() {
if (!cancelled) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
setStatus('error');
- setMessage(err?.response?.data?.error ?? err?.message ?? 'Verification failed');
+ setMessage(err?.response?.data?.error ?? err?.message ?? t('auth.verificationFailed'));
}
}
})();
@@ -49,7 +52,7 @@ export function VerifyEmailPage() {
return () => {
cancelled = true;
};
- }, [token]);
+ }, [token, t]);
return (
+
+
+
- Verifying your email…
+ {t('auth.verifyingEmail')}
>
)}
@@ -90,10 +97,10 @@ export function VerifyEmailPage() {
{message}
>
)}
@@ -105,10 +112,10 @@ export function VerifyEmailPage() {
{message}
- Request a new link from your profile if this one expired.
+ {t('auth.requestNewLinkFromProfile')}
>
)}
@@ -116,10 +123,10 @@ export function VerifyEmailPage() {
{status === 'missing' && (
<>
- Missing verification token. Open the full link from your email.
+ {t('auth.missingVerificationToken')}
>
)}
diff --git a/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx b/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx
index 61efeeb3..c667beff 100644
--- a/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx
+++ b/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx
@@ -19,6 +19,7 @@ import ArrowBackRoundedIcon from '@mui/icons-material/ArrowBackRounded';
import CandlestickChartRoundedIcon from '@mui/icons-material/CandlestickChartRounded';
import { useEffect, useMemo, useRef, useState } from 'react';
import { Link as RouterLink } from 'react-router-dom';
+import { Trans, useTranslation } from 'react-i18next';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import { useLiveBalances } from '../wallet/hooks/useWalletData';
@@ -66,6 +67,7 @@ function formatCountdown(totalSec: number): string {
/** Main play page for the Candle Predict game. */
export function CandlePredictPage() {
+ const { t } = useTranslation();
const { isAdmin } = useAuth();
const theme = useTheme();
const isCompact = useMediaQuery(theme.breakpoints.down('md'));
@@ -202,31 +204,48 @@ export function CandlePredictPage() {
}, [round?.id, round?.settledAt, round?.outcome, balancesQ]);
const statusLabel = useMemo(() => {
- if (!round || !interval) return 'Loading…';
+ if (!round || !interval) return t('candlePredict.status.loading');
if (round.status === 'betting') {
const target = new Date(round.candleOpenMs).toLocaleTimeString();
- return `${interval.label} · predictions open · target ${target} · ${formatCountdown(round.secondsToBettingEnd)} left`;
+ return t('candlePredict.status.betting', {
+ interval: interval.label,
+ target,
+ countdown: formatCountdown(round.secondsToBettingEnd),
+ });
}
if (round.status === 'locked') {
const live = formatCountdown(round.secondsToClose);
const untilOpen = formatCountdown(round.secondsToBettingStart);
- return `${interval.label} · candle live · ${live} · predictions in ${untilOpen}`;
+ return t('candlePredict.status.locked', {
+ interval: interval.label,
+ live,
+ untilOpen,
+ });
}
if (round.status === 'waiting') {
- return `${interval.label} · next window in ${formatCountdown(round.secondsToBettingStart)}`;
+ return t('candlePredict.status.waiting', {
+ interval: interval.label,
+ countdown: formatCountdown(round.secondsToBettingStart),
+ });
}
- if (round.outcome === 'neutral') return `${interval.label} · manche nulle · mise remboursée`;
- if (round.outcome === 'short_win') return `${interval.label} · settled · Short won`;
- if (round.outcome === 'long_win') return `${interval.label} · settled · Long won`;
- return `${interval.label} · settled`;
- }, [round, interval, tick]);
+ if (round.outcome === 'neutral') {
+ return t('candlePredict.status.neutral', { interval: interval.label });
+ }
+ if (round.outcome === 'short_win') {
+ return t('candlePredict.status.shortWin', { interval: interval.label });
+ }
+ if (round.outcome === 'long_win') {
+ return t('candlePredict.status.longWin', { interval: interval.label });
+ }
+ return t('candlePredict.status.settled', { interval: interval.label });
+ }, [round, interval, tick, t]);
const statusColor =
round?.status === 'betting' ? 'warning' : round?.status === 'locked' ? 'info' : 'default';
const refresh = async () => {
await Promise.all([stateQ.refetch(), candlesQ.refetch(), balancesQ.refetch()]);
- setToast('Game refreshed');
+ setToast(t('common.gameRefreshed'));
};
const predictionsRefreshKey = [
@@ -256,9 +275,9 @@ export function CandlePredictPage() {
stakeAccountKind,
});
setStakeAccountKind('main');
- setToast(`Multi-candle level ${level} prediction placed`);
+ setToast(t('candlePredict.multiPredictionPlaced', { level }));
} catch (e: unknown) {
- setMultiPredictionError(extractGameApiError(e, 'Failed to place multi-candle prediction'));
+ setMultiPredictionError(extractGameApiError(e, t('candlePredict.multiPlaceFailed')));
}
};
@@ -298,10 +317,10 @@ export function CandlePredictPage() {
}}
>
- Single candle
+ {t('candlePredict.singleCandle')}
- Multi-candle
+ {t('candlePredict.multiCandle')}
) : null;
@@ -391,11 +410,11 @@ export function CandlePredictPage() {
stakeAccountKind,
});
- setToast(`Prediction placed for ${interval.label} round`);
+ setToast(t('candlePredict.predictionPlaced', { interval: interval.label }));
setDirection(null);
setStakeAccountKind('main');
} catch (e: unknown) {
- setPredictionError(extractGameApiError(e, 'Failed to place prediction'));
+ setPredictionError(extractGameApiError(e, t('candlePredict.placePredictionFailed')));
} finally {
submitInFlightRef.current = false;
setIsConfirmingBet(false);
@@ -411,7 +430,11 @@ export function CandlePredictPage() {
});
await stateQ.refetch();
if (saved.autoBetPlaced) {
- setToast(`Auto prediction enabled — placed for ${interval?.label ?? 'this'} round`);
+ setToast(
+ t('candlePredict.autoEnabledPlaced', {
+ interval: interval?.label ?? t('candlePredict.singleCandle'),
+ })
+ );
} else if (input.validateWalletBalance && saved.autoBetError?.includes('Insufficient')) {
setAutoSaveError(saved.autoBetError);
} else if (
@@ -429,11 +452,11 @@ export function CandlePredictPage() {
setAutoSaveError(saved.autoBetError);
setToast(`Auto prediction saved. ${saved.autoBetError}`);
} else {
- setToast('Auto prediction updated');
+ setToast(t('candlePredict.autoUpdated'));
}
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } } };
- const message = err?.response?.data?.error ?? 'Failed to save auto settings';
+ const message = err?.response?.data?.error ?? t('candlePredict.autoSaveFailed');
if (input.validateWalletBalance) {
setAutoSaveError(message);
}
@@ -458,11 +481,11 @@ export function CandlePredictPage() {
(stateQ.error instanceof Error ? stateQ.error.message : null);
const hint =
apiErr?.response?.status === 429
- ? 'Too many API requests — wait a minute or restart the backend.'
- : 'Run database migrations and ensure the API is running.';
+ ? t('candlePredict.rateLimitHint')
+ : t('candlePredict.apiHint');
return (
- Failed to load Candle Predict. {detail ? `${detail}. ` : ''}
+ {t('candlePredict.loadError')} {detail ? `${detail}. ` : ''}
{hint}
);
@@ -486,7 +509,7 @@ export function CandlePredictPage() {
+
}
@@ -494,19 +517,14 @@ export function CandlePredictPage() {
title={
- Candle Predict
+ {t('candlePredict.title')}
}
- subtitle={
- <>
- Prédisez si la prochaine bougie sera baissière (Short ↓) ou haussière (
- Long ↑), puis attendez le résultat de la manche.
- >
- }
+ subtitle={ }} />}
mb={2.5}
- actions={ void refresh()} />}
+ actions={ void refresh()} />}
/>
- Round status
+
+ {t('candlePredict.roundStatus.title')}
+
- This game is temporarily disabled by an administrator.
+ {t('candlePredict.gameDisabledAdmin')}
)}
diff --git a/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx b/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx
index d9d153b1..b518beb4 100644
--- a/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx
+++ b/prediqo_web/src/features/candle-predict/components/AdminPoolInsights.tsx
@@ -1,7 +1,6 @@
import { Alert, Chip, Stack, Typography } from '@mui/material';
+import { useTranslation } from 'react-i18next';
import type { CandlePredictConfig, CandlePredictInterval, CandlePredictRound } from '../types';
-import { NEUTRAL_ROUND_BEHAVIOR, poolNeutralitySummary } from '../utils/poolNeutrality';
-import { poolWinnerRuleLabel } from '../utils/poolWinnerRule';
import { PoolBar } from './PoolBar';
type Props = {
@@ -12,32 +11,47 @@ type Props = {
/** Admin-only live pool totals and internal settlement rule summary. */
export function AdminPoolInsights({ config, interval, round }: Props) {
+ const { t } = useTranslation();
+
if (!config.poolWinnerRule) return null;
- const neutralityRulesSummary = poolNeutralitySummary({
- tieTolerancePercent: interval.tieTolerancePercent ?? config.tieTolerancePercent ?? 0,
- tieToleranceMaxPercent: interval.tieToleranceMaxPercent ?? config.tieToleranceMaxPercent ?? 100,
- tieToleranceMinEnabled:
- interval.tieToleranceMinEnabled ?? config.tieToleranceMinEnabled ?? true,
- tieToleranceMaxEnabled:
- interval.tieToleranceMaxEnabled ?? config.tieToleranceMaxEnabled ?? true,
- });
+ const parts: string[] = [];
+ const tieTolerancePercent = interval.tieTolerancePercent ?? config.tieTolerancePercent ?? 0;
+ const tieToleranceMaxPercent = interval.tieToleranceMaxPercent ?? config.tieToleranceMaxPercent ?? 100;
+ const tieToleranceMinEnabled =
+ interval.tieToleranceMinEnabled ?? config.tieToleranceMinEnabled ?? true;
+ const tieToleranceMaxEnabled =
+ interval.tieToleranceMaxEnabled ?? config.tieToleranceMaxEnabled ?? true;
+
+ if (tieToleranceMinEnabled) {
+ parts.push(t('candlePredict.adminInsights.neutralMin', { percent: tieTolerancePercent }));
+ }
+ if (tieToleranceMaxEnabled) {
+ parts.push(t('candlePredict.adminInsights.neutralMax', { percent: tieToleranceMaxPercent }));
+ }
+
+ const neutralityRulesSummary =
+ parts.length > 0 ? parts.join(' · ') : t('candlePredict.adminInsights.neutralNone');
+
+ const poolWinnerLabel =
+ config.poolWinnerRule === 'majority'
+ ? t('candlePredict.adminInsights.poolWinnerMajority')
+ : t('candlePredict.adminInsights.poolWinnerMinority');
return (
- Vue administrateur — mécanismes internes
+ {t('candlePredict.adminInsights.title')}
-
+
- {neutralityRulesSummary}. {NEUTRAL_ROUND_BEHAVIOR}
+ {neutralityRulesSummary}. {t('candlePredict.adminInsights.neutralBehavior')}
- Non visible pour les joueurs. Les pools et règles de règlement ne doivent pas influencer leurs
- prédictions.
+ {t('candlePredict.adminInsights.footer')}
{round && }
diff --git a/prediqo_web/src/features/candle-predict/components/AutoPredictionBanner.tsx b/prediqo_web/src/features/candle-predict/components/AutoPredictionBanner.tsx
index a3d41617..64a723ba 100644
--- a/prediqo_web/src/features/candle-predict/components/AutoPredictionBanner.tsx
+++ b/prediqo_web/src/features/candle-predict/components/AutoPredictionBanner.tsx
@@ -1,5 +1,6 @@
import AutoModeRoundedIcon from '@mui/icons-material/AutoModeRounded';
import { Alert, Button, Stack, Typography } from '@mui/material';
+import { useTranslation } from 'react-i18next';
import type { AutoPredictionSettings, CandlePredictInterval } from '../types';
type Props = {
@@ -20,16 +21,19 @@ export function AutoPredictionBanner({
intervals,
onSwitchToAutoInterval,
}: Props) {
+ const { t } = useTranslation();
+
if (!settings?.enabled) return null;
const autoLabel = intervalLabel(intervals, settings.periodMinutes);
const viewingLabel = intervalLabel(intervals, activeIntervalMinutes);
const onAutoInterval = settings.periodMinutes === activeIntervalMinutes;
- const directionLabel = settings.direction === 'long' ? 'Long' : 'Short';
+ const directionLabel =
+ settings.direction === 'long' ? t('candlePredict.betting.long') : t('candlePredict.betting.short');
const modeLabel =
settings.mode === 'interval'
- ? `délai min. ${settings.intervalSeconds ?? 60}s entre mises auto · 1/manche`
- : 'chaque nouvelle manche';
+ ? t('candlePredict.autoBanner.modeInterval', { seconds: settings.intervalSeconds ?? 60 })
+ : t('candlePredict.autoBanner.modeEachRound');
if (onAutoInterval) {
return (
@@ -45,7 +49,9 @@ export function AutoPredictionBanner({
}}
>
- Prédiction auto active · {autoLabel}
+
+ {t('candlePredict.autoBanner.activeOnInterval', { interval: autoLabel })}
+
{directionLabel} · {settings.stakeDisplay} USDT · {modeLabel}
@@ -68,18 +74,20 @@ export function AutoPredictionBanner({
action={
onSwitchToAutoInterval ? (
) : undefined
}
>
- Auto prediction active on {autoLabel}
+ {t('candlePredict.autoBanner.activeOtherInterval', { interval: autoLabel })}
- You are viewing {viewingLabel}. Auto predictions only run on {autoLabel} — switch period or
- re-save auto settings here to move auto to {viewingLabel}.
+ {t('candlePredict.autoBanner.viewingMismatch', {
+ viewing: viewingLabel,
+ auto: autoLabel,
+ })}
diff --git a/prediqo_web/src/features/candle-predict/components/AutoPredictionPanel.tsx b/prediqo_web/src/features/candle-predict/components/AutoPredictionPanel.tsx
index 98c03cde..ff9452a9 100644
--- a/prediqo_web/src/features/candle-predict/components/AutoPredictionPanel.tsx
+++ b/prediqo_web/src/features/candle-predict/components/AutoPredictionPanel.tsx
@@ -16,6 +16,7 @@ import {
} from '@mui/material';
import AutoModeRoundedIcon from '@mui/icons-material/AutoModeRounded';
import { useEffect, useState } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
import type { AutoPredictionSettings, CandlePredictConfig, CandlePredictInterval, StakeAccountKind } from '../types';
import { CustomStakeAmountField } from './CustomStakeAmountField';
import { StakeWalletSelector } from './StakeWalletSelector';
@@ -38,7 +39,6 @@ type Props = {
}
) => Promise;
saving?: boolean;
- /** Compact horizontal bar when auto is already enabled (desktop layout). */
layout?: 'vertical' | 'horizontal';
};
@@ -46,16 +46,6 @@ function intervalLabel(intervals: CandlePredictInterval[], minutes: number): str
return intervals.find((i) => i.intervalMinutes === minutes)?.label ?? `${minutes} min`;
}
-function stakeAccountShort(kind: StakeAccountKind): string {
- if (kind === 'bonus') return 'Bonus';
- if (kind === 'test') return 'Test';
- return 'Main';
-}
-
-function modeShort(mode: 'each_round' | 'interval'): string {
- return mode === 'interval' ? 'Délai minimum' : 'Chaque manche';
-}
-
/** Auto Prediction configuration panel. */
export function AutoPredictionPanel({
config,
@@ -71,6 +61,7 @@ export function AutoPredictionPanel({
saving,
layout = 'vertical',
}: Props) {
+ const { t } = useTranslation();
const serverEnabled = settings?.enabled ?? false;
const [configuring, setConfiguring] = useState(false);
const [editing, setEditing] = useState(false);
@@ -120,6 +111,26 @@ export function AutoPredictionPanel({
const viewingDifferentPeriod =
serverEnabled && savedTargetMinutes != null && savedTargetMinutes !== interval.intervalMinutes;
+ const directionLabel =
+ current.direction === 'long' ? t('candlePredict.betting.long') : t('candlePredict.betting.short');
+
+ const stakeAccountShort = (kind: StakeAccountKind) => {
+ if (kind === 'bonus') return t('candlePredict.stakeWallet.bonus');
+ if (kind === 'test') return t('candlePredict.stakeWallet.test');
+ return t('candlePredict.stakeWallet.main');
+ };
+
+ const modeShort = (m: 'each_round' | 'interval') =>
+ m === 'interval'
+ ? t('candlePredict.autoPrediction.modeShortInterval')
+ : t('candlePredict.autoPrediction.modeShortEachRound');
+
+ const lastAutoBetLabel = current.lastAutoBetAt
+ ? t('candlePredict.autoPrediction.lastAutoBet', {
+ date: new Date(current.lastAutoBetAt).toLocaleString(),
+ })
+ : null;
+
const handleToggle = async (enabled: boolean) => {
onClearSaveError?.();
if (enabled) {
@@ -179,26 +190,33 @@ export function AutoPredictionPanel({
>
- Target period:
+ {t('candlePredict.autoPrediction.targetPeriod')}
{viewingDifferentPeriod ? (
- You are viewing {interval.label}. Save to move auto to {interval.label}.
+ {t('candlePredict.autoPrediction.viewingDifferent', {
+ viewing: interval.label,
+ target: interval.label,
+ })}
) : (
- Set from the prediction period you select when saving. One auto config per account.
+ {t('candlePredict.autoPrediction.targetHint')}
)}
- Direction
-
@@ -214,58 +232,62 @@ export function AutoPredictionPanel({
/>
- Mode
+ {t('candlePredict.autoPrediction.mode')}
setMode(e.target.value as 'each_round' | 'interval')}
>
{config.autoModes.includes('each_round') && (
-
+
)}
{config.autoModes.includes('interval') && (
-
+
)}
{mode === 'interval'
- ? 'Une mise par manche maximum. Attend au moins le délai indiqué depuis la dernière mise auto avant de parier sur la manche suivante (ou au save).'
- : 'Place une mise dès l’ouverture de la fenêtre de prédiction de chaque nouvelle manche.'}
+ ? t('candlePredict.autoPrediction.modeIntervalHelper')
+ : t('candlePredict.autoPrediction.modeEachRoundHelper')}
{mode === 'interval' && (
)}
{serverEnabled && (
)}
@@ -290,9 +312,9 @@ export function AutoPredictionPanel({
- Auto Prediction
+ {t('candlePredict.autoPrediction.title')}
- Activez pour parier automatiquement à chaque manche.
+ {t('candlePredict.autoPrediction.enableHint')}
@@ -301,12 +323,12 @@ export function AutoPredictionPanel({
control={
void handleToggle(e.target.checked)} />
}
- label="Activer la prédiction auto"
+ label={t('candlePredict.autoPrediction.enable')}
/>
- {current.lastAutoBetAt && (
+ {lastAutoBetLabel && (
- Dernière mise auto : {new Date(current.lastAutoBetAt).toLocaleString()}
+ {lastAutoBetLabel}
)}
@@ -314,7 +336,6 @@ export function AutoPredictionPanel({
}
if (showCompact && isHorizontal) {
- const directionLabel = current.direction === 'long' ? 'Long' : 'Short';
const accountKind = current.stakeAccountKind ?? 'main';
return (
@@ -334,11 +355,11 @@ export function AutoPredictionPanel({
>
- Prédiction auto active
+ {t('candlePredict.autoPrediction.titleActive')}
void handleToggle(e.target.checked)}
/>
}
- label="Désactiver"
+ label={t('candlePredict.autoPrediction.disable')}
/>
@@ -364,12 +385,17 @@ export function AutoPredictionPanel({
sx={{ fontWeight: 700 }}
/>
-
+
- {current.lastAutoBetAt && (
+ {lastAutoBetLabel && (
- Dernière mise auto : {new Date(current.lastAutoBetAt).toLocaleString()}
+ {lastAutoBetLabel}
)}
@@ -390,14 +416,12 @@ export function AutoPredictionPanel({
- Auto Prediction
+ {t('candlePredict.autoPrediction.title')}
{!showCompact && (
-
- Place automatiquement une prédiction par manche sur la période cible, avec
- les paramètres ci-dessous. La mise est prélevée sur le portefeuille sélectionné. Rien n'est
- envoyé tant que vous n'avez pas cliqué sur Enregistrer.
+
+ }} />
)}
@@ -407,12 +431,7 @@ export function AutoPredictionPanel({
<>
-
+
- {current.lastAutoBetAt && (
+ {lastAutoBetLabel && (
- Dernière mise auto : {new Date(current.lastAutoBetAt).toLocaleString()}
+ {lastAutoBetLabel}
)}
>
@@ -444,23 +463,21 @@ export function AutoPredictionPanel({
control={
void handleToggle(e.target.checked)} />
}
- label="Activer la prédiction auto"
+ label={t('candlePredict.autoPrediction.enable')}
/>
)}
{configuring && !serverEnabled && (
-
- Paramétrez votre prédiction ci-dessous, puis cliquez sur{' '}
- Enregistrer les paramètres auto pour activer le mode. Aucune mise ne sera
- placée avant l'enregistrement.
+
+ }} />
)}
{settingsForm}
- {!showCompact && current.lastAutoBetAt && (
+ {!showCompact && lastAutoBetLabel && (
- Dernière mise auto : {new Date(current.lastAutoBetAt).toLocaleString()}
+ {lastAutoBetLabel}
)}
diff --git a/prediqo_web/src/features/candle-predict/components/BettingPanel.tsx b/prediqo_web/src/features/candle-predict/components/BettingPanel.tsx
index 74f385e9..c87115da 100644
--- a/prediqo_web/src/features/candle-predict/components/BettingPanel.tsx
+++ b/prediqo_web/src/features/candle-predict/components/BettingPanel.tsx
@@ -4,6 +4,7 @@ import useMediaQuery from '@mui/material/useMediaQuery';
import TrendingDownRoundedIcon from '@mui/icons-material/TrendingDownRounded';
import TrendingUpRoundedIcon from '@mui/icons-material/TrendingUpRounded';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import type { CandleDirection, CandlePredictConfig, CandlePredictInterval, CandlePredictRound, StakeAccountKind } from '../types';
import { CustomStakeAmountField } from './CustomStakeAmountField';
import { StakeWalletSelector } from './StakeWalletSelector';
@@ -51,6 +52,7 @@ export function BettingPanel({
hasPrediction,
error,
}: Props) {
+ const { t } = useTranslation();
const theme = useTheme();
const isCompact = useMediaQuery(theme.breakpoints.down('sm'));
const { secondsToBettingEnd, secondsToBettingStart, bettingOpen: liveBettingOpen } =
@@ -85,18 +87,20 @@ export function BettingPanel({
- Place your prediction
+ {t('candlePredict.betting.title')}
- Short = bougie baissière · Long = bougie haussière. Choisissez une direction et confirmez votre
- mise.
+ {t('candlePredict.betting.hint')}
{round?.status === 'betting' && predictionOpen && (
0 && (
)}
{!config.isActive && (
- Game disabled by admin — predictions are unavailable.
+ {t('candlePredict.betting.gameDisabled')}
)}
{hasPrediction && (
- Your prediction is locked for this round.
+ {t('candlePredict.betting.predictionLocked')}
)}
{round?.status === 'locked' && !hasPrediction && (
- Candle in progress — place your prediction when the window opens
- {untilOpen > 0 ? ` (in ${formatWait(untilOpen)})` : ''}.
+ {t('candlePredict.betting.candleInProgress', {
+ suffix: untilOpen > 0 ? ` (${formatWait(untilOpen)})` : '',
+ })}
)}
{round?.status === 'waiting' && (
- The next prediction window opens shortly before the new candle.
+ {t('candlePredict.betting.nextWindowOpens')}
)}
{error && !hasPrediction && {error}}
@@ -141,7 +146,9 @@ export function BettingPanel({
- Stake amount ({config.walletTypeCode.replace('_', ' ')})
+ {t('candlePredict.betting.stakeAmount', {
+ code: config.walletTypeCode.replace('_', ' '),
+ })}
{config.stakeAmounts.map((amount) => (
@@ -169,13 +176,13 @@ export function BettingPanel({
disabled={!predictionOpen}
onValidChange={onStakeChange}
onValidityChange={setCustomStakeValid}
- helperText={`Quick picks above, or enter any amount from ${minStake} to ${maxStake} USDT (e.g. 0.25)`}
+ helperText={t('candlePredict.betting.stakeHelper', { min: minStake, max: maxStake })}
/>
- Prediction
+ {t('candlePredict.betting.prediction')}
- Short ↓
+ {t('candlePredict.betting.short')} ↓
- Long ↑
+ {t('candlePredict.betting.long')} ↑
@@ -228,8 +235,14 @@ export function BettingPanel({
sx={{ fontWeight: 900, py: 1.25, whiteSpace: 'normal', textAlign: 'center' }}
>
{isCompact
- ? `Confirm · ${selectedStake} · ×${interval.payoutMultiplier}`
- : `Confirm prediction · ${selectedStake} · Payout ×${interval.payoutMultiplier}`}
+ ? t('candlePredict.betting.confirmCompact', {
+ stake: selectedStake,
+ multiplier: interval.payoutMultiplier,
+ })
+ : t('candlePredict.betting.confirmFull', {
+ stake: selectedStake,
+ multiplier: interval.payoutMultiplier,
+ })}
diff --git a/prediqo_web/src/features/candle-predict/components/CandlestickChart.tsx b/prediqo_web/src/features/candle-predict/components/CandlestickChart.tsx
index 8987cf80..1e6ed367 100644
--- a/prediqo_web/src/features/candle-predict/components/CandlestickChart.tsx
+++ b/prediqo_web/src/features/candle-predict/components/CandlestickChart.tsx
@@ -1,6 +1,7 @@
import { Box, CircularProgress, Typography } from '@mui/material';
import { CandlestickSeries, ColorType, createChart, type IChartApi, type ISeriesApi } from 'lightweight-charts';
import { useEffect, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
import type { OhlcCandle } from '../types';
/** Fixed viewport: always show this many candles at the same pixel width. */
@@ -61,6 +62,7 @@ export function CandlestickChart({
loadingOlder = false,
onLoadOlder,
}: Props) {
+ const { t } = useTranslation();
const containerRef = useRef(null);
const chartRef = useRef(null);
const seriesRef = useRef | null>(null);
@@ -255,7 +257,7 @@ export function CandlestickChart({
userSelect: 'none',
}}
>
- Glisser ou molette pour voir l'historique
+ {t('candlePredict.chart.scrollHint')}
);
diff --git a/prediqo_web/src/features/candle-predict/components/CustomStakeAmountField.tsx b/prediqo_web/src/features/candle-predict/components/CustomStakeAmountField.tsx
index 5bb056c0..1cc89de7 100644
--- a/prediqo_web/src/features/candle-predict/components/CustomStakeAmountField.tsx
+++ b/prediqo_web/src/features/candle-predict/components/CustomStakeAmountField.tsx
@@ -1,10 +1,11 @@
import { TextField } from '@mui/material';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import {
isPartialStakeAmountInput,
parseStakeAmountInput,
- stakeAmountFormatError,
- stakeAmountRangeError,
+ stakeAmountFormatErrorCode,
+ stakeAmountRangeErrorCode,
} from '../utils/stakeAmountInput';
type Props = {
@@ -20,7 +21,7 @@ type Props = {
/** Controlled stake text field with strict format validation. */
export function CustomStakeAmountField({
- label = 'Custom amount',
+ label,
value,
minStake,
maxStake,
@@ -29,6 +30,7 @@ export function CustomStakeAmountField({
onValidChange,
onValidityChange,
}: Props) {
+ const { t } = useTranslation();
const [input, setInput] = useState(String(value));
const [touched, setTouched] = useState(false);
@@ -45,9 +47,13 @@ export function CustomStakeAmountField({
}
};
- const formatError = stakeAmountFormatError(input, { whileTyping: !touched });
- const rangeError = stakeAmountRangeError(input, minStake, maxStake);
- const error = formatError || rangeError;
+ const formatCode = stakeAmountFormatErrorCode(input, { whileTyping: !touched });
+ const rangeCode = stakeAmountRangeErrorCode(input, minStake, maxStake);
+ const error = formatCode
+ ? t(`candlePredict.stakeField.${formatCode}`)
+ : rangeCode
+ ? t('candlePredict.stakeField.range', { min: minStake, max: maxStake })
+ : null;
const parsed = parseStakeAmountInput(input);
const isValid = parsed.ok && parsed.value >= minStake && parsed.value <= maxStake;
@@ -57,7 +63,7 @@ export function CustomStakeAmountField({
return (
- Prediction period
+ {t('candlePredict.interval.title')}
{intervals.map((interval) => (
@@ -30,7 +32,7 @@ export function IntervalSelector({ intervals, selectedMinutes, onChange }: Props
))}
- Votre prédiction cible la manche qui se clôture à la fin de cette période.
+ {t('candlePredict.interval.hint')}
);
diff --git a/prediqo_web/src/features/candle-predict/components/MultiCandleBettingPanel.tsx b/prediqo_web/src/features/candle-predict/components/MultiCandleBettingPanel.tsx
index 9b91eed2..706a8d64 100644
--- a/prediqo_web/src/features/candle-predict/components/MultiCandleBettingPanel.tsx
+++ b/prediqo_web/src/features/candle-predict/components/MultiCandleBettingPanel.tsx
@@ -16,6 +16,7 @@ import {
import TrendingDownRoundedIcon from '@mui/icons-material/TrendingDownRounded';
import TrendingUpRoundedIcon from '@mui/icons-material/TrendingUpRounded';
import { useEffect, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import type {
CandleDirection,
CandlePredictConfig,
@@ -48,12 +49,13 @@ type Props = {
};
function DirectionChip({ direction }: { direction: CandleDirection }) {
+ const { t } = useTranslation();
const isLong = direction === 'long';
return (
: }
- label={isLong ? 'Long' : 'Short'}
+ label={isLong ? t('candlePredict.betting.long') : t('candlePredict.betting.short')}
color={isLong ? 'success' : 'error'}
sx={{ fontWeight: 800 }}
/>
@@ -79,6 +81,7 @@ export function MultiCandleBettingPanel({
submitting,
error,
}: Props) {
+ const { t } = useTranslation();
const enabledLevels = useMemo(
() => [...levels].filter((l) => l.enabled).sort((a, b) => a.sortOrder - b.sortOrder),
[levels]
@@ -128,11 +131,15 @@ export function MultiCandleBettingPanel({
>
- Multi-candle prediction in progress
+ {t('candlePredict.multiBetting.inProgress')}
- Level {activeBet.level} · stake {activeBet.stakeDisplay} · validating candle{' '}
- {step + 1} of {total}
+ {t('candlePredict.multiBetting.progress', {
+ level: activeBet.level,
+ stake: activeBet.stakeDisplay,
+ current: step + 1,
+ total,
+ })}
{activeBet.sequenceDirections.map((dir, i) => (
@@ -141,7 +148,7 @@ export function MultiCandleBettingPanel({
{i < step ? (
) : i === step ? (
-
+
) : (
)}
@@ -149,8 +156,7 @@ export function MultiCandleBettingPanel({
))}
- One wrong candle ends the sequence immediately. Your stake stays pending until the final
- candle is validated.
+ {t('candlePredict.multiBetting.progressAlert')}
@@ -169,38 +175,38 @@ export function MultiCandleBettingPanel({
- Multi-candle prediction
+ {t('candlePredict.multiBetting.title')}
- Predict {level} consecutive candles in exact order. Minimum level 2 — use single mode for
- one candle.
+ {t('candlePredict.multiBetting.hint')}
{!enabledLevels.length && (
- No multi-candle levels are currently available.
+ {t('candlePredict.multiBetting.noLevels')}
)}
{hasSinglePrediction && (
-
- You already have a single-candle prediction for this round (including auto). Multi-candle
- is unavailable until the next window.
-
+ {t('candlePredict.multiBetting.singleBlocksMulti')}
)}
{enabledLevels.length > 0 && (
<>
- Level
+ {t('candlePredict.multiBetting.level')}
setLevel(Number(e.target.value))}
disabled={!predictionOpen}
>
{enabledLevels.map((l) => (
))}
@@ -208,7 +214,7 @@ export function MultiCandleBettingPanel({
- Your sequence
+ {t('candlePredict.multiBetting.yourSequence')}
{sequence.map((dir, index) => (
@@ -219,7 +225,7 @@ export function MultiCandleBettingPanel({
sx={{ alignItems: { sm: 'center' } }}
>
- Candle {index + 1}
+ {t('candlePredict.multiBetting.candleN', { n: index + 1 })}
- Short
+ {t('candlePredict.betting.short')}
- Long
+ {t('candlePredict.betting.long')}
@@ -253,7 +259,7 @@ export function MultiCandleBettingPanel({
- Stake amount
+ {t('candlePredict.betting.stake')}
{config.stakeAmounts.map((amount) => (
@@ -284,7 +290,10 @@ export function MultiCandleBettingPanel({
{levelConfig && (
- Gain en cas de succès : mise × {levelConfig.payoutMultiplier} ({interval.label}).
+ {t('candlePredict.multiBetting.winHint', {
+ multiplier: levelConfig.payoutMultiplier,
+ interval: interval.label,
+ })}
)}
@@ -307,7 +316,9 @@ export function MultiCandleBettingPanel({
background: `linear-gradient(90deg, ${alpha('#5EB2D6', 0.9)}, ${alpha('#D6B25E', 0.85)})`,
}}
>
- {submitting ? 'Placing…' : `Place level ${level} prediction`}
+ {submitting
+ ? t('candlePredict.multiBetting.placing')
+ : t('candlePredict.multiBetting.placeLevel', { level })}
>
)}
diff --git a/prediqo_web/src/features/candle-predict/components/PoolBar.tsx b/prediqo_web/src/features/candle-predict/components/PoolBar.tsx
index 3104cbcc..72d0d1a0 100644
--- a/prediqo_web/src/features/candle-predict/components/PoolBar.tsx
+++ b/prediqo_web/src/features/candle-predict/components/PoolBar.tsx
@@ -1,6 +1,6 @@
import { Box, LinearProgress, Stack, Typography, alpha } from '@mui/material';
+import { useTranslation } from 'react-i18next';
import type { CandlePredictRound, PoolWinnerRule } from '../types';
-import { poolWinnerRulePoolHint } from '../utils/poolWinnerRule';
type Props = {
round: CandlePredictRound | null;
@@ -9,17 +9,19 @@ type Props = {
/** Live Short vs Long stake pool visualization. */
export function PoolBar({ round, poolWinnerRule }: Props) {
+ const { t } = useTranslation();
+
if (!round) return null;
const shortPool = round.shortPool ?? 0;
const longPool = round.longPool ?? 0;
const total = shortPool + longPool;
const hasAmounts = total > 0;
- const shortPct = hasAmounts
- ? (shortPool / total) * 100
- : (round.shortPoolPercent ?? 50);
- const longPct = hasAmounts
- ? (longPool / total) * 100
- : (round.longPoolPercent ?? 50);
+ const shortPct = hasAmounts ? (shortPool / total) * 100 : (round.shortPoolPercent ?? 50);
+ const longPct = hasAmounts ? (longPool / total) * 100 : (round.longPoolPercent ?? 50);
+ const winner =
+ poolWinnerRule === 'majority'
+ ? t('candlePredict.poolBar.winnerMajority')
+ : t('candlePredict.poolBar.winnerMinority');
return (
- Stake pools
+ {t('candlePredict.poolBar.title')}
- Short (bearish)
+ {t('candlePredict.direction.shortBearish')}
{hasAmounts ? `${shortPool.toFixed(0)} · ` : ''}
@@ -58,7 +60,7 @@ export function PoolBar({ round, poolWinnerRule }: Props) {
- Long (bullish)
+ {t('candlePredict.direction.longBullish')}
{hasAmounts ? `${longPool.toFixed(0)} · ` : ''}
@@ -78,7 +80,7 @@ export function PoolBar({ round, poolWinnerRule }: Props) {
- {poolWinnerRulePoolHint(poolWinnerRule)}
+ {t('candlePredict.poolBar.hint', { winner })}
);
diff --git a/prediqo_web/src/features/candle-predict/components/RecentPredictionsPanel.tsx b/prediqo_web/src/features/candle-predict/components/RecentPredictionsPanel.tsx
index ba1deb52..be37cfa9 100644
--- a/prediqo_web/src/features/candle-predict/components/RecentPredictionsPanel.tsx
+++ b/prediqo_web/src/features/candle-predict/components/RecentPredictionsPanel.tsx
@@ -17,7 +17,9 @@ import {
} from '@mui/material';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
+import type { TFunction } from 'i18next';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { ScrollableTable } from '../../../shared/components/ScrollableTable';
import {
PREDICTIONS_PAGE_SIZE,
@@ -26,7 +28,6 @@ import {
import type { CandleDirection, CandlePredictPrediction, StakeAccountKind } from '../types';
type Props = {
- /** Refetch when a new prediction is placed (manual or auto). */
refreshKey?: string | null;
autoPredictionEnabled?: boolean;
roundStatus?: string;
@@ -63,39 +64,27 @@ function statusColor(status: CandlePredictPrediction['status']): string {
}
}
-function StatusLabel({ status }: { status: CandlePredictPrediction['status'] }) {
+function formatStatus(t: TFunction, status: CandlePredictPrediction['status']): string {
+ const key = `candlePredict.recentPredictions.status.${status}` as const;
+ return t(key, { defaultValue: status });
+}
+
+function StatusLabel({ status, t }: { status: CandlePredictPrediction['status']; t: TFunction }) {
return (
- {formatStatus(status)}
+ {formatStatus(t, status)}
);
}
-function formatStatus(status: CandlePredictPrediction['status']): string {
- switch (status) {
- case 'pending':
- return 'Pending';
- case 'in_progress':
- return 'In progress';
- case 'won':
- return 'Won';
- case 'lost':
- return 'Lost';
- case 'refunded':
- return 'Refunded';
- default:
- return status;
- }
-}
-
-function formatStakeAccount(kind: StakeAccountKind): string {
+function formatStakeAccount(t: TFunction, kind: StakeAccountKind): string {
switch (kind) {
case 'bonus':
- return 'Bonus';
+ return t('candlePredict.stakeWallet.bonus');
case 'test':
- return 'Test';
+ return t('candlePredict.stakeWallet.test');
default:
- return 'Main';
+ return t('candlePredict.stakeWallet.main');
}
}
@@ -109,12 +98,17 @@ function formatTime(date: Date): string {
return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
}
-function formatCandlePeriod(prediction: CandlePredictPrediction): {
+function formatCandlePeriod(
+ t: TFunction,
+ prediction: CandlePredictPrediction
+): {
range: string;
placedAt: string;
detail?: string;
} {
- const placedAt = formatTime(new Date(prediction.createdAt));
+ const placedAt = t('candlePredict.recentPredictions.placed', {
+ time: formatTime(new Date(prediction.createdAt)),
+ });
if (isMultiPrediction(prediction)) {
const count = multiCandleCount(prediction);
@@ -124,9 +118,7 @@ function formatCandlePeriod(prediction: CandlePredictPrediction): {
prediction.currentCandleOpenMs;
if (anchorMs != null && count > 0) {
const open = new Date(anchorMs);
- const close = new Date(
- anchorMs + count * prediction.intervalMinutes * 60 * 1000
- );
+ const close = new Date(anchorMs + count * prediction.intervalMinutes * 60 * 1000);
const today = new Date();
const showDate =
open.toDateString() !== today.toDateString() ||
@@ -136,20 +128,26 @@ function formatCandlePeriod(prediction: CandlePredictPrediction): {
: '';
return {
range: `${dateLabel}${formatTime(open)} – ${formatTime(close)}`,
- placedAt: `Placed ${placedAt}`,
- detail: `${count} consecutive candles · ${prediction.intervalMinutes}m each`,
+ placedAt,
+ detail: t('candlePredict.recentPredictions.multiPeriod', {
+ count,
+ minutes: prediction.intervalMinutes,
+ }),
};
}
return {
- range: `Multi · ${count} × ${prediction.intervalMinutes}m`,
- placedAt: `Placed ${placedAt}`,
+ range: t('candlePredict.recentPredictions.multiPeriodShort', {
+ count,
+ minutes: prediction.intervalMinutes,
+ }),
+ placedAt,
};
}
if (prediction.candleOpenMs == null) {
return {
range: `${prediction.intervalMinutes}m`,
- placedAt: `Placed ${placedAt}`,
+ placedAt,
};
}
@@ -166,37 +164,37 @@ function formatCandlePeriod(prediction: CandlePredictPrediction): {
return {
range: `${dateLabel}${formatTime(open)} – ${formatTime(close)}`,
- placedAt: `Placed ${placedAt}`,
+ placedAt,
};
}
-function multiProgressDetail(p: CandlePredictPrediction): string | null {
+function multiProgressDetail(t: TFunction, p: CandlePredictPrediction): string | null {
if (!isMultiPrediction(p)) return null;
const total = multiCandleCount(p);
if (total <= 0) return null;
const step = p.sequenceStep ?? 0;
if (p.status === 'lost') {
- return `Failed on candle ${step + 1} of ${total}`;
+ return t('candlePredict.recentPredictions.multiFailed', { current: step + 1, total });
}
if (p.status === 'won') {
- return `All ${total} candles validated`;
+ return t('candlePredict.recentPredictions.multiWon', { total });
}
if (p.status === 'in_progress' || p.status === 'pending') {
- return `Validating candle ${step + 1} of ${total}`;
+ return t('candlePredict.recentPredictions.multiValidating', { current: step + 1, total });
}
if (p.status === 'refunded') {
- return `Sequence refunded (${total} candles)`;
+ return t('candlePredict.recentPredictions.multiRefunded', { total });
}
return null;
}
-function ModeChip({ prediction }: { prediction: CandlePredictPrediction }) {
+function ModeChip({ prediction, t }: { prediction: CandlePredictPrediction; t: TFunction }) {
if (isMultiPrediction(prediction)) {
const level = prediction.level ?? multiCandleCount(prediction);
return (
{prediction.isAuto && (
)
}
- label={isShort ? 'Short' : 'Long'}
+ label={isShort ? t('candlePredict.betting.short') : t('candlePredict.betting.long')}
sx={{
fontWeight: 800,
fontSize: 11,
@@ -257,7 +255,13 @@ function DirectionChip({ direction }: { direction: CandleDirection }) {
);
}
-function DirectionCell({ direction }: { direction: CandlePredictPrediction['direction'] }) {
+function DirectionCell({
+ direction,
+ t,
+}: {
+ direction: CandlePredictPrediction['direction'];
+ t: TFunction;
+}) {
const isShort = direction === 'short';
const color = isShort ? SHORT_COLOR : LONG_COLOR;
@@ -268,17 +272,17 @@ function DirectionCell({ direction }: { direction: CandlePredictPrediction['dire
) : (
)}
- {isShort ? 'Short' : 'Long'}
+ {isShort ? t('candlePredict.betting.short') : t('candlePredict.betting.long')}
);
}
-function MultiSequenceRow({ prediction }: { prediction: CandlePredictPrediction }) {
+function MultiSequenceRow({ prediction, t }: { prediction: CandlePredictPrediction; t: TFunction }) {
const sequence = prediction.sequenceDirections ?? [];
const step = prediction.sequenceStep ?? 0;
if (!sequence.length) {
- return ;
+ return ;
}
const markerForIndex = (i: number): { label: string; color: 'success' | 'error' | 'warning' | 'default' } => {
@@ -298,6 +302,8 @@ function MultiSequenceRow({ prediction }: { prediction: CandlePredictPrediction
return { label: `${i + 1}`, color: 'default' };
};
+ const progressDetail = multiProgressDetail(t, prediction);
+
return (
@@ -309,7 +315,7 @@ function MultiSequenceRow({ prediction }: { prediction: CandlePredictPrediction
{i + 1}.
-
+
- {multiProgressDetail(prediction) && (
+ {progressDetail && (
- {multiProgressDetail(prediction)}
+ {progressDetail}
)}
);
}
-function PredictionCell({ prediction }: { prediction: CandlePredictPrediction }) {
+function PredictionCell({ prediction, t }: { prediction: CandlePredictPrediction; t: TFunction }) {
if (isMultiPrediction(prediction)) {
- return ;
+ return ;
}
- return ;
+ return ;
}
function PeriodCell({
@@ -391,6 +397,7 @@ export function RecentPredictionsPanel({
roundStatus,
intervalMinutes,
}: Props) {
+ const { t } = useTranslation();
const theme = useTheme();
const isCompact = useMediaQuery(theme.breakpoints.down('md'));
@@ -414,6 +421,7 @@ export function RecentPredictionsPanel({
const items = predictionsQ.data?.items ?? [];
const total = predictionsQ.data?.total ?? 0;
+ const cols = 'candlePredict.recentPredictions.columns';
return (
@@ -424,10 +432,13 @@ export function RecentPredictionsPanel({
sx={{ alignItems: 'center', justifyContent: 'space-between', mb: 1.5, flexWrap: 'wrap' }}
>
- Recent predictions
+ {t('candlePredict.recentPredictions.title')}
- {total} total · {PREDICTIONS_PAGE_SIZE} per page
+ {t('candlePredict.recentPredictions.totalPerPage', {
+ total,
+ size: PREDICTIONS_PAGE_SIZE,
+ })}
@@ -437,8 +448,9 @@ export function RecentPredictionsPanel({
<>
{items.map((p) => {
- const period = formatCandlePeriod(p);
- const progressDetail = multiProgressDetail(p);
+ const period = formatCandlePeriod(t, p);
+ const progressDetail = multiProgressDetail(t, p);
+ const payout = p.payoutDisplay > 0 ? p.payoutDisplay : '—';
return (
-
+
}
+ label={}
size="small"
variant="outlined"
sx={{
@@ -473,7 +485,7 @@ export function RecentPredictionsPanel({
-
+
@@ -485,8 +497,11 @@ export function RecentPredictionsPanel({
)}
- {period.placedAt} · Stake {p.stakeDisplay} · Payout{' '}
- {p.payoutDisplay > 0 ? p.payoutDisplay : '—'}
+ {t('candlePredict.recentPredictions.stakeLine', {
+ placed: period.placedAt,
+ stake: p.stakeDisplay,
+ payout,
+ })}
{progressDetail && !isMultiPrediction(p) && (
@@ -497,7 +512,9 @@ export function RecentPredictionsPanel({
);
})}
{!items.length && (
- No predictions yet
+
+ {t('candlePredict.recentPredictions.empty')}
+
)}
@@ -519,23 +536,23 @@ export function RecentPredictionsPanel({
- Mode
- Prediction
- Period
+ {t(`${cols}.mode`)}
+ {t(`${cols}.prediction`)}
+ {t(`${cols}.period`)}
- Stake
+ {t(`${cols}.stake`)}
- Account
- Status
+ {t(`${cols}.account`)}
+ {t(`${cols}.status`)}
- Payout
+ {t(`${cols}.payout`)}
{items.map((p) => {
- const period = formatCandlePeriod(p);
- const progressDetail = multiProgressDetail(p);
+ const period = formatCandlePeriod(t, p);
+ const progressDetail = multiProgressDetail(t, p);
return (
-
+
-
+
@@ -559,7 +576,7 @@ export function RecentPredictionsPanel({
-
+
{progressDetail && (
- No predictions yet
+ {t('candlePredict.recentPredictions.empty')}
)}
@@ -614,7 +631,7 @@ export function RecentPredictionsPanel({
{predictionsQ.isError && (
- Could not load predictions. Try refreshing the page.
+ {t('candlePredict.recentPredictions.loadError')}
)}
diff --git a/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx b/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx
index 22b0acb8..254580c3 100644
--- a/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx
+++ b/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx
@@ -14,6 +14,7 @@ import {
Typography,
alpha,
} from '@mui/material';
+import { useTranslation } from 'react-i18next';
import type { StakeAccountKind } from '../types';
const MASK = '••••••';
@@ -94,6 +95,11 @@ export function StakeWalletBalanceBar({
onToggleVisibility,
loading,
}: Props) {
+ const { t } = useTranslation();
+ const visibilityLabel = balancesVisible
+ ? t('candlePredict.stakeWallet.hideBalances')
+ : t('candlePredict.stakeWallet.showBalances');
+
return (
- Vos portefeuilles de mise
+ {t('candlePredict.stakeWallet.barTitle')}
-
+
{balancesVisible ? (
@@ -151,7 +157,7 @@ export function StakeWalletBalanceBar({
}}
>
}
accent="#D6B25E"
@@ -159,7 +165,7 @@ export function StakeWalletBalanceBar({
hidden={!balancesVisible}
/>
}
accent="#7C5CFF"
@@ -167,7 +173,7 @@ export function StakeWalletBalanceBar({
hidden={!balancesVisible}
/>
}
accent="#4CAF50"
diff --git a/prediqo_web/src/features/candle-predict/components/StakeWalletSelector.tsx b/prediqo_web/src/features/candle-predict/components/StakeWalletSelector.tsx
index 0a188a92..51f7d55a 100644
--- a/prediqo_web/src/features/candle-predict/components/StakeWalletSelector.tsx
+++ b/prediqo_web/src/features/candle-predict/components/StakeWalletSelector.tsx
@@ -1,4 +1,5 @@
-import { FormControl, InputLabel, MenuItem, Select, Typography } from '@mui/material';
+import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
+import { Trans, useTranslation } from 'react-i18next';
export type StakeAccountKind = 'main' | 'bonus' | 'test';
@@ -22,28 +23,36 @@ export function StakeWalletSelector({
disabled,
size = 'small',
}: Props) {
+ const { t } = useTranslation();
+
return (
- Stake wallet
+ {t('candlePredict.stakeWalletSelector.label')}
onChange(e.target.value as StakeAccountKind)}
>
diff --git a/prediqo_web/src/features/candle-predict/components/TestModeBanner.tsx b/prediqo_web/src/features/candle-predict/components/TestModeBanner.tsx
index be1d977e..61d4ea5d 100644
--- a/prediqo_web/src/features/candle-predict/components/TestModeBanner.tsx
+++ b/prediqo_web/src/features/candle-predict/components/TestModeBanner.tsx
@@ -1,8 +1,10 @@
import ScienceRoundedIcon from '@mui/icons-material/ScienceRounded';
import { Alert, Stack, Typography } from '@mui/material';
+import { useTranslation } from 'react-i18next';
/** Prominent banner when stakes use the play-money test wallet. */
export function TestModeBanner() {
+ const { t } = useTranslation();
return (
- Mode test
-
- You are playing with test credits only. Winnings and losses stay in your test wallet — they
- cannot be withdrawn or transferred to your main wallet.
+
+ {t('candlePredict.testMode.title')}
+ {t('candlePredict.testMode.hint')}
);
diff --git a/prediqo_web/src/features/candle-predict/utils/stakeAmountInput.ts b/prediqo_web/src/features/candle-predict/utils/stakeAmountInput.ts
index 31aed44e..dbb6de3b 100644
--- a/prediqo_web/src/features/candle-predict/utils/stakeAmountInput.ts
+++ b/prediqo_web/src/features/candle-predict/utils/stakeAmountInput.ts
@@ -41,6 +41,37 @@ export function parseStakeAmountInput(
return { ok: true, value };
}
+export function stakeAmountFormatErrorCode(
+ raw: string,
+ options?: { whileTyping?: boolean }
+): 'required' | 'invalidFormat' | 'zero' | 'invalid' | null {
+ const s = raw.trim();
+ const whileTyping = options?.whileTyping ?? false;
+
+ if (!s) return whileTyping ? null : 'required';
+
+ if (!isPartialStakeAmountInput(s)) return 'invalidFormat';
+
+ if (isValidStakeAmountFormat(s)) return null;
+
+ if (whileTyping && isIncompleteStakeAmountInput(s)) return null;
+
+ if (/^0(\.0*)?$/.test(s)) return 'zero';
+
+ return 'invalid';
+}
+
+export function stakeAmountRangeErrorCode(
+ raw: string,
+ minStake: number,
+ maxStake: number
+): 'outOfRange' | null {
+ const parsed = parseStakeAmountInput(raw);
+ if (!parsed.ok) return null;
+ if (parsed.value < minStake || parsed.value > maxStake) return 'outOfRange';
+ return null;
+}
+
export function stakeAmountFormatError(
raw: string,
options?: { whileTyping?: boolean }
diff --git a/prediqo_web/src/features/catalog/CandlePredictConfigPanel.tsx b/prediqo_web/src/features/catalog/CandlePredictConfigPanel.tsx
index 495d1818..df404746 100644
--- a/prediqo_web/src/features/catalog/CandlePredictConfigPanel.tsx
+++ b/prediqo_web/src/features/catalog/CandlePredictConfigPanel.tsx
@@ -14,6 +14,7 @@ import {
} from '@mui/material';
import SaveRoundedIcon from '@mui/icons-material/SaveRounded';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import {
useAdminCandleConfig,
useUpdateAdminCandleConfig,
@@ -21,11 +22,10 @@ import {
import { CandlePredictIntervalsPanel } from './CandlePredictIntervalsPanel';
import { CandlePredictMultiLevelsPanel } from './CandlePredictMultiLevelsPanel';
import type { PoolWinnerRule } from '../candle-predict/types';
-import { NEUTRAL_ROUND_BEHAVIOR } from '../candle-predict/utils/poolNeutrality';
-import { poolWinnerRuleDescription } from '../candle-predict/utils/poolWinnerRule';
/** Admin panel to configure Candle Predict global rules and time intervals. */
export function CandlePredictConfigPanel() {
+ const { t } = useTranslation();
const configQ = useAdminCandleConfig();
const saveMut = useUpdateAdminCandleConfig();
const [form, setForm] = useState({
@@ -47,7 +47,9 @@ export function CandlePredictConfigPanel() {
predictionAutoEnabled: true,
predictionMultiEnabled: true,
});
- const [message, setMessage] = useState(null);
+ const [feedback, setFeedback] = useState<{ severity: 'success' | 'error'; text: string } | null>(
+ null
+ );
useEffect(() => {
if (configQ.data) {
@@ -97,7 +99,7 @@ export function CandlePredictConfigPanel() {
.filter((n) => !Number.isNaN(n) && n > 0);
const save = async () => {
- setMessage(null);
+ setFeedback(null);
try {
await saveMut.mutateAsync({
stakeAmounts: parseNums(form.stakeAmounts),
@@ -120,23 +122,35 @@ export function CandlePredictConfigPanel() {
multiCandle: form.predictionMultiEnabled,
},
});
- setMessage('Configuration saved');
+ setFeedback({
+ severity: 'success',
+ text: t('admin.catalog.candlePredict.config.configSaved'),
+ });
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } } };
- setMessage(err?.response?.data?.error ?? 'Save failed');
+ setFeedback({
+ severity: 'error',
+ text: err?.response?.data?.error ?? t('admin.catalog.candlePredict.config.saveFailed'),
+ });
}
};
- if (configQ.isLoading) return Loading game config…;
+ const poolWinnerDesc =
+ form.poolWinnerRule === 'majority'
+ ? t('admin.catalog.candlePredict.config.poolWinnerMajorityDesc')
+ : t('admin.catalog.candlePredict.config.poolWinnerMinorityDesc');
+
+ if (configQ.isLoading) {
+ return {t('admin.catalog.candlePredict.config.loading')};
+ }
return (
- Global settings
+ {t('admin.catalog.candlePredict.config.globalTitle')}
- Synthetic candles are generated from player stake pools — no real market data. Interval-specific
- overrides are managed below; empty fields inherit these defaults.
+ {t('admin.catalog.candlePredict.config.globalIntro')}
- {message && (
-
- {message}
+ {feedback && (
+
+ {feedback.text}
)}
setForm({ ...form, stakeAmounts: e.target.value })}
fullWidth
- helperText="Quick-pick buttons for players — each value must be within min/max below"
+ helperText={t('admin.catalog.candlePredict.config.stakeAmountsHint')}
/>
setForm({ ...form, minStakeAmount: Number(e.target.value) })}
fullWidth
- helperText="Lowest amount allowed in free-form stake field (e.g. 0.01 for cents)"
+ helperText={t('admin.catalog.candlePredict.config.minStakeHint')}
/>
setForm({ ...form, predictionWindowSeconds: Number(e.target.value) })}
fullWidth
- helperText="Default seconds before each candle close to place predictions"
+ helperText={t('admin.catalog.candlePredict.config.predictionWindowHint')}
/>
- Neutral round rules
+ {t('admin.catalog.candlePredict.config.neutralTitle')}
- {NEUTRAL_ROUND_BEHAVIOR} Use the rules below to declare a round neutral when pools are
- too balanced or too one-sided.
+ {t('admin.catalog.candlePredict.config.neutralBehavior')}
setForm({ ...form, tieTolerancePercent: Number(e.target.value) })}
fullWidth
- helperText="Neutral when |Long% − Short%| ≤ this value (e.g. 49/51 at 2%)"
+ helperText={t('admin.catalog.candlePredict.config.minToleranceHint')}
/>
setForm({ ...form, tieToleranceMinEnabled: e.target.checked })}
/>
}
- label="Enable min tolerance rule"
+ label={t('admin.catalog.candlePredict.config.enableMinTolerance')}
/>
setForm({ ...form, tieToleranceMaxPercent: Number(e.target.value) })}
fullWidth
- helperText="Neutral when largest pool ≥ this value (e.g. 95/5 at 95%)"
+ helperText={t('admin.catalog.candlePredict.config.maxToleranceHint')}
/>
setForm({ ...form, tieToleranceMaxEnabled: e.target.checked })}
/>
}
- label="Enable max tolerance rule"
+ label={t('admin.catalog.candlePredict.config.enableMaxTolerance')}
/>
- Pool winner rule
+
+ {t('admin.catalog.candlePredict.config.poolWinnerRule')}
+
setForm({ ...form, poolWinnerRule: e.target.value as PoolWinnerRule })
}
>
-
-
+
+
- {poolWinnerRuleDescription(form.poolWinnerRule)} Applied immediately to new settlements.
+ {poolWinnerDesc} {t('admin.catalog.candlePredict.config.poolWinnerApplied')}
setForm({ ...form, basePrice: Number(e.target.value) })}
fullWidth
/>
setForm({ ...form, poolMultiplier: Number(e.target.value) })}
fullWidth
- helperText="Stake weight in Long/Short pools (single, auto, multi final candle)"
+ helperText={t('admin.catalog.candlePredict.config.poolMultiplierHint')}
/>
setForm({ ...form, payoutMultiplier: Number(e.target.value) })}
fullWidth
- helperText="Win payout for correct predictions — independent from pool weight"
+ helperText={t('admin.catalog.candlePredict.config.payoutMultiplierHint')}
/>
setForm({ ...form, walletTypeCode: e.target.value })}
fullWidth
@@ -282,15 +301,15 @@ export function CandlePredictConfigPanel() {
onChange={(e) => setForm({ ...form, isActive: e.target.checked })}
/>
}
- label="Game active"
+ label={t('admin.catalog.candlePredict.config.gameActive')}
sx={{ gridColumn: { md: '1 / -1' } }}
/>
- Prediction modes
+ {t('admin.catalog.candlePredict.config.modesTitle')}
- Enable or disable each prediction type independently. Disabled modes are hidden from players.
+ {t('admin.catalog.candlePredict.config.modesIntro')}
setForm({ ...form, predictionSingleEnabled: e.target.checked })}
/>
}
- label="Single-candle predictions"
+ label={t('admin.catalog.candlePredict.config.singleEnabled')}
/>
setForm({ ...form, predictionAutoEnabled: e.target.checked })}
/>
}
- label="Auto predictions"
+ label={t('admin.catalog.candlePredict.config.autoEnabled')}
/>
setForm({ ...form, predictionMultiEnabled: e.target.checked })}
/>
}
- label="Multi-candle predictions"
+ label={t('admin.catalog.candlePredict.config.multiEnabled')}
/>
- } onClick={() => void save()} disabled={saveMut.isPending}>
- Save global config
+ }
+ onClick={() => void save()}
+ disabled={saveMut.isPending}
+ >
+ {t('admin.catalog.candlePredict.config.saveGlobal')}
- Prediction intervals
+ {t('admin.catalog.candlePredict.config.intervalsTitle')}
diff --git a/prediqo_web/src/features/catalog/CandlePredictIntervalsPanel.tsx b/prediqo_web/src/features/catalog/CandlePredictIntervalsPanel.tsx
index f3ce298e..729b9bf8 100644
--- a/prediqo_web/src/features/catalog/CandlePredictIntervalsPanel.tsx
+++ b/prediqo_web/src/features/catalog/CandlePredictIntervalsPanel.tsx
@@ -27,6 +27,7 @@ import AddRoundedIcon from '@mui/icons-material/AddRounded';
import DeleteOutlineRoundedIcon from '@mui/icons-material/DeleteOutlineRounded';
import EditRoundedIcon from '@mui/icons-material/EditRounded';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { ScrollableTable } from '../../shared/components/ScrollableTable';
import {
useAdminCandleIntervals,
@@ -105,6 +106,7 @@ function triToBody(value: TriBool): boolean | null | undefined {
/** Admin CRUD for Candle Predict time intervals (rounds + chart candles per period). */
export function CandlePredictIntervalsPanel() {
+ const { t } = useTranslation();
const intervalsQ = useAdminCandleIntervals();
const createMut = useCreateAdminCandleInterval();
const updateMut = useUpdateAdminCandleInterval();
@@ -114,7 +116,9 @@ export function CandlePredictIntervalsPanel() {
open: false,
});
const [form, setForm] = useState(emptyForm());
- const [message, setMessage] = useState(null);
+ const [feedback, setFeedback] = useState<{ severity: 'success' | 'error'; text: string } | null>(
+ null
+ );
const openCreate = () => {
setForm(emptyForm());
@@ -133,18 +137,25 @@ export function CandlePredictIntervalsPanel() {
};
const save = async () => {
- setMessage(null);
+ setFeedback(null);
const windowVal = parseOptional(form.predictionWindowSeconds);
if (windowVal != null) {
if (windowVal < 5) {
- setMessage('Prediction window must be at least 5 seconds');
+ setFeedback({
+ severity: 'error',
+ text: t('admin.catalog.candlePredict.intervals.windowMinError'),
+ });
return;
}
const max = maxPredictionWindowSeconds(form.intervalMinutes);
if (windowVal > max) {
- setMessage(
- `Prediction window cannot exceed ${formatWindowLimit(form.intervalMinutes)} for a ${form.intervalMinutes}-minute interval`
- );
+ setFeedback({
+ severity: 'error',
+ text: t('admin.catalog.candlePredict.intervals.windowMaxError', {
+ max: formatWindowLimit(form.intervalMinutes),
+ minutes: form.intervalMinutes,
+ }),
+ });
return;
}
}
@@ -169,30 +180,47 @@ export function CandlePredictIntervalsPanel() {
try {
if (dialog.editing) {
await updateMut.mutateAsync({ id: dialog.editing.id, body });
- setMessage('Interval updated');
+ setFeedback({
+ severity: 'success',
+ text: t('admin.catalog.candlePredict.intervals.intervalUpdated'),
+ });
} else {
await createMut.mutateAsync(body);
- setMessage('Interval created');
+ setFeedback({
+ severity: 'success',
+ text: t('admin.catalog.candlePredict.intervals.intervalCreated'),
+ });
}
setDialog({ open: false });
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } } };
- setMessage(err?.response?.data?.error ?? 'Save failed');
+ setFeedback({
+ severity: 'error',
+ text: err?.response?.data?.error ?? t('admin.catalog.candlePredict.config.saveFailed'),
+ });
}
};
const remove = async (row: CandlePredictInterval) => {
- setMessage(null);
+ setFeedback(null);
try {
await deleteMut.mutateAsync(row.id);
- setMessage('Interval deleted');
+ setFeedback({
+ severity: 'success',
+ text: t('admin.catalog.candlePredict.intervals.intervalDeleted'),
+ });
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } } };
- setMessage(err?.response?.data?.error ?? 'Delete failed');
+ setFeedback({
+ severity: 'error',
+ text: err?.response?.data?.error ?? t('admin.catalog.candlePredict.intervals.deleteFailed'),
+ });
}
};
- if (intervalsQ.isLoading) return Loading intervals…;
+ if (intervalsQ.isLoading) {
+ return {t('admin.catalog.candlePredict.intervals.loading')};
+ }
const rows = intervalsQ.data ?? [];
const windowMaxLabel = formatWindowLimit(form.intervalMinutes);
@@ -210,9 +238,7 @@ export function CandlePredictIntervalsPanel() {
sx={{ alignItems: { sm: 'center' }, mb: 2 }}
>
- Each interval has its own rounds and candle chart. Players pick a period; predictions are
- deferred to the matching round at candle close. Leave override fields empty to inherit
- global defaults.
+ {t('admin.catalog.candlePredict.intervals.intro')}
- {message && (
-
- {message}
+ {feedback && (
+
+ {feedback.text}
)}
@@ -238,17 +261,17 @@ export function CandlePredictIntervalsPanel() {
- Order
- Label
- Minutes
- Window (s)
- Min tie %
- Max tie %
- Pool
- Payout
- Initial batch
- Status
- Actions
+ {t('admin.catalog.candlePredict.intervals.columns.order')}
+ {t('admin.catalog.candlePredict.intervals.columns.label')}
+ {t('admin.catalog.candlePredict.intervals.columns.minutes')}
+ {t('admin.catalog.candlePredict.intervals.columns.window')}
+ {t('admin.catalog.candlePredict.intervals.columns.minTie')}
+ {t('admin.catalog.candlePredict.intervals.columns.maxTie')}
+ {t('admin.catalog.candlePredict.intervals.columns.pool')}
+ {t('admin.catalog.candlePredict.intervals.columns.payout')}
+ {t('admin.catalog.candlePredict.intervals.columns.initialBatch')}
+ {t('admin.catalog.candlePredict.intervals.columns.status')}
+ {t('admin.catalog.candlePredict.intervals.columns.actions')}
@@ -258,7 +281,12 @@ export function CandlePredictIntervalsPanel() {
{row.label}
{row.isDefault && (
-
+
)}
{row.intervalMinutes}
@@ -271,7 +299,11 @@ export function CandlePredictIntervalsPanel() {
@@ -288,7 +320,7 @@ export function CandlePredictIntervalsPanel() {
{!rows.length && (
- No intervals configured
+ {t('admin.catalog.candlePredict.intervals.noIntervals')}
)}
@@ -298,11 +330,15 @@ export function CandlePredictIntervalsPanel() {
diff --git a/prediqo_web/src/features/catalog/CandlePredictMultiLevelsPanel.tsx b/prediqo_web/src/features/catalog/CandlePredictMultiLevelsPanel.tsx
index affb0654..d5cbd81f 100644
--- a/prediqo_web/src/features/catalog/CandlePredictMultiLevelsPanel.tsx
+++ b/prediqo_web/src/features/catalog/CandlePredictMultiLevelsPanel.tsx
@@ -15,6 +15,7 @@ import {
} from '@mui/material';
import SaveRoundedIcon from '@mui/icons-material/SaveRounded';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import {
useAdminMultiLevels,
useUpdateAdminMultiLevels,
@@ -24,10 +25,13 @@ import { ScrollableTable } from '../../shared/components/ScrollableTable';
/** Admin panel for multi-candle level configuration. */
export function CandlePredictMultiLevelsPanel() {
+ const { t } = useTranslation();
const levelsQ = useAdminMultiLevels();
const saveMut = useUpdateAdminMultiLevels();
const [rows, setRows] = useState([]);
- const [message, setMessage] = useState(null);
+ const [feedback, setFeedback] = useState<{ severity: 'success' | 'error'; text: string } | null>(
+ null
+ );
useEffect(() => {
if (levelsQ.data) setRows(levelsQ.data);
@@ -38,13 +42,16 @@ export function CandlePredictMultiLevelsPanel() {
};
const handleSave = async () => {
- setMessage(null);
+ setFeedback(null);
try {
await saveMut.mutateAsync(rows);
- setMessage('Multi-candle levels saved.');
+ setFeedback({
+ severity: 'success',
+ text: t('admin.catalog.candlePredict.multiLevels.saved'),
+ });
} catch (e) {
- const msg = e instanceof Error ? e.message : 'Save failed';
- setMessage(msg);
+ const msg = e instanceof Error ? e.message : t('admin.catalog.candlePredict.multiLevels.saveFailed');
+ setFeedback({ severity: 'error', text: msg });
}
};
@@ -53,18 +60,16 @@ export function CandlePredictMultiLevelsPanel() {
- Multi-candle levels
+ {t('admin.catalog.candlePredict.multiLevels.title')}
- Configure levels from 2 upward. Pool multiplier weights bets in Long/Short pools at the
- final candle; payout multiplier applies only to the player's win when the full
- sequence is correct.
+ {t('admin.catalog.candlePredict.multiLevels.intro')}
- {message && (
- setMessage(null)}>
- {message}
+ {feedback && (
+ setFeedback(null)}>
+ {feedback.text}
)}
@@ -72,12 +77,24 @@ export function CandlePredictMultiLevelsPanel() {
- Level
- Candles
- Enabled
- Pool multiplier
- Payout multiplier
- Sort
+
+ {t('admin.catalog.candlePredict.multiLevels.columns.level')}
+
+
+ {t('admin.catalog.candlePredict.multiLevels.columns.candles')}
+
+
+ {t('admin.catalog.candlePredict.multiLevels.columns.enabled')}
+
+
+ {t('admin.catalog.candlePredict.multiLevels.columns.poolMultiplier')}
+
+
+ {t('admin.catalog.candlePredict.multiLevels.columns.payoutMultiplier')}
+
+
+ {t('admin.catalog.candlePredict.multiLevels.columns.sort')}
+
@@ -138,7 +155,7 @@ export function CandlePredictMultiLevelsPanel() {
onClick={() => void handleSave()}
disabled={saveMut.isPending || levelsQ.isLoading}
>
- Save levels
+ {t('admin.catalog.candlePredict.multiLevels.saveLevels')}
diff --git a/prediqo_web/src/features/catalog/CatalogAdminPage.tsx b/prediqo_web/src/features/catalog/CatalogAdminPage.tsx
index 6accf90c..24074008 100644
--- a/prediqo_web/src/features/catalog/CatalogAdminPage.tsx
+++ b/prediqo_web/src/features/catalog/CatalogAdminPage.tsx
@@ -33,6 +33,7 @@ import SportsEsportsRoundedIcon from '@mui/icons-material/SportsEsportsRounded';
import CandlestickChartRoundedIcon from '@mui/icons-material/CandlestickChartRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader';
import type { Advertisement, AdvertisementInput, Game, GameImplementationOption, GameInput } from '../home/types';
@@ -66,6 +67,7 @@ const emptyAd: AdvertisementInput = {
/** Admin page to CRUD games and home-page advertisements. */
export function CatalogAdminPage() {
+ const { t } = useTranslation();
const [tab, setTab] = useState('games');
const qc = useQueryClient();
@@ -115,7 +117,7 @@ export function CatalogAdminPage() {
},
onError: (e: unknown) => {
const err = e as { response?: { data?: { error?: string } } };
- setError(err?.response?.data?.error ?? 'Failed to save game');
+ setError(err?.response?.data?.error ?? t('admin.catalog.saveGameFailed'));
},
});
@@ -143,7 +145,7 @@ export function CatalogAdminPage() {
},
onError: (e: unknown) => {
const err = e as { response?: { data?: { error?: string } } };
- setError(err?.response?.data?.error ?? 'Failed to save advertisement');
+ setError(err?.response?.data?.error ?? t('admin.catalog.saveAdFailed'));
},
});
@@ -229,15 +231,15 @@ export function CatalogAdminPage() {
return (
}
+ title={t('admin.catalog.title')}
+ subtitle={t('admin.catalog.subtitle')}
+ actions={}
/>
setTab(v)} sx={{ mb: 2 }} variant="scrollable" scrollButtons="auto">
- } iconPosition="start" label="Games" />
- } iconPosition="start" label="Advertisements" />
- } iconPosition="start" label="Candle Predict" />
+ } iconPosition="start" label={t('admin.catalog.tabs.games')} />
+ } iconPosition="start" label={t('admin.catalog.tabs.ads')} />
+ } iconPosition="start" label={t('admin.catalog.tabs.candle')} />
{tab === 'games' && (
@@ -248,10 +250,10 @@ export function CatalogAdminPage() {
onClick={openCreateGame}
sx={{ alignSelf: { xs: 'stretch', sm: 'flex-start' } }}
>
- Add game
+ {t('admin.catalog.addGame')}
{gamesQ.isLoading ? (
- Loading games…
+ {t('admin.catalog.loadingGames')}
) : (
- openEditGame(game)} aria-label="Edit game">
+ openEditGame(game)} aria-label={t('admin.catalog.editGame')}>
@@ -306,12 +308,12 @@ export function CatalogAdminPage() {
variant="outlined"
/>
) : (
-
+
)}
{game.implementationKey && !hasWebImplementation(game.implementationKey) && (
-
+
)}
- {game.isFeatured && }
+ {game.isFeatured && }
@@ -330,10 +332,10 @@ export function CatalogAdminPage() {
onClick={openCreateAd}
sx={{ alignSelf: { xs: 'stretch', sm: 'flex-start' } }}
>
- Add advertisement
+ {t('admin.catalog.addAd')}
{adsQ.isLoading ? (
- Loading advertisements…
+ {t('admin.catalog.loadingAds')}
) : (
-
+
{ad.subtitle && (
@@ -405,19 +407,19 @@ export function CatalogAdminPage() {
fullWidth
maxWidth="sm"
>
- {gameDialog.editing ? 'Edit game' : 'New game'}
+ {gameDialog.editing ? t('admin.catalog.gameDialog.edit') : t('admin.catalog.gameDialog.new')}
{error && {error}}
setGameForm({ ...gameForm, slug: e.target.value })}
fullWidth
required
helperText={
showDefaultSlugAction
- ? `Recommended slug for this implementation: ${selectedImplementation?.defaultSlug}`
+ ? t('admin.catalog.fields.slugRecommended', { slug: selectedImplementation?.defaultSlug })
: undefined
}
/>
@@ -433,18 +435,18 @@ export function CatalogAdminPage() {
}
sx={{ alignSelf: 'flex-start' }}
>
- Use default slug ({selectedImplementation.defaultSlug})
+ {t('admin.catalog.fields.useDefaultSlug', { slug: selectedImplementation.defaultSlug })}
)}
setGameForm({ ...gameForm, title: e.target.value })}
fullWidth
required
/>
setGameForm({ ...gameForm, description: e.target.value })}
fullWidth
@@ -452,27 +454,27 @@ export function CatalogAdminPage() {
minRows={2}
/>
setGameForm({ ...gameForm, category: e.target.value })}
fullWidth
/>
setGameForm({ ...gameForm, thumbnailUrl: e.target.value || null })}
fullWidth
/>
setGameForm({ ...gameForm, accentColor: e.target.value })}
fullWidth
/>
- Implementation
+ {t('admin.catalog.fields.implementation')}
{
const value = e.target.value;
@@ -483,7 +485,7 @@ export function CatalogAdminPage() {
}}
>
{(implementationsQ.data ?? []).map((impl) => (
- Links this catalog entry to a backend game module. Required for playable games.
+ {t('admin.catalog.fields.implementationHint')}
{gameForm.implementationKey && !hasWebImplementation(gameForm.implementationKey) && (
- This implementation has no web UI module yet. Players on web will see a "not
- supported" message until you register it in the frontend.
+ {t('admin.catalog.fields.implementationNoWeb')}
)}
- Status
+ {t('admin.catalog.fields.status')}
setGameForm({ ...gameForm, status: e.target.value as GameInput['status'] })
}
>
-
-
-
+
+
+
setGameForm({ ...gameForm, sortOrder: Number(e.target.value) })}
@@ -529,46 +530,46 @@ export function CatalogAdminPage() {
onChange={(e) => setGameForm({ ...gameForm, isFeatured: e.target.checked })}
/>
}
- label="Featured"
+ label={t('admin.catalog.fields.featured')}
/>
-
+
diff --git a/prediqo_web/src/features/countries/CountriesAdminPage.tsx b/prediqo_web/src/features/countries/CountriesAdminPage.tsx
index 812c8910..59a8ef48 100644
--- a/prediqo_web/src/features/countries/CountriesAdminPage.tsx
+++ b/prediqo_web/src/features/countries/CountriesAdminPage.tsx
@@ -22,6 +22,7 @@ import PublicRoundedIcon from '@mui/icons-material/PublicRounded';
import SyncRoundedIcon from '@mui/icons-material/SyncRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { ScrollableTable } from '../../shared/components/ScrollableTable';
@@ -32,6 +33,7 @@ type CountryRow = {
};
export function CountriesAdminPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [search, setSearch] = useState('');
const [showBlockedOnly, setShowBlockedOnly] = useState(false);
@@ -83,7 +85,7 @@ export function CountriesAdminPage() {
>
- Countries
+ {t('admin.countries.title')}
- Catalog synced from ISO 3166 by default, or from{' '}
+ {t('admin.countries.descriptionBeforeLink')}{' '}
REST Countries v5
{' '}
- when REST_COUNTRIES_API_KEY is configured on the backend. Disable registration
- for specific countries of residence.
+ {t('admin.countries.descriptionAfterLink')}
{syncMut.isSuccess && (
syncMut.reset()}>
- Synced {syncMut.data.synced} countries
- {syncMut.data.source === 'restcountries-v5' ? ' from REST Countries' : ' from ISO 3166'}.
- Total in database: {syncMut.data.total}.
+ {t('admin.countries.syncSuccess', {
+ synced: syncMut.data.synced,
+ total: syncMut.data.total,
+ source:
+ syncMut.data.source === 'restcountries-v5'
+ ? t('admin.countries.syncSourceRest')
+ : t('admin.countries.syncSourceIso'),
+ })}
)}
{syncMut.isError && (
syncMut.reset()}>
{(syncMut.error as { response?: { data?: { error?: string } } })?.response?.data?.error ??
- 'Country sync failed'}
+ t('admin.countries.syncFailed')}
)}
{q.isError && (
- Failed to load countries from the server.
+ {t('admin.countries.loadError')}
)}
{q.data?.total === 0 && (
- No countries in database. Click "Sync from API" to load the catalog.
+ {t('admin.countries.emptyDb')}
)}
@@ -137,14 +143,17 @@ export function CountriesAdminPage() {
setSearch(e.target.value)}
sx={{ flex: 1 }}
/>
- 0 ? 'warning' : 'default'} />
+ 0 ? 'warning' : 'default'}
+ />
- Blocked only
+ {t('admin.countries.blockedOnly')}
setShowBlockedOnly(e.target.checked)} />
@@ -153,9 +162,9 @@ export function CountriesAdminPage() {
- Code
- Name
- Registration
+ {t('admin.countries.code')}
+ {t('admin.countries.name')}
+ {t('admin.countries.registration')}
@@ -177,7 +186,7 @@ export function CountriesAdminPage() {
{filtered.length === 0 && !q.isLoading && (
- No countries match your filters
+ {t('admin.countries.noMatch')}
)}
diff --git a/prediqo_web/src/features/dashboard/DashboardPage.tsx b/prediqo_web/src/features/dashboard/DashboardPage.tsx
index ec62e908..78ed3c0f 100644
--- a/prediqo_web/src/features/dashboard/DashboardPage.tsx
+++ b/prediqo_web/src/features/dashboard/DashboardPage.tsx
@@ -4,6 +4,7 @@
import { Alert, Box, CircularProgress, Skeleton } from '@mui/material';
import dayjs from 'dayjs';
import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import * as XLSX from 'xlsx';
import { DashboardFiltersBar } from './components/DashboardFiltersBar';
import {
@@ -28,6 +29,7 @@ const defaultFilters: DashboardFilters = {
};
export function DashboardPage() {
+ const { t } = useTranslation();
const [filters, setFilters] = useState(defaultFilters);
const [forceRefresh, setForceRefresh] = useState(false);
const [hiddenSections, setHiddenSections] = useState(
@@ -65,22 +67,23 @@ export function DashboardPage() {
const exportData = useCallback(() => {
if (!q.data) return;
const d = q.data;
+ const exp = 'admin.dashboard.export';
const rows = [
- { Catégorie: 'Utilisateurs', Indicateur: 'Total inscrits', Valeur: d.kpis.users.totalUsers },
- { Catégorie: 'Utilisateurs', Indicateur: 'Nouveaux', Valeur: d.kpis.users.newUsers },
- { Catégorie: 'Dépôts', Indicateur: 'Montant total (raw)', Valeur: d.kpis.deposits.totalAmountRaw },
- { Catégorie: 'Dépôts', Indicateur: 'Montant total USDT', Valeur: formatRawUsdt(d.kpis.deposits.totalAmountRaw) },
- { Catégorie: 'Retraits', Indicateur: 'Montant total (raw)', Valeur: d.kpis.withdrawals.totalAmountRaw },
- { Catégorie: 'Jeux', Indicateur: 'Prédictions', Valeur: d.games.participation.totalPredictions },
- { Catégorie: 'Financier', Indicateur: 'Net P/L plateforme (réel)', Valeur: formatRawUsdt(d.financial.performance.platformNetPnlRaw) },
- { Catégorie: 'Financier', Indicateur: 'Net P/L test', Valeur: formatRawUsdt(d.financial.performance.platformNetPnlTestRaw) },
- { Catégorie: 'Alertes', Indicateur: 'Ouvertes', Valeur: d.alerts.openAlertsCount },
+ { Catégorie: t(`${exp}.categories.users`), Indicateur: t(`${exp}.indicators.totalUsers`), Valeur: d.kpis.users.totalUsers },
+ { Catégorie: t(`${exp}.categories.users`), Indicateur: t(`${exp}.indicators.newUsers`), Valeur: d.kpis.users.newUsers },
+ { Catégorie: t(`${exp}.categories.deposits`), Indicateur: t(`${exp}.indicators.depositTotalRaw`), Valeur: d.kpis.deposits.totalAmountRaw },
+ { Catégorie: t(`${exp}.categories.deposits`), Indicateur: t(`${exp}.indicators.depositTotalUsdt`), Valeur: formatRawUsdt(d.kpis.deposits.totalAmountRaw) },
+ { Catégorie: t(`${exp}.categories.withdrawals`), Indicateur: t(`${exp}.indicators.withdrawalTotalRaw`), Valeur: d.kpis.withdrawals.totalAmountRaw },
+ { Catégorie: t(`${exp}.categories.games`), Indicateur: t(`${exp}.indicators.predictions`), Valeur: d.games.participation.totalPredictions },
+ { Catégorie: t(`${exp}.categories.financial`), Indicateur: t(`${exp}.indicators.platformNetPnl`), Valeur: formatRawUsdt(d.financial.performance.platformNetPnlRaw) },
+ { Catégorie: t(`${exp}.categories.financial`), Indicateur: t(`${exp}.indicators.testNetPnl`), Valeur: formatRawUsdt(d.financial.performance.platformNetPnlTestRaw) },
+ { Catégorie: t(`${exp}.categories.alerts`), Indicateur: t(`${exp}.indicators.openAlerts`), Valeur: d.alerts.openAlertsCount },
];
const ws = XLSX.utils.json_to_sheet(rows);
const wb = XLSX.utils.book_new();
- XLSX.utils.book_append_sheet(wb, ws, 'Dashboard');
+ XLSX.utils.book_append_sheet(wb, ws, t(`${exp}.sheetName`));
XLSX.writeFile(wb, `prediqo-dashboard-${d.filters.preset}-${dayjs().format('YYYYMMDD-HHmm')}.xlsx`);
- }, [q.data]);
+ }, [q.data, t]);
const show = (id: DashboardSectionId) => !hiddenSections.includes(id);
@@ -116,39 +119,41 @@ export function DashboardPage() {
{customRangePending && (
- Sélectionnez les dates « Du » et « Au » pour charger les analytics de l’intervalle personnalisé.
+ {t('admin.dashboard.customRangePending')}
)}
{customRangeInvalid && (
- La date « Du » doit être antérieure ou égale à la date « Au ».
+ {t('admin.dashboard.customRangeInvalid')}
)}
{q.isError && !customRangePending && (
- Impossible de charger les analytics. Vérifiez que le backend est démarré et que vous êtes administrateur.
+ {t('admin.dashboard.loadError')}
)}
{q.data?.meta?.chartsFromMaterializedViews && (
- KPIs, graphiques financiers, paris, géographie et démographie alimentés par les vues matérialisées PostgreSQL (rafraîchies périodiquement, sans service externe).
+ {t('admin.dashboard.materializedViews')}
)}
{q.data?.meta?.cached && (
- Données servies depuis le cache ({q.data.meta.cachedAt ? dayjs(q.data.meta.cachedAt).format('HH:mm:ss') : 'récentes'}).
- Utilisez « Actualiser » pour forcer un recalcul complet.
+ {t('admin.dashboard.cached', {
+ time: q.data.meta.cachedAt
+ ? dayjs(q.data.meta.cachedAt).format('HH:mm:ss')
+ : t('admin.dashboard.cachedRecent'),
+ })}
)}
{q.data?.meta?.degraded && (
- Certaines sections n’ont pas pu être calculées à temps (volume de données élevé). Les indicateurs
- affichés peuvent être partiels.
+ {t('admin.dashboard.degraded')}
{q.data.meta.warnings?.length ? (
{q.data.meta.warnings.map((w) => (
@@ -162,7 +167,7 @@ export function DashboardPage() {
{q.isFetching && !q.isLoading && (
- Mise à jour des données…
+ {t('admin.dashboard.updating')}
)}
diff --git a/prediqo_web/src/features/dashboard/components/DashboardCharts.tsx b/prediqo_web/src/features/dashboard/components/DashboardCharts.tsx
index 78710855..fe18862f 100644
--- a/prediqo_web/src/features/dashboard/components/DashboardCharts.tsx
+++ b/prediqo_web/src/features/dashboard/components/DashboardCharts.tsx
@@ -18,6 +18,7 @@ import {
} from 'recharts';
import type { DailyPoint } from '../types';
import { formatCount, formatRawUsdt } from '../utils/format';
+import { useTranslation } from 'react-i18next';
const CHART_COLORS = ['#D6B25E', '#7C5CFF', '#29B6F6', '#4CAF50', '#FF7043', '#AB47BC'];
@@ -231,6 +232,7 @@ export function SimplePieChart({
}
export function FinancialTrendChart({ deposits, withdrawals }: { deposits: DailyPoint[]; withdrawals: DailyPoint[] }) {
+ const { t } = useTranslation();
const byDate = new Map();
for (const d of deposits) {
byDate.set(d.date, { date: d.date, deposits: d.value, withdrawals: 0 });
@@ -243,12 +245,12 @@ export function FinancialTrendChart({ deposits, withdrawals }: { deposits: Daily
const merged = [...byDate.values()].sort((a, b) => a.date.localeCompare(b.date));
return (
);
diff --git a/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx b/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx
index 1c3ff6f6..b052423a 100644
--- a/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx
+++ b/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx
@@ -10,24 +10,22 @@ import {
TextField,
} from '@mui/material';
import FileDownloadRoundedIcon from '@mui/icons-material/FileDownloadRounded';
+import { useTranslation } from 'react-i18next';
import { PageHeader, RefreshIconButton } from '../../../shared/components/PageHeader';
import type { DashboardFilters, DatePreset, GameKey } from '../types';
-const DATE_PRESETS: { value: DatePreset; label: string }[] = [
- { value: 'today', label: "Aujourd'hui" },
- { value: 'yesterday', label: 'Hier' },
- { value: 'this_week', label: 'Cette semaine' },
- { value: 'this_month', label: 'Mois en cours' },
- { value: 'last_30_days', label: '30 derniers jours' },
- { value: 'last_90_days', label: '90 derniers jours' },
- { value: 'this_year', label: 'Cette année' },
- { value: 'custom', label: 'Intervalle personnalisé' },
+const DATE_PRESET_KEYS: DatePreset[] = [
+ 'today',
+ 'yesterday',
+ 'this_week',
+ 'this_month',
+ 'last_30_days',
+ 'last_90_days',
+ 'this_year',
+ 'custom',
];
-const GAME_OPTIONS: { value: GameKey; label: string }[] = [
- { value: 'all', label: 'Tous les jeux' },
- { value: 'candle-predict', label: 'Candle Predict' },
-];
+const GAME_KEYS: GameKey[] = ['all', 'candle-predict'];
type DashboardFiltersBarProps = {
filters: DashboardFilters;
@@ -48,6 +46,8 @@ export function DashboardFiltersBar({
periodLabel,
disableActions,
}: DashboardFiltersBarProps) {
+ const { t } = useTranslation();
+
return (
@@ -77,7 +79,7 @@ export function DashboardFiltersBar({
disabled={loading || disableActions}
sx={{ flexShrink: 0 }}
>
- Exporter
+ {t('admin.dashboard.exportAction')}
>
}
@@ -85,15 +87,15 @@ export function DashboardFiltersBar({
- Période
+ {t('admin.dashboard.period')}
onChange({ ...filters, preset: e.target.value as DatePreset })}
>
- {DATE_PRESETS.map((p) => (
-
@@ -102,7 +104,7 @@ export function DashboardFiltersBar({
{filters.preset === 'custom' && (
<>
- Jeu
+ {t('admin.dashboard.game')}
onChange({ ...filters, gameKey: e.target.value as GameKey })}
>
- {GAME_OPTIONS.map((g) => (
-
- {g.label}
+ {GAME_KEYS.map((value) => (
+
+ {value === 'all'
+ ? t('admin.dashboard.games.all')
+ : t('admin.dashboard.games.candlePredict')}
))}
}
+ title={t('admin.dashboard.sections.kpi.title')}
+ subtitle={t('admin.dashboard.sections.kpi.subtitle')}
+ action={}
>
- Utilisateurs
+ {t('admin.dashboard.sections.kpi.groups.users')}
= 0 ? 'positive' : 'danger'}
/>
-
+
- Dépôts
+ {t('admin.dashboard.sections.kpi.groups.deposits')}
-
+
-
+
- Retraits & bonus
+ {t('admin.dashboard.sections.kpi.groups.withdrawalsBonus')}
-
+
@@ -255,34 +260,36 @@ export function KpiSection({ data }: { data: AdminDashboardData }) {
}
export function FinancialSection({ data }: { data: AdminDashboardData }) {
+ const { t } = useTranslation();
const { balances, performance } = data.financial;
+ const fc = 'admin.dashboard.sections.financial.cards';
const walletPie = balances.distribution.map((d) => ({
- name: d.kind === 'main' ? 'Principal' : d.kind === 'bonus' ? 'Bonus' : 'Test',
+ name: t(`admin.dashboard.walletKind.${d.kind}`),
value: d.amountRaw,
}));
return (
}
>
-
+
-
+
-
+
-
+
= 0 ? 'positive' : 'danger'}
to={REPORT_PATHS.predictionsReal}
@@ -290,8 +297,8 @@ export function FinancialSection({ data }: { data: AdminDashboardData }) {
= 0 ? 'positive' : 'danger'}
to={REPORT_PATHS.predictionsTest}
@@ -299,16 +306,16 @@ export function FinancialSection({ data }: { data: AdminDashboardData }) {
-
+
@@ -316,14 +323,20 @@ export function FinancialSection({ data }: { data: AdminDashboardData }) {
- Trésorerie on-chain
+ {t('admin.dashboard.sections.financial.onChainTreasury')}
-
+
@@ -335,7 +348,7 @@ export function FinancialSection({ data }: { data: AdminDashboardData }) {
`${formatRawUsdt(v)} USDT`}
/>
@@ -345,7 +358,7 @@ export function FinancialSection({ data }: { data: AdminDashboardData }) {
`${formatRawUsdt(v)} USDT`}
/>
@@ -357,25 +370,33 @@ export function FinancialSection({ data }: { data: AdminDashboardData }) {
}
export function GameSection({ data }: { data: AdminDashboardData }) {
+ const { t } = useTranslation();
const g = data.games;
const dateQ = {
from: data.filters.from,
to: data.filters.to,
};
+ const gc = 'admin.dashboard.sections.game.cards';
+ const seg = 'admin.dashboard.sections.game.segments';
+ const tbl = 'admin.dashboard.tables';
return (
- }>
+ }
+ >
-
+
-
+
-
+
-
+
@@ -384,34 +405,24 @@ export function GameSection({ data }: { data: AdminDashboardData }) {
- Segment
-
- Utilisateurs
-
-
- Prédictions
-
-
- Misé
-
-
- Net P/L
-
-
- Taux réussite
-
+ {t(`${tbl}.segment`)}
+ {t(`${tbl}.users`)}
+ {t(`${tbl}.predictions`)}
+ {t(`${tbl}.stake`)}
+ {t(`${tbl}.netPnl`)}
+ {t(`${tbl}.winRate`)}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -420,15 +431,15 @@ export function GameSection({ data }: { data: AdminDashboardData }) {
= 0 ? 'positive' : 'danger'}
to={reportUrl(REPORT_PATHS.predictionsTest, dateQ)}
@@ -437,23 +448,25 @@ export function GameSection({ data }: { data: AdminDashboardData }) {
- Répartitions (taille fixe)
+ {t('admin.dashboard.sections.game.distributionsFixed')}
-
+
- Direction
- Prédictions
- Misé
+ {t(`${tbl}.direction`)}
+ {t(`${tbl}.predictions`)}
+ {t(`${tbl}.stake`)}
{data.charts.shortVsLong.map((r) => (
- {r.direction === 'long' ? 'Long' : 'Short'}
+
+ {r.direction === 'long' ? t('admin.dashboard.sections.game.long') : t('admin.dashboard.sections.game.short')}
+
{formatCount(r.count)}
{formatRawUsdt(r.stakeRaw)}
@@ -463,20 +476,20 @@ export function GameSection({ data }: { data: AdminDashboardData }) {
-
+
- Intervalle
- Participants
- Misé
- P/L maison
+ {t(`${tbl}.interval`)}
+ {t(`${tbl}.participants`)}
+ {t(`${tbl}.stake`)}
+ {t(`${tbl}.housePnl`)}
{data.charts.byInterval.map((r) => (
- {r.intervalMinutes} min
+ {t('admin.dashboard.minSuffix', { n: r.intervalMinutes })}
{formatCount(r.participants)}
{formatRawUsdt(r.stakeRaw)}
}>
+ }
+ >
- Sécurité & conformité
+ {t('admin.dashboard.sections.users.securityCompliance')}
{securityItems.map((item) => (
-
-
+
+
))}
- Activité
+ {t('admin.dashboard.sections.users.activity')}
0 ? 3 : 0 }}>
{activityItems.map((item) => (
-
-
+
+
))}
{recentLogins.length > 0 && (
-
+
- Utilisateur
- Date
+ {t(`${tbl}.user`)}
+ {t(`${tbl}.date`)}
@@ -587,17 +611,20 @@ export function UserSection({ data }: { data: AdminDashboardData }) {
}
export function GeographySection({ data }: { data: AdminDashboardData }) {
+ const { t } = useTranslation();
const { label: countryLabel } = useCountryNames();
const top = data.geography.slice(0, 8);
const topWithNames = top.map((r) => ({ ...r, countryName: countryLabel(r.country) }));
+ const tbl = 'admin.dashboard.tables';
+ const geo = 'admin.dashboard.sections.geography';
return (
- }>
+ }>
({ country: r.countryName, users: r.users }))}
- title="Utilisateurs (top 8)"
+ title={t(`${geo}.usersTop8`)}
dataKey="users"
labelKey="country"
/>
@@ -608,7 +635,7 @@ export function GeographySection({ data }: { data: AdminDashboardData }) {
({ country: r.countryName, deposits: r.depositsRaw }))}
- title="Dépôts (top 8)"
+ title={t(`${geo}.depositsTop8`)}
dataKey="deposits"
labelKey="country"
valueFormatter={(v) => `${formatRawUsdt(v)} USDT`}
@@ -617,16 +644,16 @@ export function GeographySection({ data }: { data: AdminDashboardData }) {
-
+
- Pays
- Utilisateurs
- Dépôts
- Retraits
- Net P/L
- Actifs
+ {t(`${tbl}.country`)}
+ {t(`${tbl}.users`)}
+ {t(`${tbl}.deposits`)}
+ {t(`${tbl}.withdrawals`)}
+ {t(`${tbl}.netPnl`)}
+ {t(`${tbl}.active`)}
@@ -648,45 +675,52 @@ export function GeographySection({ data }: { data: AdminDashboardData }) {
}
export function DemographicsSection({ data }: { data: AdminDashboardData }) {
+ const { t } = useTranslation();
+ const genderLabel = (gender: string) =>
+ t(`admin.dashboard.gender.${gender}`, { defaultValue: gender });
+ const ageLabel = (bucket: string) =>
+ t(`admin.dashboard.ageBucket.${bucket}`, { defaultValue: bucket });
const genderData = data.demographics.byGender.map((g) => ({
- label: GENDER_DASHBOARD_LABELS[g.gender] ?? g.gender,
+ label: genderLabel(g.gender),
users: g.users,
}));
const ageData = data.demographics.byAge.map((a) => ({
- label: AGE_BUCKET_LABELS[a.ageBucket] ?? a.ageBucket,
+ label: ageLabel(a.ageBucket),
users: a.users,
}));
+ const demo = 'admin.dashboard.sections.demographics';
+ const tbl = 'admin.dashboard.tables';
return (
-
+
-
+
-
+
-
+
- Sexe
- Utilisateurs
- Misé
- Net P/L
- Dépôts
+ {t(`${tbl}.gender`)}
+ {t(`${tbl}.users`)}
+ {t(`${tbl}.stake`)}
+ {t(`${tbl}.netPnl`)}
+ {t(`${tbl}.deposits`)}
{data.demographics.byGender.map((g) => (
- {GENDER_DASHBOARD_LABELS[g.gender] ?? g.gender}
+ {genderLabel(g.gender)}
{formatCount(g.users)}
{formatRawUsdt(g.stakeRaw)}
{formatRawUsdt(g.netPnlRaw)}
@@ -698,21 +732,21 @@ export function DemographicsSection({ data }: { data: AdminDashboardData }) {
-
+
- Tranche
- Utilisateurs
- Misé
- Net P/L
- Dépôts
+ {t(`${tbl}.ageBucket`)}
+ {t(`${tbl}.users`)}
+ {t(`${tbl}.stake`)}
+ {t(`${tbl}.netPnl`)}
+ {t(`${tbl}.deposits`)}
{data.demographics.byAge.map((a) => (
- {AGE_BUCKET_LABELS[a.ageBucket] ?? a.ageBucket}
+ {ageLabel(a.ageBucket)}
{formatCount(a.users)}
{formatRawUsdt(a.stakeRaw)}
{formatRawUsdt(a.netPnlRaw)}
@@ -729,10 +763,12 @@ export function DemographicsSection({ data }: { data: AdminDashboardData }) {
}
export function ChartsSection({ data }: { data: AdminDashboardData }) {
+ const { t } = useTranslation();
const dateQ = {
from: data.filters.from,
to: data.filters.to,
};
+ const ch = 'admin.dashboard.sections.charts';
const manualAutoMulti = data.charts.predictionsManual.map((m, i) => ({
date: m.date,
manual: m.value,
@@ -740,52 +776,52 @@ export function ChartsSection({ data }: { data: AdminDashboardData }) {
multi: data.charts.predictionsMultiCandle[i]?.value ?? 0,
}));
const shortLong = data.charts.shortVsLong.map((r) => ({
- direction: r.direction === 'long' ? 'Long' : 'Short',
+ direction: r.direction === 'long' ? t('admin.dashboard.sections.game.long') : t('admin.dashboard.sections.game.short'),
count: r.count,
}));
const intervalData = data.charts.byInterval.map((r) => ({
- label: `${r.intervalMinutes} min`,
+ label: t('admin.dashboard.minSuffix', { n: r.intervalMinutes }),
stake: r.stakeRaw,
participants: r.participants,
}));
- const hourLogin = data.charts.loginHours.map((h) => ({ hour: `${h.hour}h`, count: h.count }));
- const hourBet = data.charts.betHours.map((h) => ({ hour: `${h.hour}h`, count: h.count }));
+ const hourLogin = data.charts.loginHours.map((h) => ({ hour: t('admin.dashboard.hourSuffix', { h: h.hour }), count: h.count }));
+ const hourBet = data.charts.betHours.map((h) => ({ hour: t('admin.dashboard.hourSuffix', { h: h.hour }), count: h.count }));
return (
-
+
-
+
-
+
-
+
-
+
@@ -793,7 +829,7 @@ export function ChartsSection({ data }: { data: AdminDashboardData }) {
-
+
@@ -801,7 +837,7 @@ export function ChartsSection({ data }: { data: AdminDashboardData }) {
`${formatRawUsdt(v)} USDT`}
@@ -811,13 +847,13 @@ export function ChartsSection({ data }: { data: AdminDashboardData }) {
-
+
-
+
@@ -825,10 +861,10 @@ export function ChartsSection({ data }: { data: AdminDashboardData }) {
@@ -841,21 +877,28 @@ export function ChartsSection({ data }: { data: AdminDashboardData }) {
}
export function AlertsSection({ data }: { data: AdminDashboardData }) {
+ const { t } = useTranslation();
const al = data.alerts;
const recentAlerts = al.recentAlerts.slice(0, 10);
+ const alert = 'admin.dashboard.sections.alerts';
+ const tbl = 'admin.dashboard.tables';
return (
- }>
+ }
+ >
-
+
-
+
{recentAlerts.length === 0 ? (
- Aucune alerte récente sur la période.
+ {t('admin.dashboard.noRecentAlerts')}
) : (
-
+
- Type
- Sévérité
- Statut
- Date
+ {t(`${tbl}.type`)}
+ {t(`${tbl}.severity`)}
+ {t(`${tbl}.status`)}
+ {t(`${tbl}.date`)}
diff --git a/prediqo_web/src/features/dashboard/components/PersonalizationToolbar.tsx b/prediqo_web/src/features/dashboard/components/PersonalizationToolbar.tsx
index 19a6ef14..78dc5e38 100644
--- a/prediqo_web/src/features/dashboard/components/PersonalizationToolbar.tsx
+++ b/prediqo_web/src/features/dashboard/components/PersonalizationToolbar.tsx
@@ -14,6 +14,7 @@ import {
} from '@mui/material';
import ViewModuleRoundedIcon from '@mui/icons-material/ViewModuleRounded';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import type { DashboardFilters, DashboardSectionId } from '../types';
import { DASHBOARD_SECTIONS } from '../types';
import { loadDashboardLayout, saveDashboardLayout, type SavedDashboardView } from '../utils/layoutStorage';
@@ -29,10 +30,12 @@ export function PersonalizationToolbar({
hiddenSections,
onHiddenChange,
}: PersonalizationToolbarProps) {
+ const { t } = useTranslation();
const [open, setOpen] = useState(false);
const [viewName, setViewName] = useState('');
const [savedViews, setSavedViews] = useState(() => loadDashboardLayout().savedViews);
const [emailReport, setEmailReport] = useState('');
+ const p = 'admin.dashboard.personalize';
const toggleSection = (id: DashboardSectionId) => {
if (hiddenSections.includes(id)) {
@@ -74,7 +77,7 @@ export function PersonalizationToolbar({
} onClick={() => setOpen(true)}>
- Personnaliser
+ {t(`${p}.button`)}
{savedViews.slice(0, 3).map((v) => (
))}
- Masquer/afficher des sections · vues sauvegardées (local)
+ {t(`${p}.hint`)}
diff --git a/prediqo_web/src/features/dashboard/components/ReportDetailLink.tsx b/prediqo_web/src/features/dashboard/components/ReportDetailLink.tsx
index 6e21fd1e..46891ee6 100644
--- a/prediqo_web/src/features/dashboard/components/ReportDetailLink.tsx
+++ b/prediqo_web/src/features/dashboard/components/ReportDetailLink.tsx
@@ -1,9 +1,11 @@
import { Button } from '@mui/material';
import OpenInNewRoundedIcon from '@mui/icons-material/OpenInNewRounded';
import { Link as RouterLink } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
/** Compact link to open the detailed report for a dashboard KPI. */
-export function ReportDetailLink({ to, label = 'Voir le rapport détaillé' }: { to: string; label?: string }) {
+export function ReportDetailLink({ to, label }: { to: string; label?: string }) {
+ const { t } = useTranslation();
return (
}
sx={{ mt: 1, px: 0, minWidth: 0, fontWeight: 700 }}
>
- {label}
+ {label ?? t('admin.dashboard.reportDetail')}
);
}
diff --git a/prediqo_web/src/features/dashboard/components/TreasuryDashboardCards.tsx b/prediqo_web/src/features/dashboard/components/TreasuryDashboardCards.tsx
index 61bd82df..8fa49294 100644
--- a/prediqo_web/src/features/dashboard/components/TreasuryDashboardCards.tsx
+++ b/prediqo_web/src/features/dashboard/components/TreasuryDashboardCards.tsx
@@ -1,5 +1,6 @@
import { Alert, Grid, Skeleton } from '@mui/material';
import { useQuery } from '@tanstack/react-query';
+import { useTranslation } from 'react-i18next';
import { api } from '../../../shared/services/api';
import { REPORT_PATHS } from '../reportLinks';
import { formatRawUsdt } from '../utils/format';
@@ -25,6 +26,7 @@ function formatOnChainBalance(raw: string | null, decimals: number): string {
/** On-chain hot/cold balances and in-progress deposit sweeps for the admin dashboard. */
export function TreasuryDashboardCards() {
+ const { t } = useTranslation();
const q = useQuery({
queryKey: ['admin-treasury-overview'],
queryFn: async () => {
@@ -50,7 +52,7 @@ export function TreasuryDashboardCards() {
if (q.isError) {
return (
- Impossible de charger la trésorerie on-chain (hot/cold). Consultez la page Treasury pour le détail.
+ {t('admin.dashboard.treasury.loadError')}
);
}
@@ -64,7 +66,7 @@ export function TreasuryDashboardCards() {
0
- ? `${sweeps.count} opération${sweeps.count > 1 ? 's' : ''} · pending / gas / broadcast`
- : 'Aucun sweep actif'
+ ? t('admin.dashboard.treasury.operations', { count: sweeps.count })
+ : t('admin.dashboard.treasury.noActiveSweep')
}
value={
sweeps.count > 0
diff --git a/prediqo_web/src/features/dashboard/utils/format.ts b/prediqo_web/src/features/dashboard/utils/format.ts
index 94cf5542..f7a4efcc 100644
--- a/prediqo_web/src/features/dashboard/utils/format.ts
+++ b/prediqo_web/src/features/dashboard/utils/format.ts
@@ -13,20 +13,3 @@ export function formatPercent(value: number): string {
export function formatCount(value: number): string {
return value.toLocaleString();
}
-
-export const AGE_BUCKET_LABELS: Record = {
- unknown: 'Unknown',
- under_18: 'Under 18',
- '18_24': '18–24',
- '25_34': '25–34',
- '35_44': '35–44',
- '45_54': '45–54',
- '55_plus': '55+',
-};
-
-export const GENDER_DASHBOARD_LABELS: Record = {
- male: 'Masculin',
- female: 'Féminin',
- other: 'Autre',
- unknown: 'Non renseigné',
-};
diff --git a/prediqo_web/src/features/faq/FaqAdminPage.tsx b/prediqo_web/src/features/faq/FaqAdminPage.tsx
index c94643e1..a22efc6d 100644
--- a/prediqo_web/src/features/faq/FaqAdminPage.tsx
+++ b/prediqo_web/src/features/faq/FaqAdminPage.tsx
@@ -28,6 +28,7 @@ import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded';
import HelpOutlineRoundedIcon from '@mui/icons-material/HelpOutlineRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import {
adminCreateFaq,
adminCreateFaqCategory,
@@ -66,6 +67,7 @@ const emptyCategory = (): { name: string; slug: string; sortOrder: number; isAct
/** Admin / moderator FAQ management. */
export function FaqAdminPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [tab, setTab] = useState('entries');
const [search, setSearch] = useState('');
@@ -109,7 +111,7 @@ export function FaqAdminPage() {
const saveEntryM = useMutation({
mutationFn: async () => {
if (entryForm.categoryId === '' || !entryForm.question.trim()) {
- throw new Error('Catégorie et question requises');
+ throw new Error(t('admin.faqAdmin.categoryRequired'));
}
const body = {
categoryId: entryForm.categoryId,
@@ -136,7 +138,7 @@ export function FaqAdminPage() {
const saveCatM = useMutation({
mutationFn: async () => {
- if (!catForm.name.trim()) throw new Error('Nom requis');
+ if (!catForm.name.trim()) throw new Error(t('admin.faqAdmin.nameRequired'));
const body = {
name: catForm.name.trim(),
slug: catForm.slug.trim() || undefined,
@@ -209,21 +211,19 @@ export function FaqAdminPage() {
- Gestion FAQ
+ {t('admin.faqAdmin.title')}
-
- Créez et organisez les questions fréquentes affichées aux utilisateurs.
-
+ {t('admin.faqAdmin.subtitle')}
} onClick={() => invalidate()} variant="outlined" size="small">
- Actualiser
+ {t('admin.faqAdmin.refresh')}
setTab(v)} sx={{ mb: 2 }}>
-
-
+
+
{tab === 'entries' && (
@@ -231,19 +231,19 @@ export function FaqAdminPage() {
setSearch(e.target.value)}
sx={{ flex: 1 }}
/>
- Catégorie
+ {t('admin.faqAdmin.category')}
setCategoryFilter(e.target.value as number | '')}
>
- Toutes
+ {t('admin.faqAdmin.allCategories')}
{categories.map((c) => (
{c.name}
@@ -252,25 +252,25 @@ export function FaqAdminPage() {
- Statut
+ {t('admin.faqAdmin.status')}
setActiveFilter(e.target.value as typeof activeFilter)}
>
- Tous
- Actives
- Inactives
+ {t('admin.faqAdmin.allStatuses')}
+ {t('admin.faqAdmin.activeEntries')}
+ {t('admin.faqAdmin.inactiveEntries')}
} variant="contained" onClick={openCreateEntry}>
- Nouvelle FAQ
+ {t('admin.faqAdmin.newEntry')}
{(entriesQ.error || saveEntryM.error) && (
- {(saveEntryM.error as Error)?.message ?? 'Erreur de chargement'}
+ {(saveEntryM.error as Error)?.message ?? t('admin.faqAdmin.loadError')}
)}
@@ -284,14 +284,20 @@ export function FaqAdminPage() {
-
+
- Vues: {entry.viewCount} · Utile: {entry.helpfulYes} / {entry.helpfulNo}
- {entry.updatedByName ? ` · Modifié par ${entry.updatedByName}` : ''}
+ {t('admin.faqAdmin.views', {
+ views: entry.viewCount,
+ yes: entry.helpfulYes,
+ no: entry.helpfulNo,
+ })}
+ {entry.updatedByName
+ ? t('admin.faqAdmin.updatedBy', { name: entry.updatedByName })
+ : ''}
{entry.updatedAt ? ` · ${new Date(entry.updatedAt).toLocaleString()}` : ''}
@@ -302,7 +308,7 @@ export function FaqAdminPage() {
size="small"
color="error"
onClick={() => {
- if (window.confirm('Supprimer cette FAQ ?')) deleteEntryM.mutate(entry.id);
+ if (window.confirm(t('admin.faqAdmin.deleteEntryConfirm'))) deleteEntryM.mutate(entry.id);
}}
>
@@ -311,7 +317,7 @@ export function FaqAdminPage() {
))}
{!entriesQ.isLoading && sortedEntries.length === 0 && (
- Aucune FAQ trouvée.
+ {t('admin.faqAdmin.noEntries')}
)}
>
@@ -321,7 +327,7 @@ export function FaqAdminPage() {
<>
} variant="contained" onClick={openCreateCat}>
- Nouvelle catégorie
+ {t('admin.faqAdmin.newCategory')}
@@ -331,8 +337,8 @@ export function FaqAdminPage() {
{cat.name}
- Slug: {cat.slug} · Ordre: {cat.sortOrder}
- {cat.isActive === false ? ' · Inactive' : ''}
+ {t('admin.faqAdmin.slug', { slug: cat.slug, order: cat.sortOrder })}
+ {cat.isActive === false ? t('admin.faqAdmin.categoryInactive') : ''}
openEditCat(cat)}>
@@ -342,7 +348,7 @@ export function FaqAdminPage() {
size="small"
color="error"
onClick={() => {
- if (window.confirm('Supprimer cette catégorie ? Les FAQ associées doivent être déplacées.')) {
+ if (window.confirm(t('admin.faqAdmin.deleteCategoryConfirm'))) {
deleteCatM.mutate(cat.id);
}
}}
@@ -357,13 +363,13 @@ export function FaqAdminPage() {
)}
diff --git a/prediqo_web/src/features/faq/FaqPage.tsx b/prediqo_web/src/features/faq/FaqPage.tsx
index 31ce8e4d..f562221d 100644
--- a/prediqo_web/src/features/faq/FaqPage.tsx
+++ b/prediqo_web/src/features/faq/FaqPage.tsx
@@ -21,6 +21,7 @@ import TrendingUpRoundedIcon from '@mui/icons-material/TrendingUpRounded';
import { useQuery, useMutation } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
import { Link as RouterLink } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
import {
fetchFaqCategories,
fetchFaqs,
@@ -58,6 +59,7 @@ function HelpfulButtons({
entry: FaqEntry;
onUpdate: (yes: number, no: number) => void;
}) {
+ const { t } = useTranslation();
const voted = readSet(VOTED_KEY).has(entry.id);
const mutation = useMutation({
mutationFn: (helpful: boolean) => recordFaqHelpful(entry.id, helpful),
@@ -70,7 +72,7 @@ function HelpfulButtons({
if (voted) {
return (
- Merci pour votre retour !
+ {t('faq.thankYou')}
);
}
@@ -78,7 +80,7 @@ function HelpfulButtons({
return (
- Cette réponse vous a-t-elle été utile ?
+ {t('faq.helpfulQuestion')}
);
@@ -108,6 +110,7 @@ type FaqPageProps = {
/** Public FAQ page with search, categories, accordion, and helpful votes. */
export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
+ const { t } = useTranslation();
const [search, setSearch] = useState('');
const [categorySlug, setCategorySlug] = useState(null);
const [expandedId, setExpandedId] = useState(false);
@@ -172,16 +175,16 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
{!isLoggedIn && (
<>
>
)}
{isLoggedIn && (
)}
@@ -192,17 +195,15 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
- Foire aux questions
+ {t('faq.title')}
-
- Trouvez rapidement des réponses aux questions les plus fréquentes.
-
+ {t('faq.subtitle')}
setSearch(e.target.value)}
slotProps={{
@@ -219,7 +220,7 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
setCategorySlug(null)}
variant={categorySlug === null ? 'filled' : 'outlined'}
@@ -240,7 +241,7 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
- Questions populaires
+ {t('faq.popular')}
@@ -267,7 +268,7 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
{(categoriesQ.error || faqsQ.error) && (
- Impossible de charger les FAQ. Réessayez plus tard.
+ {t('faq.loadError')}
)}
@@ -276,7 +277,7 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
) : entries.length === 0 ? (
- Aucune question ne correspond à votre recherche.
+ {t('faq.noResults')}
) : (
{entries.map((entry) => (
@@ -292,7 +293,7 @@ export function FaqPage({ showPublicHeader = false }: FaqPageProps) {
{entry.question}
{entry.categoryName}
- {entry.viewCount > 0 ? ` · ${entry.viewCount} consultation(s)` : ''}
+ {entry.viewCount > 0 ? ` · ${t('faq.views', { count: entry.viewCount })}` : ''}
diff --git a/prediqo_web/src/features/home/HomePage.tsx b/prediqo_web/src/features/home/HomePage.tsx
index ea5c068b..5c445fa9 100644
--- a/prediqo_web/src/features/home/HomePage.tsx
+++ b/prediqo_web/src/features/home/HomePage.tsx
@@ -18,6 +18,7 @@ import EmojiEventsRoundedIcon from '@mui/icons-material/EmojiEventsRounded';
import GridViewRoundedIcon from '@mui/icons-material/GridViewRounded';
import { useMemo, useState, type ReactNode } from 'react';
import { useNavigate } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
import { GameCard } from './components/GameCard';
import { PromoCarousel } from './components/PromoCarousel';
import { PromoStrip } from './components/PromoStrip';
@@ -29,6 +30,7 @@ const ALL = 'all';
/** Main landing page with hero promos, strip ads, and filterable games grid. */
export function HomePage() {
+ const { t } = useTranslation();
const nav = useNavigate();
const gamesQ = useGames();
const heroQ = useHeroAdvertisements();
@@ -52,7 +54,7 @@ export function HomePage() {
const refreshAll = async () => {
await Promise.all([gamesQ.refetch(), heroQ.refetch(), stripQ.refetch()]);
- setToast('Catalog refreshed');
+ setToast(t('common.catalogRefreshed'));
};
const onPlay = (game: Game) => {
@@ -66,12 +68,12 @@ export function HomePage() {
}
- title="Play & Predict"
- subtitle="Explore live prediction games, grab limited-time promos, and compete for rewards."
+ title={t('home.title')}
+ subtitle={t('home.subtitle')}
mb={2.5}
actions={
void refreshAll()}
disabled={loading}
/>
@@ -80,7 +82,7 @@ export function HomePage() {
{(gamesQ.isError || heroQ.isError) && (
- Some content failed to load. Run database migrations and ensure the API is running.
+ {t('home.loadError')}
)}
@@ -105,19 +107,19 @@ export function HomePage() {
>
}
- label="Live games"
+ label={t('home.liveGames')}
value={String(liveCount)}
color="#D6B25E"
/>
}
- label="Featured"
+ label={t('home.featured')}
value={String(featuredCount)}
color="#7C5CFF"
/>
}
- label="Total"
+ label={t('home.total')}
value={String(games.length)}
color="#4CAF50"
sx={{ gridColumn: { xs: '1 / -1', sm: 'auto' } }}
@@ -127,7 +129,7 @@ export function HomePage() {
- Promotions
+ {t('home.promotions')}
@@ -135,7 +137,7 @@ export function HomePage() {
- Promotions
+ {t('home.promotions')}
@@ -158,12 +160,12 @@ export function HomePage() {
sx={{ flexWrap: 'wrap', alignItems: 'center' }}
>
- Categories
+ {t('home.categories')}
{categories.map((cat) => (
- Available games
+ {t('home.availableGames')}
@@ -200,7 +202,7 @@ export function HomePage() {
) : filtered.length === 0 ? (
- No games in this category yet.
+ {t('home.noGamesInCategory')}
) : (
= {
@@ -12,14 +14,22 @@ const categoryIcons: Record = {
politics: '🗳️',
};
-function statusMeta(status: GameStatus) {
+function statusMeta(status: GameStatus, t: TFunction) {
if (status === 'active') {
- return { label: 'Live', color: 'success' as const, icon: null };
+ return { label: t('home.gameStatus.live'), color: 'success' as const, icon: null };
}
if (status === 'coming_soon') {
- return { label: 'Soon', color: 'warning' as const, icon: };
+ return {
+ label: t('home.gameStatus.soon'),
+ color: 'warning' as const,
+ icon: ,
+ };
}
- return { label: 'Maintenance', color: 'default' as const, icon: };
+ return {
+ label: t('home.gameStatus.maintenance'),
+ color: 'default' as const,
+ icon: ,
+ };
}
type Props = {
@@ -29,7 +39,8 @@ type Props = {
/** Visual card for a catalog game entry. */
export function GameCard({ game, onPlay }: Props) {
- const meta = statusMeta(game.status);
+ const { t } = useTranslation();
+ const meta = statusMeta(game.status, t);
const accent = game.accentColor || '#D6B25E';
const playable = game.status === 'active';
const emoji = categoryIcons[game.category] ?? '🎮';
@@ -81,7 +92,12 @@ export function GameCard({ game, onPlay }: Props) {
)}
{game.isFeatured && (
-
+
)}
- {playable ? 'Play now' : meta.label}
+ {playable ? t('home.gameStatus.playNow') : meta.label}
diff --git a/prediqo_web/src/features/network/NetworkStatusPage.tsx b/prediqo_web/src/features/network/NetworkStatusPage.tsx
index 68f995e5..274db13d 100644
--- a/prediqo_web/src/features/network/NetworkStatusPage.tsx
+++ b/prediqo_web/src/features/network/NetworkStatusPage.tsx
@@ -2,20 +2,20 @@
* Admin-only page for backend network and environment status.
*/
import { Box, Stack, Typography } from '@mui/material';
+import { useTranslation } from 'react-i18next';
import { NetworkBanner } from '../../shared/network/NetworkBanner';
/** Dedicated admin view for TRON network, withdrawals, and server environment. */
export function NetworkStatusPage() {
+ const { t } = useTranslation();
+
return (
- Réseau & environnement
-
-
- Configuration serveur réservée aux administrateurs : réseau blockchain, retraits et environnement
- d'exécution.
+ {t('admin.network.title')}
+ {t('admin.network.subtitle')}
diff --git a/prediqo_web/src/features/options/OptionsPage.tsx b/prediqo_web/src/features/options/OptionsPage.tsx
index 20a559de..b85d7b19 100644
--- a/prediqo_web/src/features/options/OptionsPage.tsx
+++ b/prediqo_web/src/features/options/OptionsPage.tsx
@@ -2,6 +2,7 @@
* Admin options hub page.
* Presents navigation cards to user management and application settings.
*/
+import type { ElementType } from 'react';
import { Box, Card, CardActionArea, CardContent, Chip, Stack, Typography } from '@mui/material';
import PeopleOutlineRoundedIcon from '@mui/icons-material/PeopleOutlineRounded';
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
@@ -16,19 +17,156 @@ import ShieldRoundedIcon from '@mui/icons-material/ShieldRounded';
import HeadsetMicRoundedIcon from '@mui/icons-material/HeadsetMicRounded';
import HelpOutlineRoundedIcon from '@mui/icons-material/HelpOutlineRounded';
import { useNavigate } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
+
+type OptionCardKey =
+ | 'users'
+ | 'settings'
+ | 'catalog'
+ | 'treasury'
+ | 'referral'
+ | 'referralFraud'
+ | 'testWallet'
+ | 'security'
+ | 'network'
+ | 'faq'
+ | 'support'
+ | 'countries';
+
+type OptionCardConfig = {
+ key: OptionCardKey;
+ path: string;
+ icon: ElementType;
+ badgeKey: string;
+ badgeColor?: 'primary' | 'success' | 'info' | 'secondary' | 'error' | 'warning';
+ bg: string;
+ border: string;
+ iconColor?: 'error';
+};
+
+const OPTION_CARDS: OptionCardConfig[] = [
+ {
+ key: 'users',
+ path: '/admin/users',
+ icon: PeopleOutlineRoundedIcon,
+ badgeKey: 'admin',
+ badgeColor: 'primary',
+ bg: 'rgba(214,178,94,0.16)',
+ border: 'rgba(214,178,94,0.22)',
+ },
+ {
+ key: 'settings',
+ path: '/admin/settings',
+ icon: SettingsOutlinedIcon,
+ badgeKey: 'dynamic',
+ bg: 'rgba(124,92,255,0.16)',
+ border: 'rgba(124,92,255,0.22)',
+ },
+ {
+ key: 'catalog',
+ path: '/admin/catalog',
+ icon: CampaignRoundedIcon,
+ badgeKey: 'catalog',
+ badgeColor: 'success',
+ bg: 'rgba(76,175,80,0.16)',
+ border: 'rgba(76,175,80,0.22)',
+ },
+ {
+ key: 'treasury',
+ path: '/admin/treasury',
+ icon: AccountBalanceWalletRoundedIcon,
+ badgeKey: 'coldHot',
+ badgeColor: 'info',
+ bg: 'rgba(41,182,246,0.16)',
+ border: 'rgba(41,182,246,0.22)',
+ },
+ {
+ key: 'referral',
+ path: '/admin/referral',
+ icon: GroupAddRoundedIcon,
+ badgeKey: 'levelsBonus',
+ badgeColor: 'secondary',
+ bg: 'rgba(124,92,255,0.16)',
+ border: 'rgba(124,92,255,0.22)',
+ },
+ {
+ key: 'referralFraud',
+ path: '/admin/referral/fraud',
+ icon: ShieldRoundedIcon,
+ badgeKey: 'sybilReview',
+ badgeColor: 'error',
+ bg: 'rgba(244,67,54,0.12)',
+ border: 'rgba(244,67,54,0.22)',
+ iconColor: 'error',
+ },
+ {
+ key: 'testWallet',
+ path: '/admin/test-wallet',
+ icon: ScienceRoundedIcon,
+ badgeKey: 'playMoney',
+ badgeColor: 'success',
+ bg: 'rgba(76,175,80,0.16)',
+ border: 'rgba(76,175,80,0.22)',
+ },
+ {
+ key: 'security',
+ path: '/admin/security',
+ icon: SecurityRoundedIcon,
+ badgeKey: 'alertsLedger',
+ badgeColor: 'warning',
+ bg: 'rgba(255,152,0,0.16)',
+ border: 'rgba(255,152,0,0.22)',
+ },
+ {
+ key: 'network',
+ path: '/admin/network',
+ icon: LanRoundedIcon,
+ badgeKey: 'admin',
+ badgeColor: 'primary',
+ bg: 'rgba(76,175,80,0.16)',
+ border: 'rgba(76,175,80,0.22)',
+ },
+ {
+ key: 'faq',
+ path: '/admin/faq',
+ icon: HelpOutlineRoundedIcon,
+ badgeKey: 'staff',
+ badgeColor: 'success',
+ bg: 'rgba(255,193,7,0.16)',
+ border: 'rgba(255,193,7,0.22)',
+ },
+ {
+ key: 'support',
+ path: '/admin/support',
+ icon: HeadsetMicRoundedIcon,
+ badgeKey: 'staff',
+ badgeColor: 'success',
+ bg: 'rgba(76,175,80,0.16)',
+ border: 'rgba(76,175,80,0.22)',
+ },
+ {
+ key: 'countries',
+ path: '/admin/countries',
+ icon: PublicRoundedIcon,
+ badgeKey: 'registration',
+ badgeColor: 'info',
+ bg: 'rgba(33,150,243,0.16)',
+ border: 'rgba(33,150,243,0.22)',
+ },
+];
/** Landing page for administrative tools and configuration shortcuts. */
export function OptionsPage() {
+ const { t } = useTranslation();
const nav = useNavigate();
+
return (
- Options
-
-
- Administrative tools and configuration.
+ {t('admin.options.title')}
+ {t('admin.options.subtitle')}
-
- nav('/admin/users')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- User Management
-
-
+ {OPTION_CARDS.map((card) => {
+ const Icon = card.icon;
+ return (
+
+ nav(card.path)} sx={{ height: '100%' }}>
+
+
+
+
+
+
+
+
+ {t(`admin.options.cards.${card.key}.title`)}
+
+
+
+
+ {t(`admin.options.cards.${card.key}.description`)}
+
+
-
- Search users, open details, and manage account flags safely.
-
-
-
-
-
-
-
-
- nav('/admin/settings')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Settings
-
-
-
-
- Configure password policy and access/refresh token expiration without code changes.
-
-
-
-
-
-
-
-
- nav('/admin/catalog')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Games & Ads
-
-
-
-
- Publish games and home-page promotions dynamically — no deploy required.
-
-
-
-
-
-
-
-
- nav('/admin/treasury')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Treasury
-
-
-
-
- Cold wallet addresses, deposit sweeps, and hot wallet funding from cold storage.
-
-
-
-
-
-
-
-
- nav('/admin/referral')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Referral program
-
-
-
-
- Multi-level commissions, bonus pool, eligibility rules, and signup analytics.
-
-
-
-
-
-
-
-
- nav('/admin/referral/fraud')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Referral fraud dashboard
-
-
-
-
- Review queue, high-risk referrers, monthly caps, and commission clawbacks.
-
-
-
-
-
-
-
-
- nav('/admin/test-wallet')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Test wallet
-
-
-
-
- Credit amounts, request limits, cooldowns, and grant history for practice play.
-
-
-
-
-
-
-
-
- nav('/admin/security')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Security
-
-
-
-
- Integrity checks, security alerts, in-app notifications, and approved ledger credits.
-
-
-
-
-
-
-
-
- nav('/admin/network')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Réseau & environnement
-
-
-
-
- Testnet, état des retraits USDT (TRC20) et environnement serveur.
-
-
-
-
-
-
-
-
- nav('/admin/faq')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Foire aux questions
-
-
-
-
- Gérer les questions, catégories, médias et statistiques FAQ.
-
-
-
-
-
-
-
-
- nav('/admin/support')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Centre d'assistance
-
-
-
-
- Conversations utilisateurs et visiteurs, réponses en temps réel.
-
-
-
-
-
-
-
-
- nav('/admin/countries')} sx={{ height: '100%' }}>
-
-
-
-
-
-
-
-
- Countries
-
-
-
-
- Sync country catalog and block registration by country of residence.
-
-
-
-
-
-
+
+
+
+ );
+ })}
);
}
-
diff --git a/prediqo_web/src/features/profile/ProfilePage.tsx b/prediqo_web/src/features/profile/ProfilePage.tsx
index 6e81d397..b4260ba8 100644
--- a/prediqo_web/src/features/profile/ProfilePage.tsx
+++ b/prediqo_web/src/features/profile/ProfilePage.tsx
@@ -25,6 +25,7 @@ import SecurityRoundedIcon from '@mui/icons-material/SecurityRounded';
import BadgeRoundedIcon from '@mui/icons-material/BadgeRounded';
import dayjs from 'dayjs';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { useAuth } from '../../shared/auth/AuthContext';
import { PageHeader, PageSectionHeader, RefreshIconButton } from '../../shared/components/PageHeader';
import { ProfileEditForm } from './components/ProfileEditForm';
@@ -36,6 +37,7 @@ import { displayName, useProfile } from './hooks/useProfile';
/** Profile route with personal info, account metadata, and security settings. */
export function ProfilePage() {
+ const { t } = useTranslation();
const { auth } = useAuth();
const profileQ = useProfile();
const [tab, setTab] = useState(0);
@@ -47,19 +49,19 @@ export function ProfilePage() {
const refresh = async () => {
await profileQ.refetch();
- setToast('Profile refreshed');
+ setToast(t('common.profileRefreshed'));
};
return (
}
- title="Profile"
- subtitle="View and manage your personal information and account security."
+ title={t('profile.title')}
+ subtitle={t('profile.subtitle')}
mb={2.5}
actions={
void refresh()}
disabled={profileQ.isLoading}
/>
@@ -68,7 +70,7 @@ export function ProfilePage() {
{profileQ.isError && (
- Failed to load profile. Make sure you are logged in and the API is running.
+ {t('profile.loadError')}
)}
@@ -115,16 +117,16 @@ export function ProfilePage() {
useFlexGap
sx={{ mt: 1.5, flexWrap: 'wrap', justifyContent: { xs: 'center', sm: 'flex-start' } }}
>
-
+
@@ -145,8 +147,8 @@ export function ProfilePage() {
allowScrollButtonsMobile
sx={{ mb: 2, borderBottom: '1px solid rgba(255,255,255,0.08)' }}
>
- } iconPosition="start" label="Personal" />
- } iconPosition="start" label="Security" />
+ } iconPosition="start" label={t('profile.tabPersonal')} />
+ } iconPosition="start" label={t('profile.tabSecurity')} />
{tab === 0 && (
@@ -160,7 +162,7 @@ export function ProfilePage() {
setEditing(true)}
sx={{ flexShrink: 0 }}
>
- Edit
+ {t('common.edit')}
) : undefined
}
@@ -199,7 +201,7 @@ export function ProfilePage() {
- Email verification
+ {t('profile.emailVerification')}
{profileQ.isLoading ? (
@@ -216,7 +218,7 @@ export function ProfilePage() {
- Referral program
+ {t('profile.referralProgram')}
@@ -225,7 +227,7 @@ export function ProfilePage() {
- Account details
+ {t('profile.accountDetails')}
{profileQ.isLoading ? (
@@ -235,17 +237,23 @@ export function ProfilePage() {
) : profile ? (
}>
-
-
+
+
-
-
+
+
) : (
-
+
)}
@@ -264,10 +272,10 @@ export function ProfilePage() {
- Change password
+ {t('profile.changePassword')}
- Update your password. You will need your current password to confirm.
+ {t('profile.changePasswordHint')}
@@ -276,10 +284,10 @@ export function ProfilePage() {
- Two-factor authentication
+ {t('profile.twoFactorAuth')}
- Add an extra layer of security for transfers and sensitive actions.
+ {t('profile.twoFactorHint')}
{profile ? (
void;
};
-/**
- * Submits current and new password to POST /api/v1/auth/change-password.
- */
export function ChangePasswordForm({ onSuccess, onError }: ChangePasswordFormProps) {
+ const { t } = useTranslation();
const [currentPassword, setCurrentPassword] = useState('');
const [newPassword, setNewPassword] = useState('');
const [confirmPassword, setConfirmPassword] = useState('');
@@ -33,15 +32,15 @@ export function ChangePasswordForm({ onSuccess, onError }: ChangePasswordFormPro
const submit = async () => {
if (!currentPassword) {
- onError('Enter your current password');
+ onError(t('profilePassword.enterCurrent'));
return;
}
if (!newPassword) {
- onError('Enter a new password');
+ onError(t('profilePassword.enterNew'));
return;
}
if (newPassword !== confirmPassword) {
- onError('New password and confirmation do not match');
+ onError(t('profilePassword.mismatch'));
return;
}
setSaving(true);
@@ -53,10 +52,10 @@ export function ChangePasswordForm({ onSuccess, onError }: ChangePasswordFormPro
setCurrentPassword('');
setNewPassword('');
setConfirmPassword('');
- onSuccess('Password updated successfully');
+ onSuccess(t('profilePassword.updated'));
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- onError(err?.response?.data?.error ?? err?.message ?? 'Password change failed');
+ onError(err?.response?.data?.error ?? err?.message ?? t('profilePassword.failed'));
} finally {
setSaving(false);
}
@@ -65,7 +64,7 @@ export function ChangePasswordForm({ onSuccess, onError }: ChangePasswordFormPro
return (
setConfirmPassword(e.target.value)}
/>
- Choose a strong password. Server policy (length, complexity) is enforced on save.
+ {t('profilePassword.strengthHint')}
diff --git a/prediqo_web/src/features/profile/components/EmailVerificationPanel.tsx b/prediqo_web/src/features/profile/components/EmailVerificationPanel.tsx
index 6bfe23da..8684268d 100644
--- a/prediqo_web/src/features/profile/components/EmailVerificationPanel.tsx
+++ b/prediqo_web/src/features/profile/components/EmailVerificationPanel.tsx
@@ -1,6 +1,5 @@
/**
* Email verification panel on the profile page.
- * Sends verification emails and surfaces dev verify links in console transport mode.
*/
import {
Alert,
@@ -14,6 +13,7 @@ import {
import MarkEmailReadRoundedIcon from '@mui/icons-material/MarkEmailReadRounded';
import { useState } from 'react';
import { useQueryClient } from '@tanstack/react-query';
+import { Trans, useTranslation } from 'react-i18next';
import { api } from '../../../shared/services/api';
type EmailVerificationPanelProps = {
@@ -22,14 +22,12 @@ type EmailVerificationPanelProps = {
onNotify: (message: string) => void;
};
-/**
- * Lets unverified users request a verification email and copy the dev link when returned.
- */
export function EmailVerificationPanel({
email,
emailVerified,
onNotify,
}: EmailVerificationPanelProps) {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [sending, setSending] = useState(false);
const [devLink, setDevLink] = useState(null);
@@ -38,7 +36,11 @@ export function EmailVerificationPanel({
if (emailVerified) {
return (
} sx={{ borderRadius: 2 }}>
- Your email {email} is verified.
+ }}
+ />
);
}
@@ -53,12 +55,10 @@ export function EmailVerificationPanel({
);
await qc.invalidateQueries({ queryKey: ['user-profile'] });
onNotify(res.data.message);
- if (res.data.devVerifyUrl) {
- setDevLink(res.data.devVerifyUrl);
- }
+ if (res.data.devVerifyUrl) setDevLink(res.data.devVerifyUrl);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- const msg = err?.response?.data?.error ?? err?.message ?? 'Failed to send email';
+ const msg = err?.response?.data?.error ?? err?.message ?? t('profileEmailVerify.sendFailed');
setError(msg);
onNotify(msg);
} finally {
@@ -70,17 +70,20 @@ export function EmailVerificationPanel({
if (!devLink) return;
try {
await navigator.clipboard.writeText(devLink);
- onNotify('Dev verify link copied');
+ onNotify(t('profileEmailVerify.devLinkCopied'));
} catch {
- onNotify('Copy failed');
+ onNotify(t('common.copyFailed'));
}
};
return (
- Your email {email ?? '—'} is not verified yet. Verify it to secure withdrawals and
- account recovery.
+ }}
+ />
{error && (
@@ -90,25 +93,26 @@ export function EmailVerificationPanel({
)}
- We will send a secure one-time link valid for 24 hours. Changing your email requires
- verification again.
+ {t('profileEmailVerify.hint')}
: }
+ startIcon={
+ sending ? :
+ }
onClick={send}
disabled={sending || !email}
>
- {sending ? 'Sending…' : 'Send verification email'}
+ {sending ? t('common.sending') : t('profileEmailVerify.sendEmail')}
{devLink && (
- Dev mode: SMTP is not used. Open or copy this link to verify locally.
+ }} />
)}
diff --git a/prediqo_web/src/features/profile/components/ProfileEditForm.tsx b/prediqo_web/src/features/profile/components/ProfileEditForm.tsx
index 8ecbf71a..07fb7270 100644
--- a/prediqo_web/src/features/profile/components/ProfileEditForm.tsx
+++ b/prediqo_web/src/features/profile/components/ProfileEditForm.tsx
@@ -1,15 +1,10 @@
/**
* Editable personal information form for the profile page.
*/
-import {
- Alert,
- Box,
- Button,
- Stack,
- TextField,
-} from '@mui/material';
+import { Alert, Box, Button, Stack, TextField } from '@mui/material';
import { useEffect, useMemo, useState } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
+import { useTranslation } from 'react-i18next';
import { api } from '../../../shared/services/api';
import { CountryAutocomplete, type CountryOption } from '../../../shared/components/CountryAutocomplete';
import { GenderSelect } from '../../../shared/components/GenderSelect';
@@ -30,9 +25,6 @@ function countryLabel(code: string | null | undefined, countries: CountryOption[
return match ? `${match.name} (${match.code})` : code;
}
-/**
- * Form to update name, date of birth, email, phone, country, and nationality via PATCH /api/v1/me.
- */
export function ProfileEditForm({
profile,
editing,
@@ -40,6 +32,7 @@ export function ProfileEditForm({
onSaved,
onError,
}: ProfileEditFormProps) {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [firstName, setFirstName] = useState('');
const [middleName, setMiddleName] = useState('');
@@ -82,15 +75,15 @@ export function ProfileEditForm({
const save = async () => {
if (!email.trim()) {
- onError('Email cannot be empty');
+ onError(t('profileForm.emailEmpty'));
return;
}
if (!countryOfResidence.trim()) {
- onError('Country of residence is required');
+ onError(t('profileForm.countryRequired'));
return;
}
if (!gender) {
- onError('Gender is required');
+ onError(t('profileForm.genderRequired'));
return;
}
setSaving(true);
@@ -108,10 +101,10 @@ export function ProfileEditForm({
};
await api.patch('/api/v1/me', payload);
await qc.invalidateQueries({ queryKey: ['user-profile'] });
- onSaved('Profile updated successfully');
+ onSaved(t('profileForm.updated'));
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- onError(err?.response?.data?.error ?? err?.message ?? 'Update failed');
+ onError(err?.response?.data?.error ?? err?.message ?? t('profileForm.updateFailed'));
} finally {
setSaving(false);
}
@@ -120,19 +113,19 @@ export function ProfileEditForm({
if (!editing) {
return (
-
-
-
-
-
-
-
+
+
+
+
+
+
+
- Fields show your current information. Edit only what you want to change, then save.
+ {t('profileForm.editHint')}
setFirstName(e.target.value)}
/>
setMiddleName(e.target.value)}
/>
setLastName(e.target.value)}
/>
setEmail(e.target.value)}
/>
setPhone(e.target.value)}
/>
{countriesQ.isError && (
- Could not load country list. Try again later or contact support.
+ {t('profileForm.countriesLoadFailed')}
)}
diff --git a/prediqo_web/src/features/profile/components/ReferralPanel.tsx b/prediqo_web/src/features/profile/components/ReferralPanel.tsx
index 0e9e53d4..270447d3 100644
--- a/prediqo_web/src/features/profile/components/ReferralPanel.tsx
+++ b/prediqo_web/src/features/profile/components/ReferralPanel.tsx
@@ -17,6 +17,7 @@ import GroupAddRoundedIcon from '@mui/icons-material/GroupAddRounded';
import OpenInNewRoundedIcon from '@mui/icons-material/OpenInNewRounded';
import { Link as RouterLink } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
+import { useTranslation } from 'react-i18next';
import { api } from '../../../shared/services/api';
type ReferralInfo = {
@@ -31,6 +32,7 @@ type ReferralPanelProps = {
};
export function ReferralPanel({ onNotify }: ReferralPanelProps) {
+ const { t } = useTranslation();
const q = useQuery({
queryKey: ['referral-me'],
queryFn: async () => {
@@ -41,14 +43,14 @@ export function ReferralPanel({ onNotify }: ReferralPanelProps) {
const copy = async (text: string, label: string) => {
if (!text) {
- onNotify('Nothing to copy');
+ onNotify(t('common.nothingToCopy'));
return;
}
try {
await navigator.clipboard.writeText(text);
- onNotify(`${label} copied`);
+ onNotify(t('common.copied', { label }));
} catch {
- onNotify('Copy failed');
+ onNotify(t('common.copyFailed'));
}
};
@@ -57,17 +59,12 @@ export function ReferralPanel({ onNotify }: ReferralPanelProps) {
}
if (q.isError) {
- return Could not load referral information.;
+ return {t('profileReferral.loadFailed')};
}
const info = q.data;
if (!info?.referralCode) {
- return (
-
- Your referral code is not available yet. Contact support if you registered before the
- referral program launched.
-
- );
+ return {t('profileReferral.notAvailable')};
}
return (
@@ -75,7 +72,7 @@ export function ReferralPanel({ onNotify }: ReferralPanelProps) {
- Share your link to invite friends and earn commissions on their activity.
+ {t('profileReferral.shareHint')}
}
>
- Full network
+ {t('profileReferral.fullNetwork')}
- Referral code
+ {t('profileReferral.referralCode')}
void copy(info.referralCode!, 'Referral code')}
+ aria-label={t('profileReferral.copyCodeAria')}
+ onClick={() => void copy(info.referralCode!, t('profileReferral.referralCode'))}
>
@@ -118,7 +115,7 @@ export function ReferralPanel({ onNotify }: ReferralPanelProps) {
- Referral link
+ {t('profileReferral.referralLink')}
void copy(info.referralLink, 'Referral link')}
+ aria-label={t('profileReferral.copyLinkAria')}
+ onClick={() => void copy(info.referralLink, t('profileReferral.referralLink'))}
>
@@ -141,10 +138,10 @@ export function ReferralPanel({ onNotify }: ReferralPanelProps) {
variant="outlined"
size="small"
startIcon={}
- onClick={() => void copy(info.referralLink, 'Referral link')}
+ onClick={() => void copy(info.referralLink, t('profileReferral.referralLink'))}
sx={{ alignSelf: 'flex-start' }}
>
- Copy invite link
+ {t('profileReferral.copyInvite')}
);
diff --git a/prediqo_web/src/features/profile/components/TwoFactorPanel.tsx b/prediqo_web/src/features/profile/components/TwoFactorPanel.tsx
index dca2e025..f72b59d9 100644
--- a/prediqo_web/src/features/profile/components/TwoFactorPanel.tsx
+++ b/prediqo_web/src/features/profile/components/TwoFactorPanel.tsx
@@ -12,6 +12,7 @@ import {
} from '@mui/material';
import { useQueryClient } from '@tanstack/react-query';
import { useState } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
import { api } from '../../../shared/services/api';
import type { TotpSetupResponse } from '../types';
@@ -21,10 +22,8 @@ type TwoFactorPanelProps = {
onError: (message: string) => void;
};
-/**
- * Guides the user through TOTP 2FA setup or shows enabled status.
- */
export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPanelProps) {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [setupData, setSetupData] = useState(null);
const [loadingSetup, setLoadingSetup] = useState(false);
@@ -39,7 +38,7 @@ export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPan
setSetupData(res.data);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- onError(err?.response?.data?.error ?? err?.message ?? '2FA setup failed');
+ onError(err?.response?.data?.error ?? err?.message ?? t('profileTwoFactor.setupFailed'));
} finally {
setLoadingSetup(false);
}
@@ -47,7 +46,7 @@ export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPan
const enable = async () => {
if (code.trim().length !== 6) {
- onError('Enter the 6-digit code from your authenticator app');
+ onError(t('profileTwoFactor.enterCode'));
return;
}
setEnabling(true);
@@ -56,13 +55,11 @@ export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPan
setSetupData(null);
setCode('');
await qc.invalidateQueries({ queryKey: ['user-profile'] });
- onSuccess('Two-factor authentication enabled');
+ onSuccess(t('profileTwoFactor.enabledSuccess'));
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
onError(
- err?.response?.data?.error ??
- err?.message ??
- 'Invalid code. Scan the QR again and enter the current 6-digit code.'
+ err?.response?.data?.error ?? err?.message ?? t('profileTwoFactor.invalidCode')
);
} finally {
setEnabling(false);
@@ -72,8 +69,7 @@ export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPan
if (totpEnabled) {
return (
- Two-factor authentication is enabled on your account. A TOTP code is required for
- transfers when 2FA is active.
+ }} />
);
}
@@ -81,23 +77,22 @@ export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPan
return (
- Protect your account with Google Authenticator or any TOTP app. Scan the QR code, then
- enter a verification code to enable 2FA.
+ {t('profileTwoFactor.setupHint')}
{!setupData ? (
) : (
- Scan with your authenticator app
+ {t('profileTwoFactor.scanQr')}
- Manual key: {setupData.secret}
+ {t('profileTwoFactor.manualKey', { secret: setupData.secret })}
setCode(e.target.value.replace(/\D/g, '').slice(0, 6))}
@@ -127,9 +122,9 @@ export function TwoFactorPanel({ totpEnabled, onSuccess, onError }: TwoFactorPan
placeholder="000000"
/>
-
+
diff --git a/prediqo_web/src/features/referral/ReferralAdminPage.tsx b/prediqo_web/src/features/referral/ReferralAdminPage.tsx
index 8487511f..5ef777d4 100644
--- a/prediqo_web/src/features/referral/ReferralAdminPage.tsx
+++ b/prediqo_web/src/features/referral/ReferralAdminPage.tsx
@@ -23,6 +23,7 @@ import GroupAddRoundedIcon from '@mui/icons-material/GroupAddRounded';
import { Link as RouterLink } from 'react-router-dom';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { ScrollableTable } from '../../shared/components/ScrollableTable';
@@ -89,6 +90,7 @@ type ReviewQueueItem = {
};
export function ReferralAdminPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [levelForm, setLevelForm] = useState({
levelNumber: '',
@@ -212,7 +214,7 @@ export function ReferralAdminPage() {
},
onSuccess: (res) => {
setFundPendingMsg(
- res.data.message ?? 'Bonus pool funding submitted — pending super-admin approval'
+ res.data.message ?? t('admin.referralAdmin.fundPending')
);
void qc.invalidateQueries({ queryKey: ['admin-referral-config'] });
},
@@ -227,10 +229,10 @@ export function ReferralAdminPage() {
- Referral program
+ {t('admin.referralAdmin.title')}
@@ -240,13 +242,13 @@ export function ReferralAdminPage() {
)}
- {configQ.isError && Failed to load referral configuration.}
+ {configQ.isError && {t('admin.referralAdmin.loadError')}}
{s && (
- Program settings
+ {t('admin.referralAdmin.programSettings')}
setSettingsForm({ ...s, enabled: e.target.checked })}
/>
}
- label="Program enabled"
+ label={t('admin.referralAdmin.programEnabled')}
/>
setSettingsForm({ ...s, bonusWithdrawable: e.target.checked })}
/>
}
- label="Bonus withdrawable (transfer bonus → main)"
+ label={t('admin.referralAdmin.bonusWithdrawable')}
/>
}
- label="Referrer must have verified email"
+ label={t('admin.referralAdmin.referrerVerified')}
/>
}
- label="Referrer must have deposited"
+ label={t('admin.referralAdmin.referrerDeposited')}
/>
}
- label="Referred user must have verified email (before payout)"
+ label={t('admin.referralAdmin.referredVerified')}
/>
setSettingsForm({ ...s, commissionHoldDays: Number(e.target.value) || 0 })
}
- helperText="Delay after first deposit before commission can be paid"
+ helperText={t('admin.referralAdmin.commissionHoldHelper')}
/>
setSettingsForm({ ...s, commissionMaxPendingDays: Number(e.target.value) || 1 })
}
- helperText="Expire unpaid commissions if eligibility is still not met"
+ helperText={t('admin.referralAdmin.maxPendingHelper')}
/>
- Commission modes
+ {t('admin.referralAdmin.commissionModes')}
}
- label="Deposit commissions (first deposit of referred users)"
+ label={t('admin.referralAdmin.depositCommissions')}
/>
}
- label="Withdrawal commissions (prediction gains from main account only)"
+ label={t('admin.referralAdmin.withdrawalCommissions')}
/>
- Alertes Slack
+ {t('admin.referralAdmin.slackAlerts')}
}
- label="Slack alerts enabled (referral channel: cap blocks, clawbacks, Sybil review)"
+ label={t('admin.referralAdmin.slackEnabled')}
/>
- Configure SLACK_REFERRAL_WEBHOOK_URL for #referral-fraud and{' '}
- SLACK_SECURITY_WEBHOOK_URL for #security.{' '}
- SLACK_WEBHOOK_URL is used as fallback for both.
+ {t('admin.referralAdmin.slackHint')}
- Anti-fraude Sybil (P2)
+ {t('admin.referralAdmin.sybilSection')}
}
- label="Sybil detection enabled"
+ label={t('admin.referralAdmin.sybilEnabled')}
/>
setSettingsForm({ ...s, sybilReviewThreshold: Number(e.target.value) || 0 })
}
- helperText="Score ≥ this → manual review queue"
+ helperText={t('admin.referralAdmin.sybilReviewHelper')}
/>
setSettingsForm({ ...s, sybilBlockThreshold: Number(e.target.value) || 1 })
}
- helperText="Score ≥ this → auto-block (no commission)"
+ helperText={t('admin.referralAdmin.sybilBlockHelper')}
/>
setSettingsForm({ ...s, maxCommissionAmountPerReferrerMonthRaw: e.target.value })
}
- helperText="500000000 = 500 USDT (6 decimals). 0 = unlimited."
+ helperText={t('admin.referralAdmin.maxAmountHelper')}
/>
setSettingsForm({ ...s, defaultReferrerUserId: e.target.value || null })
}
- helperText="Used when no referral code is provided at signup"
+ helperText={t('admin.referralAdmin.defaultReferrerHelper')}
/>
setSettingsForm({ ...s, minFirstDepositRaw: e.target.value })}
/>
setSettingsForm({ ...s, commissionWalletTypeId: Number(e.target.value) })
}
- helperText="2 = USDT_TRC20 by default"
+ helperText={t('admin.referralAdmin.commissionWalletHelper')}
/>
@@ -478,17 +478,17 @@ export function ReferralAdminPage() {
- Commission levels
+ {t('admin.referralAdmin.levelsTitle')}
- Level
- % of first deposit
- Max amount / month (raw)
- Max count / month
- Active
+ {t('admin.referralAdmin.level')}
+ {t('admin.referralAdmin.percentDeposit')}
+ {t('admin.referralAdmin.maxAmountMonthCol')}
+ {t('admin.referralAdmin.maxCountMonthCol')}
+ {t('admin.referralAdmin.active')}
@@ -497,10 +497,10 @@ export function ReferralAdminPage() {
{l.levelNumber}
{l.commissionPercent}%
- {l.monthlyMaxAmountRaw === '0' ? 'Global' : l.monthlyMaxAmountRaw}
- {l.monthlyMaxCount === 0 ? 'Global' : l.monthlyMaxCount}
+ {l.monthlyMaxAmountRaw === '0' ? t('admin.referralAdmin.global') : l.monthlyMaxAmountRaw}
+ {l.monthlyMaxCount === 0 ? t('admin.referralAdmin.global') : l.monthlyMaxCount}
-
+
@@ -515,14 +515,14 @@ export function ReferralAdminPage() {
})
}
>
- Edit
+ {t('admin.referralAdmin.edit')}
@@ -533,27 +533,27 @@ export function ReferralAdminPage() {
setLevelForm((f) => ({ ...f, levelNumber: e.target.value }))}
sx={{ flex: 1 }}
/>
setLevelForm((f) => ({ ...f, commissionPercent: e.target.value }))}
sx={{ flex: 1 }}
/>
setLevelForm((f) => ({ ...f, monthlyMaxAmountRaw: e.target.value }))}
sx={{ flex: 1 }}
/>
setLevelForm((f) => ({ ...f, monthlyMaxCount: e.target.value }))}
@@ -573,7 +573,7 @@ export function ReferralAdminPage() {
});
}}
>
- Add / update level
+ {t('admin.referralAdmin.addUpdateLevel')}
@@ -582,30 +582,30 @@ export function ReferralAdminPage() {
- Bonus pool (treasury for referral payouts)
+ {t('admin.referralAdmin.bonusPoolTitle')}
{(config?.pools ?? []).map((p) => (
- Wallet type {p.walletTypeId}: {p.availableBalance} raw units
+ {t('admin.referralAdmin.walletTypeBalance', { id: p.walletTypeId, balance: p.availableBalance })}
))}
setFundForm((f) => ({ ...f, walletTypeId: e.target.value }))}
sx={{ flex: 1 }}
/>
setFundForm((f) => ({ ...f, amountDisplay: e.target.value }))}
sx={{ flex: 1 }}
/>
@@ -614,28 +614,28 @@ export function ReferralAdminPage() {
- Manual review queue
+ {t('admin.referralAdmin.reviewTitle')}
{reviewQ.isError && (
- Failed to load review queue.
+ {t('admin.referralAdmin.reviewLoadError')}
)}
{(reviewQ.data?.items.length ?? 0) === 0 ? (
- No commissions awaiting review.
+ {t('admin.referralAdmin.noReview')}
) : (
- Score
- Signals
- Level
- Commission
- Beneficiary
- Referred
+ {t('admin.referralAdmin.score')}
+ {t('admin.referralAdmin.signals')}
+ {t('admin.referralAdmin.level')}
+ {t('admin.referralAdmin.commission')}
+ {t('admin.referralAdmin.beneficiary')}
+ {t('admin.referralAdmin.referred')}
@@ -667,11 +667,11 @@ export function ReferralAdminPage() {
onClick={() => approveMut.mutate(item.id)}
disabled={approveMut.isPending}
>
- Approve
+ {t('admin.referralAdmin.approve')}
setRejectReasons((prev) => ({ ...prev, [item.id]: e.target.value }))
@@ -688,7 +688,7 @@ export function ReferralAdminPage() {
}}
disabled={rejectMut.isPending}
>
- Reject
+ {t('admin.referralAdmin.reject')}
@@ -705,25 +705,31 @@ export function ReferralAdminPage() {
- Statistics
+ {t('admin.referralAdmin.statsTitle')}
-
-
-
+
+
+
- Users by country
+ {t('admin.referralAdmin.byCountry')}
@@ -738,15 +744,15 @@ export function ReferralAdminPage() {
- Top referrers
+ {t('admin.referralAdmin.topReferrers')}
- Code
- Direct referrals
- Earned (raw)
+ {t('admin.referralAdmin.code')}
+ {t('admin.referralAdmin.directReferrals')}
+ {t('admin.referralAdmin.totalEarned')}
diff --git a/prediqo_web/src/features/referral/ReferralFraudDashboardPage.tsx b/prediqo_web/src/features/referral/ReferralFraudDashboardPage.tsx
index 200cf41a..9ea0bbd5 100644
--- a/prediqo_web/src/features/referral/ReferralFraudDashboardPage.tsx
+++ b/prediqo_web/src/features/referral/ReferralFraudDashboardPage.tsx
@@ -23,6 +23,7 @@ import DownloadRoundedIcon from '@mui/icons-material/DownloadRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { Link as RouterLink } from 'react-router-dom';
import { useState } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { ScrollableTable } from '../../shared/components/ScrollableTable';
@@ -107,6 +108,7 @@ function StatCard({ label, value, sub }: { label: string; value: string | number
}
export function ReferralFraudDashboardPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [clawbackReasons, setClawbackReasons] = useState>({});
const [exportFrom, setExportFrom] = useState('');
@@ -163,7 +165,9 @@ export function ReferralFraudDashboardPage() {
a.click();
URL.revokeObjectURL(url);
} catch (e) {
- setExportError(e instanceof Error ? e.message : 'Export failed');
+ setExportError(
+ e instanceof Error ? e.message : t('admin.referralFraud.recentClawbacks.exportFailed')
+ );
} finally {
setExporting(false);
}
@@ -174,49 +178,69 @@ export function ReferralFraudDashboardPage() {
- Referral fraud dashboard
+ {t('admin.referralFraud.title')}
- {dashQ.isError && Failed to load fraud dashboard.}
+ {dashQ.isError && {t('admin.referralFraud.loadError')}}
{data && (
<>
-
-
-
-
+
+
+
+
-
+
-
+
@@ -224,21 +248,21 @@ export function ReferralFraudDashboardPage() {
- Review queue
+ {t('admin.referralFraud.reviewQueue.title')}
{data.reviewQueuePreview.length === 0 ? (
- No commissions awaiting review.
+ {t('admin.referralFraud.reviewQueue.empty')}
) : (
- Score
- Signals
- Amount
- Beneficiary
+ {t('admin.referralAdmin.score')}
+ {t('admin.referralAdmin.signals')}
+ {t('admin.referralFraud.reviewQueue.amount')}
+ {t('admin.referralAdmin.beneficiary')}
@@ -249,16 +273,20 @@ export function ReferralFraudDashboardPage() {
- {item.sybilSignals.join(', ') || '—'}
+
+ {item.sybilSignals.join(', ') || '—'}
+
{item.commissionAmount}
- {item.beneficiaryUserId.slice(0, 8)}…
+
+ {item.beneficiaryUserId.slice(0, 8)}…
+
@@ -288,17 +316,17 @@ export function ReferralFraudDashboardPage() {
- High-risk referrers
+ {t('admin.referralFraud.highRisk.title')}
- Code
- Avg Sybil
- Review
- Inactive
- Month raw
+ {t('admin.referralAdmin.code')}
+ {t('admin.referralFraud.highRisk.avgSybil')}
+ {t('admin.referralFraud.highRisk.review')}
+ {t('admin.referralFraud.highRisk.inactive')}
+ {t('admin.referralFraud.highRisk.monthRaw')}
@@ -321,12 +349,12 @@ export function ReferralFraudDashboardPage() {
- Sybil signals (this month)
+ {t('admin.referralFraud.sybilSignals.title')}
{data.sybilSignalBreakdown.length === 0 ? (
- No signals recorded this month.
+ {t('admin.referralFraud.sybilSignals.empty')}
) : (
data.sybilSignalBreakdown.map((s) => (
@@ -345,16 +373,16 @@ export function ReferralFraudDashboardPage() {
- Clawback (paid commissions)
+ {t('admin.referralFraud.clawback.title')}
- Score
- Amount
- Beneficiary
- Reason + action
+ {t('admin.referralAdmin.score')}
+ {t('admin.referralFraud.reviewQueue.amount')}
+ {t('admin.referralAdmin.beneficiary')}
+ {t('admin.referralFraud.clawback.reasonAction')}
@@ -369,7 +397,7 @@ export function ReferralFraudDashboardPage() {
setClawbackReasons((prev) => ({ ...prev, [p.id]: e.target.value }))
@@ -388,7 +416,7 @@ export function ReferralFraudDashboardPage() {
})
}
>
- Clawback
+ {t('admin.referralFraud.clawback.action')}
@@ -405,12 +433,12 @@ export function ReferralFraudDashboardPage() {
- Recent clawbacks
+ {t('admin.referralFraud.recentClawbacks.title')}
void downloadClawbacksCsv()}
disabled={exporting}
>
- Export CSV
+ {exporting
+ ? t('common.exporting')
+ : t('admin.referralFraud.recentClawbacks.exportCsv')}
{exportError && (
@@ -441,13 +471,17 @@ export function ReferralFraudDashboardPage() {
)}
{data.recentClawbacks.length === 0 ? (
- None yet.
+ {t('admin.referralFraud.recentClawbacks.empty')}
) : (
data.recentClawbacks.map((c) => (
-
- {c.amount} raw — {c.reason}
+
+ }}
+ />
{new Date(c.createdAt).toLocaleString()}
@@ -462,11 +496,11 @@ export function ReferralFraudDashboardPage() {
- Recent blocks (Sybil / cap)
+ {t('admin.referralFraud.recentBlocks.title')}
{data.recentCapBlocks.length === 0 ? (
- None recorded.
+ {t('admin.referralFraud.recentBlocks.empty')}
) : (
data.recentCapBlocks.map((b, i) => (
diff --git a/prediqo_web/src/features/referral/ReferralPage.tsx b/prediqo_web/src/features/referral/ReferralPage.tsx
index 42dea515..c7ee6b96 100644
--- a/prediqo_web/src/features/referral/ReferralPage.tsx
+++ b/prediqo_web/src/features/referral/ReferralPage.tsx
@@ -22,6 +22,7 @@ import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded';
import TableChartRoundedIcon from '@mui/icons-material/TableChartRounded';
import AccountTreeRoundedIcon from '@mui/icons-material/AccountTreeRounded';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { useAuth } from '../../shared/auth/AuthContext';
import { rawToHuman } from '../wallet/utils/walletFormat';
import { ReferralTableView } from './components/ReferralTableView';
@@ -53,6 +54,7 @@ function StatCard({ label, value, sub }: { label: string; value: string | number
}
export function ReferralPage() {
+ const { t, i18n } = useTranslation();
const { auth } = useAuth();
const [tab, setTab] = useState(0);
const [maxDepth, setMaxDepth] = useState(5);
@@ -65,47 +67,47 @@ export function ReferralPage() {
const copy = async (text: string, label: string) => {
if (!text) {
- setToast('Nothing to copy');
+ setToast(t('common.nothingToCopy'));
return;
}
try {
await navigator.clipboard.writeText(text);
- setToast(`${label} copied`);
+ setToast(t('common.copied', { label }));
} catch {
- setToast('Copy failed');
+ setToast(t('common.copyFailed'));
}
};
const refreshAll = async () => {
await Promise.all([dashQ.refetch(), commissionsQ.refetch()]);
- setToast('Referral data refreshed');
+ setToast(t('referralPage.refreshed'));
};
const commissionModeLabel = () => {
if (!data) return '';
const { depositEnabled, withdrawalEnabled } = data.commissionModes;
- if (depositEnabled && withdrawalEnabled) return 'Deposits + withdrawal gains';
- if (depositEnabled) return 'First deposits';
- if (withdrawalEnabled) return 'Withdrawal gains (prediction profits)';
- return 'Commissions paused';
+ if (depositEnabled && withdrawalEnabled) return t('referralPage.modes.both');
+ if (depositEnabled) return t('referralPage.modes.deposit');
+ if (withdrawalEnabled) return t('referralPage.modes.withdrawal');
+ return t('referralPage.modes.paused');
};
return (
}
- title="Referral program"
- subtitle="Build your network and earn commissions on your referrals' activity."
+ title={t('referralPage.title')}
+ subtitle={t('referralPage.subtitle')}
actions={
void refreshAll()}
disabled={dashQ.isFetching}
/>
}
/>
- {dashQ.isError && Failed to load referral dashboard.}
+ {dashQ.isError && {t('referralPage.loadError')}}
{dashQ.isLoading && (
@@ -118,31 +120,35 @@ export function ReferralPage() {
<>
{!data.programEnabled && (
- The referral program is temporarily disabled. Your network data is still visible below.
+ {t('referralPage.programDisabled')}
)}
-
-
-
+
+
+
- Your invite link
+ {t('referralPage.invite.title')}
{data.referralCode ? (
{data.bonusWithdrawable && (
-
+
)}
- void copy(data.referralCode!, 'Code')}>
+ void copy(data.referralCode!, t('profileReferral.referralCode'))}
+ >
@@ -184,25 +197,27 @@ export function ReferralPage() {
- void copy(data.referralLink, 'Link')}>
+ void copy(data.referralLink, t('profileReferral.referralLink'))}
+ >
}
- onClick={() => void copy(data.referralLink, 'Invite link')}
+ onClick={() => void copy(data.referralLink, t('profileReferral.copyInvite'))}
sx={{ alignSelf: 'flex-start' }}
>
- Copy invite link
+ {t('profileReferral.copyInvite')}
) : (
- Your referral code is not available yet.
+ {t('referralPage.invite.codeNotAvailable')}
)}
@@ -212,7 +227,7 @@ export function ReferralPage() {
- Your referrer
+ {t('referralPage.referrer.title')}
{data.referrer ? (
@@ -221,36 +236,40 @@ export function ReferralPage() {
{data.referrer.referralCode && (
- Code: {data.referrer.referralCode}
+ {t('referralPage.invite.codePrefix')}{' '}
+ {data.referrer.referralCode}
)}
- Member since {new Date(data.referrer.memberSince).toLocaleDateString()}
+ {t('referralPage.referrer.memberSince', {
+ date: new Date(data.referrer.memberSince).toLocaleDateString(i18n.language),
+ })}
) : (
- You joined without a referral code, or your referrer is not linked.
+ {t('referralPage.referrer.noReferrer')}
)}
- Commission levels
+ {t('referralPage.referrer.commissionLevels')}
{data.levels.map((l: { levelNumber: number; commissionPercent: number }) => (
))}
- {data.commissionModes.depositEnabled &&
- 'Deposit commissions apply on eligible first deposits. '}
- {data.commissionModes.withdrawalEnabled &&
- 'Withdrawal commissions apply only on prediction gains withdrawn from the main account (not deposited principal).'}
+ {data.commissionModes.depositEnabled && t('referralPage.referrer.depositHint')}
+ {data.commissionModes.withdrawalEnabled && t('referralPage.referrer.withdrawalHint')}
@@ -265,16 +284,16 @@ export function ReferralPage() {
sx={{ alignItems: { sm: 'center' }, mb: 2 }}
>
- Your referral network
+ {t('referralPage.network.title')}
setMaxDepth(Math.min(10, Math.max(1, Number(e.target.value) || 5)))}
sx={{ width: 120 }}
- helperText={`Showing ${data.maxNetworkDepth} levels`}
+ helperText={t('referralPage.network.showingLevels', { count: data.maxNetworkDepth })}
/>
@@ -285,8 +304,8 @@ export function ReferralPage() {
scrollButtons="auto"
sx={{ mb: 2, borderBottom: 1, borderColor: 'divider' }}
>
- } iconPosition="start" label="Table view" />
- } iconPosition="start" label="Tree view" />
+ } iconPosition="start" label={t('referralPage.network.tableView')} />
+ } iconPosition="start" label={t('referralPage.network.treeView')} />
{tab === 0 && }
@@ -299,7 +318,7 @@ export function ReferralPage() {
- Commission history
+ {t('referralPage.network.commissionHistory')}
{commissionsQ.isLoading ? (
diff --git a/prediqo_web/src/features/referral/components/ReferralCommissionsPanel.tsx b/prediqo_web/src/features/referral/components/ReferralCommissionsPanel.tsx
index 97fedc4f..4807be7e 100644
--- a/prediqo_web/src/features/referral/components/ReferralCommissionsPanel.tsx
+++ b/prediqo_web/src/features/referral/components/ReferralCommissionsPanel.tsx
@@ -8,6 +8,7 @@ import {
Typography,
} from '@mui/material';
import dayjs from 'dayjs';
+import { useTranslation } from 'react-i18next';
import { ScrollableTable } from '../../../shared/components/ScrollableTable';
import { rawToHuman } from '../../wallet/utils/walletFormat';
import type { ReferralCommissionItem } from '../types';
@@ -26,10 +27,12 @@ type ReferralCommissionsPanelProps = {
};
export function ReferralCommissionsPanel({ items }: ReferralCommissionsPanelProps) {
+ const { t } = useTranslation();
+
if (items.length === 0) {
return (
- No commission events yet.
+ {t('referralPage.commissions.empty')}
);
}
@@ -39,12 +42,12 @@ export function ReferralCommissionsPanel({ items }: ReferralCommissionsPanelProp
- Member
- Level
- Source
- Status
- Commission
- Date
+ {t('referralPage.commissions.member')}
+ {t('referralPage.commissions.level')}
+ {t('referralPage.commissions.source')}
+ {t('common.status')}
+ {t('referralPage.commissions.commission')}
+ {t('referralPage.commissions.date')}
@@ -56,7 +59,11 @@ export function ReferralCommissionsPanel({ items }: ReferralCommissionsPanelProp
@@ -65,7 +72,10 @@ export function ReferralCommissionsPanel({ items }: ReferralCommissionsPanelProp
{rawToHuman(c.commissionAmountRaw, USDT_DECIMALS)} USDT
- {c.commissionPercent}% of {rawToHuman(c.baseAmountRaw, USDT_DECIMALS)}
+ {t('referralPage.commissions.percentOf', {
+ percent: c.commissionPercent,
+ amount: rawToHuman(c.baseAmountRaw, USDT_DECIMALS),
+ })}
diff --git a/prediqo_web/src/features/referral/components/ReferralTableView.tsx b/prediqo_web/src/features/referral/components/ReferralTableView.tsx
index 93b4a918..65ce4948 100644
--- a/prediqo_web/src/features/referral/components/ReferralTableView.tsx
+++ b/prediqo_web/src/features/referral/components/ReferralTableView.tsx
@@ -9,18 +9,13 @@ import {
Typography,
} from '@mui/material';
import dayjs from 'dayjs';
+import { useTranslation } from 'react-i18next';
import { ScrollableTable } from '../../../shared/components/ScrollableTable';
import { rawToHuman } from '../../wallet/utils/walletFormat';
import type { ReferralNetworkMember } from '../types';
const USDT_DECIMALS = 6;
-function statusChip(status: ReferralNetworkMember['status']) {
- if (status === 'active') return ;
- if (status === 'unverified') return ;
- return ;
-}
-
function formatRaw(raw: string) {
return `${rawToHuman(raw, USDT_DECIMALS)} USDT`;
}
@@ -30,10 +25,24 @@ type ReferralTableViewProps = {
};
export function ReferralTableView({ members }: ReferralTableViewProps) {
+ const { t } = useTranslation();
+
+ function statusChip(status: ReferralNetworkMember['status']) {
+ if (status === 'active') {
+ return ;
+ }
+ if (status === 'unverified') {
+ return (
+
+ );
+ }
+ return ;
+ }
+
if (members.length === 0) {
return (
- No referrals in your network yet. Share your invite link to grow your team.
+ {t('referralPage.table.empty')}
);
}
@@ -43,15 +52,15 @@ export function ReferralTableView({ members }: ReferralTableViewProps) {
- Member
- Country
- Level
- Registered
- Status
- Direct refs
- Predictions
- Commissions
- Pending
+ {t('referralPage.table.member')}
+ {t('referralPage.table.country')}
+ {t('referralPage.table.level')}
+ {t('referralPage.table.registered')}
+ {t('common.status')}
+ {t('referralPage.table.directRefs')}
+ {t('referralPage.table.predictions')}
+ {t('referralPage.table.commissions')}
+ {t('referralPage.table.pending')}
@@ -70,9 +79,7 @@ export function ReferralTableView({ members }: ReferralTableViewProps) {
-
- {m.countryName ?? '—'}
-
+ {m.countryName ?? '—'}
@@ -89,7 +96,7 @@ export function ReferralTableView({ members }: ReferralTableViewProps) {
{BigInt(m.commissionsGeneratedRaw) > BigInt(m.commissionsPaidRaw) && (
- total {formatRaw(m.commissionsGeneratedRaw)}
+ {t('referralPage.table.total', { amount: formatRaw(m.commissionsGeneratedRaw) })}
)}
diff --git a/prediqo_web/src/features/referral/components/ReferralTreeView.tsx b/prediqo_web/src/features/referral/components/ReferralTreeView.tsx
index 278687d2..798291ad 100644
--- a/prediqo_web/src/features/referral/components/ReferralTreeView.tsx
+++ b/prediqo_web/src/features/referral/components/ReferralTreeView.tsx
@@ -11,6 +11,7 @@ import {
import ExpandMoreRoundedIcon from '@mui/icons-material/ExpandMoreRounded';
import ChevronRightRoundedIcon from '@mui/icons-material/ChevronRightRounded';
import PersonRoundedIcon from '@mui/icons-material/PersonRounded';
+import { useTranslation } from 'react-i18next';
import { rawToHuman } from '../../wallet/utils/walletFormat';
import type { ReferralNetworkMember } from '../types';
@@ -24,12 +25,20 @@ type TreeNodeProps = {
};
function TreeNode({ member, children, childMap, defaultExpanded = false }: TreeNodeProps) {
+ const { t } = useTranslation();
const [open, setOpen] = useState(defaultExpanded);
const hasChildren = children.length > 0;
const statusColor =
member.status === 'active' ? 'success' : member.status === 'unverified' ? 'warning' : 'default';
+ const statusLabel =
+ member.status === 'active'
+ ? t('referralPage.table.status.active')
+ : member.status === 'unverified'
+ ? t('referralPage.table.status.unverified')
+ : t('referralPage.table.status.registered');
+
return (
{member.displayName}
-
-
+
+
{member.directReferralsCount > 0 && (
-
+
)}
{member.countryName ? `${member.countryName} · ` : ''}
- Paid: {rawToHuman(member.commissionsPaidRaw, USDT_DECIMALS)} USDT
+ {t('referralPage.tree.paid', {
+ amount: rawToHuman(member.commissionsPaidRaw, USDT_DECIMALS),
+ })}
{BigInt(member.commissionsPendingRaw) > 0n &&
- ` · Pending: ${rawToHuman(member.commissionsPendingRaw, USDT_DECIMALS)} USDT`}
- {member.referralCode ? ` · Code: ${member.referralCode}` : ''}
+ ` · ${t('referralPage.tree.pending', {
+ amount: rawToHuman(member.commissionsPendingRaw, USDT_DECIMALS),
+ })}`}
+ {member.referralCode
+ ? ` · ${t('referralPage.tree.code', { code: member.referralCode })}`
+ : ''}
@@ -105,6 +127,8 @@ type ReferralTreeViewProps = {
};
export function ReferralTreeView({ members, rootUserId }: ReferralTreeViewProps) {
+ const { t } = useTranslation();
+
const childMap = useMemo(() => {
const map = new Map();
for (const m of members) {
@@ -123,7 +147,7 @@ export function ReferralTreeView({ members, rootUserId }: ReferralTreeViewProps)
if (directChildren.length === 0) {
return (
- Your referral tree is empty. Invite members to see the hierarchy here.
+ {t('referralPage.tree.empty')}
);
}
diff --git a/prediqo_web/src/features/reports/ReportDetailPage.tsx b/prediqo_web/src/features/reports/ReportDetailPage.tsx
index ac813c1c..36e4fe2a 100644
--- a/prediqo_web/src/features/reports/ReportDetailPage.tsx
+++ b/prediqo_web/src/features/reports/ReportDetailPage.tsx
@@ -59,7 +59,7 @@ import {
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useCallback, useEffect, useMemo, useState } from 'react';
-
+import { useTranslation, Trans } from 'react-i18next';
import { Link as RouterLink, useParams, useSearchParams } from 'react-router-dom';
import { useCountryNames } from '../countries/useCountryNames';
@@ -74,15 +74,10 @@ function toDateInputValue(value: string): string {
}
import {
-
- BULK_ACTION_CONFIRM,
-
- BULK_ACTION_LABELS,
-
+ bulkActionConfirm,
+ bulkActionLabel,
type BulkActionResult,
-
type ReportBulkAction,
-
} from './reportBulkActions';
@@ -143,12 +138,10 @@ type ReportExportJob = {
-function apiErrorMessage(err: unknown, fallback: string): string {
+function apiErrorMessage(err: unknown, fallback: string, timeoutMsg: string): string {
const e = err as { response?: { data?: { error?: string }; status?: number }; message?: string };
if (e?.response?.data?.error) return String(e.response.data.error);
- if (e?.response?.status === 503) {
- return 'La requête a pris trop de temps (volume de données élevé). Réduisez la période ou affinez les filtres.';
- }
+ if (e?.response?.status === 503) return timeoutMsg;
return e?.message ?? fallback;
}
@@ -226,6 +219,7 @@ function downloadBlob(blob: Blob, filename: string) {
export function ReportDetailPage() {
+ const { t, i18n } = useTranslation();
const theme = useTheme();
const isCompact = useMediaQuery(theme.breakpoints.down('md'));
@@ -435,11 +429,13 @@ export function ReportDetailPage() {
void queryClient.invalidateQueries({ queryKey: ['admin-report', reportKey] });
setToast({
-
- message: `${data.succeeded.length} réussi(s)${data.failed.length ? ` · ${data.failed.length} échec(s)` : ''}`,
-
+ message: t('admin.reports.detail.bulkResult', {
+ succeeded: data.succeeded.length,
+ suffix: data.failed.length
+ ? t('admin.reports.detail.bulkFailedSuffix', { failed: data.failed.length })
+ : '',
+ }),
severity: data.failed.length ? 'error' : 'success',
-
});
},
@@ -450,13 +446,13 @@ export function ReportDetailPage() {
err && typeof err === 'object' && 'response' in err
- ? String((err as { response?: { data?: { error?: string } } }).response?.data?.error ?? 'Action échouée')
+ ? String((err as { response?: { data?: { error?: string } } }).response?.data?.error ?? t('admin.reports.detail.actionFailed'))
: err instanceof Error
? err.message
- : 'Action de masse échouée';
+ : t('admin.reports.detail.bulkFailed');
setToast({ message, severity: 'error' });
@@ -524,7 +520,7 @@ export function ReportDetailPage() {
if (job.status === 'failed') {
- throw new Error(job.error ?? 'Export échoué');
+ throw new Error(job.error ?? t('admin.reports.detail.exportFailed'));
}
@@ -554,11 +550,19 @@ export function ReportDetailPage() {
);
- setToast({ message: `Export terminé (${job.rowCount.toLocaleString('fr-FR')} lignes)`, severity: 'success' });
+ setToast({
+ message: t('admin.reports.detail.exportDone', {
+ count: job.rowCount.toLocaleString(i18n.language),
+ }),
+ severity: 'success',
+ });
} catch (err) {
- setToast({ message: apiErrorMessage(err, 'Export échoué'), severity: 'error' });
+ setToast({
+ message: apiErrorMessage(err, t('admin.reports.detail.exportFailed'), t('admin.reports.detail.timeoutError')),
+ severity: 'error',
+ });
} finally {
@@ -613,7 +617,10 @@ export function ReportDetailPage() {
downloadBlob(new Blob([res.data], { type: mime }), `${reportKey}${ids?.length ? '-selection' : ''}.${format}`);
} catch (err) {
- setToast({ message: apiErrorMessage(err, 'Export échoué'), severity: 'error' });
+ setToast({
+ message: apiErrorMessage(err, t('admin.reports.detail.exportFailed'), t('admin.reports.detail.timeoutError')),
+ severity: 'error',
+ });
}
},
@@ -756,7 +763,7 @@ export function ReportDetailPage() {
{selectionCount(selection) > 0 && (
-
+
)}
@@ -784,7 +791,7 @@ export function ReportDetailPage() {
-
+
@@ -816,25 +823,25 @@ export function ReportDetailPage() {
} onClick={() => setFiltersOpen((v) => !v)}>
- Filtres
+ {t('admin.reports.detail.filters')}
} disabled={exporting} onClick={() => void exportServerAsync('xlsx')}>
- Excel (filtres)
+ {t('admin.reports.detail.exportExcelFilters')}
@@ -850,7 +857,7 @@ export function ReportDetailPage() {
- Actions de masse
+ {t('admin.reports.detail.bulkActionsTitle')}
@@ -858,19 +865,19 @@ export function ReportDetailPage() {
@@ -890,7 +897,7 @@ export function ReportDetailPage() {
>
- {BULK_ACTION_LABELS[action]}
+ {bulkActionLabel(t, action)}
@@ -898,7 +905,7 @@ export function ReportDetailPage() {
@@ -916,15 +923,15 @@ export function ReportDetailPage() {
- setSearch(e.target.value)} />
+ setSearch(e.target.value)} />
- setFrom(e.target.value)} slotProps={{ inputLabel: { shrink: true } }} />
+ setFrom(e.target.value)} slotProps={{ inputLabel: { shrink: true } }} />
- setTo(e.target.value)} slotProps={{ inputLabel: { shrink: true } }} />
+ setTo(e.target.value)} slotProps={{ inputLabel: { shrink: true } }} />
@@ -932,11 +939,11 @@ export function ReportDetailPage() {
- setFavoriteName(e.target.value)} />
+ setFavoriteName(e.target.value)} />
} onClick={saveFavorite} disabled={!favoriteName.trim()}>
- Sauver filtre
+ {t('admin.reports.detail.saveFilter')}
@@ -978,7 +985,7 @@ export function ReportDetailPage() {
{q.isError && (
- {apiErrorMessage(q.error, 'Impossible de charger ce rapport.')}
+ {apiErrorMessage(q.error, t('admin.reports.detail.loadError'), t('admin.reports.detail.timeoutError'))}
)}
@@ -996,17 +1003,29 @@ export function ReportDetailPage() {
{q.data.summary.totalAmountRaw != null && (
- Montant total : {formatRawUsdtCell(String(q.data.summary.totalAmountRaw))} USDT
+ }}
+ />
)}
{q.data.summary.totalCount != null && (
- Nombre d'opérations : {q.data.summary.totalCount.toLocaleString('fr-FR')}
+ }}
+ />
)}
{q.data.summary.uniqueUsers != null && (
- Utilisateurs distincts : {q.data.summary.uniqueUsers.toLocaleString('fr-FR')}
+ }}
+ />
)}
@@ -1016,7 +1035,9 @@ export function ReportDetailPage() {
- Export serveur en cours… {exportProgress.toLocaleString('fr-FR')} ligne(s) traitées
+ {t('admin.reports.detail.exportInProgress', {
+ count: exportProgress.toLocaleString(i18n.language),
+ })}
@@ -1090,13 +1111,14 @@ export function ReportDetailPage() {
- {integrityResult && (
-
- {integrityResult}
+ {integrityAlert && (
+
+ {integrityAlert.message}
)}
@@ -507,20 +518,20 @@ export function SecurityAdminPage() {
allowScrollButtonsMobile
sx={{ mb: 2 }}
>
-
+
- Notifications
+ {t('admin.security.tabs.notifications')}
{(notificationsQ.data?.unreadCount ?? 0) > 0 && (
)}
}
/>
-
-
-
+
+
+
{tab === 0 && (
@@ -528,27 +539,27 @@ export function SecurityAdminPage() {
setAlertFilter('open')}
/>
setAlertFilter('all')}
/>
- {alertsQ.isError && Failed to load alerts.}
+ {alertsQ.isError && {t('admin.security.alerts.loadError')}}
- Severity
- Title
- Type
- User
- Status
- Created
+ {t('admin.security.alerts.severity')}
+ {t('admin.security.alerts.title')}
+ {t('admin.security.alerts.type')}
+ {t('admin.security.alerts.user')}
+ {t('admin.security.alerts.status')}
+ {t('admin.security.alerts.created')}
@@ -578,7 +589,7 @@ export function SecurityAdminPage() {
{a.status === 'open' && (
)}
@@ -587,7 +598,7 @@ export function SecurityAdminPage() {
{alerts.length === 0 && !alertsQ.isLoading && (
- No alerts
+ {t('admin.security.alerts.empty')}
)}
@@ -613,7 +624,7 @@ export function SecurityAdminPage() {
sx={{ mb: 2, justifyContent: 'space-between', alignItems: { sm: 'center' } }}
>
- In-app notifications
+ {t('admin.security.notifications.title')}
@@ -641,7 +652,7 @@ export function SecurityAdminPage() {
{n.title}
{!n.readAt && (
)}
@@ -656,7 +667,7 @@ export function SecurityAdminPage() {
))}
{notifications.length === 0 && !notificationsQ.isLoading && (
- No notifications
+ {t('admin.security.notifications.empty')}
)}
- Approved ledger credits
+ {t('admin.security.credits.title')}
- Type
- User
- Amount
- Approved by
- Date
+ {t('common.type')}
+ {t('admin.security.credits.user')}
+ {t('admin.security.credits.amount')}
+ {t('admin.security.credits.approvedBy')}
+ {t('admin.security.credits.date')}
@@ -717,7 +728,7 @@ export function SecurityAdminPage() {
{credits.length === 0 && !creditsQ.isLoading && (
- No credits yet
+ {t('admin.security.credits.empty')}
)}
@@ -738,10 +749,10 @@ export function SecurityAdminPage() {
- Direct database changes (audit trail)
+ {t('admin.security.dbAudit.title')}
- Modifications detected outside the application layer (psql, pgAdmin, scripts, etc.).
+ {t('admin.security.dbAudit.subtitle')}
- {tamperEventsQ.isError && Failed to load DB audit events.}
+ {tamperEventsQ.isError && {t('admin.security.dbAudit.loadError')}}
- Severity
- Table
- Op
- Columns
- Source
- Processed
- When
+ {t('admin.security.dbAudit.severity')}
+ {t('admin.security.dbAudit.table')}
+ {t('admin.security.dbAudit.op')}
+ {t('admin.security.dbAudit.columns')}
+ {t('admin.security.dbAudit.source')}
+ {t('admin.security.dbAudit.processed')}
+ {t('admin.security.dbAudit.when')}
@@ -782,14 +793,14 @@ export function SecurityAdminPage() {
{ev.sourceHint}
- {ev.processedAt ? 'Yes' : 'Pending'}
+ {ev.processedAt ? t('admin.security.dbAudit.processedYes') : t('admin.security.dbAudit.processedPending')}
{new Date(ev.createdAt).toLocaleString()}
))}
{(tamperEventsQ.data?.items ?? []).length === 0 && !tamperEventsQ.isLoading && (
- No direct DB changes recorded
+ {t('admin.security.dbAudit.empty')}
)}
@@ -810,10 +821,10 @@ export function SecurityAdminPage() {
- Security alert emails
+ {t('admin.security.alertEmails.title')}
- One email per line. Encrypted at rest in the database.
+ {t('admin.security.alertEmails.subtitle')}
setEmailsText(e.target.value)}
- placeholder="admin@example.com"
+ placeholder={t('admin.security.alertEmails.placeholder')}
/>
{settingsMut.isSuccess && (
- Settings saved
+ {t('admin.security.alertEmails.saved')}
)}
@@ -868,10 +879,10 @@ export function SecurityAdminPage() {
});
}}
>
- Resolve alert
+ {t('admin.security.resolve.title')}
setReactivate(e.target.checked)}
/>
}
- label="Reactivate withdrawals and clear security hold for user"
+ label={t('admin.security.resolve.reactivate')}
/>
{resolveError && (
@@ -904,10 +915,10 @@ export function SecurityAdminPage() {
}}
disabled={resolveMut.isPending}
>
- Cancel
+ {t('common.cancel')}
@@ -921,19 +932,19 @@ export function SecurityAdminPage() {
/>
diff --git a/prediqo_web/src/features/settings/SettingsPage.tsx b/prediqo_web/src/features/settings/SettingsPage.tsx
index 3521c310..dc4bb84c 100644
--- a/prediqo_web/src/features/settings/SettingsPage.tsx
+++ b/prediqo_web/src/features/settings/SettingsPage.tsx
@@ -22,10 +22,12 @@ import SaveRoundedIcon from '@mui/icons-material/SaveRounded';
import RestartAltRoundedIcon from '@mui/icons-material/RestartAltRounded';
import { useQuery } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
/** Editable password policy and token expiration settings form. */
export function SettingsPage() {
+ const { t } = useTranslation();
type Settings = {
password_min_length: number;
password_require_uppercase: boolean;
@@ -88,7 +90,7 @@ export function SettingsPage() {
setForm(null);
setSaved(true);
} catch (e: any) {
- setSaveError(e?.response?.data?.error ?? e?.message ?? 'Failed to save settings');
+ setSaveError(e?.response?.data?.error ?? e?.message ?? t('admin.settings.saveFailed'));
} finally {
setSaving(false);
}
@@ -98,18 +100,16 @@ export function SettingsPage() {
- Settings
-
-
- Password policy, security, rate limits, withdrawals, and Candle Predict engine tuning.
+ {t('admin.settings.title')}
+ {t('admin.settings.subtitle')}
{q.isLoading ? (
- Loading settings…
+ {t('admin.settings.loading')}
) : q.isError ? (
q.refetch()}>
- Retry
+ {t('admin.settings.retry')}
}
>
- Failed to load settings.
+ {t('admin.settings.loadError')}
) : !effective ? (
- No settings loaded.
+ {t('admin.settings.noSettings')}
) : (
@@ -136,16 +136,16 @@ export function SettingsPage() {
)}
{saved && (
- Settings saved.
+ {t('admin.settings.saved')}
)}
}>
- Password policy
+ {t('admin.settings.sections.passwordPolicy.title')}
- Enforce complexity rules for all new passwords.
+ {t('admin.settings.sections.passwordPolicy.subtitle')}
@@ -160,7 +160,7 @@ export function SettingsPage() {
>
set('password_min_length', parseInt(e.target.value || '0', 10) || 0)}
type="number"
@@ -180,7 +180,7 @@ export function SettingsPage() {
onChange={(e) => set('password_require_uppercase', e.target.checked)}
/>
}
- label="Uppercase"
+ label={t('admin.settings.sections.passwordPolicy.uppercase')}
/>
set('password_require_lowercase', e.target.checked)}
/>
}
- label="Lowercase"
+ label={t('admin.settings.sections.passwordPolicy.lowercase')}
/>
set('password_require_number', e.target.checked)}
/>
}
- label="Number"
+ label={t('admin.settings.sections.passwordPolicy.number')}
/>
set('password_require_special', e.target.checked)}
/>
}
- label="Special"
+ label={t('admin.settings.sections.passwordPolicy.special')}
/>
@@ -218,9 +218,9 @@ export function SettingsPage() {
}>
- Email verification
+ {t('admin.settings.sections.emailVerification.title')}
- Require confirmed email before users can sign in.
+ {t('admin.settings.sections.emailVerification.subtitle')}
@@ -234,7 +234,7 @@ export function SettingsPage() {
}
/>
}
- label="Block login until email is verified"
+ label={t('admin.settings.sections.emailVerification.blockLogin')}
/>
@@ -242,9 +242,9 @@ export function SettingsPage() {
}>
- Token expiration
+ {t('admin.settings.sections.tokenExpiration.title')}
- Change expiry without redeploying the backend.
+ {t('admin.settings.sections.tokenExpiration.subtitle')}
@@ -258,8 +258,8 @@ export function SettingsPage() {
>
set('access_token_expiry', e.target.value)}
fullWidth
@@ -267,8 +267,8 @@ export function SettingsPage() {
set('refresh_token_expiry', e.target.value)}
fullWidth
@@ -281,9 +281,9 @@ export function SettingsPage() {
}>
- Withdrawals & safety
+ {t('admin.settings.sections.withdrawals.title')}
- Kill-switch and withdrawal limits (applied immediately after save).
+ {t('admin.settings.sections.withdrawals.subtitle')}
@@ -296,7 +296,7 @@ export function SettingsPage() {
onChange={(e) => set('allow_withdrawals', e.target.checked)}
/>
}
- label="Allow on-chain withdrawals"
+ label={t('admin.settings.sections.withdrawals.allowOnChain')}
/>
@@ -318,7 +318,7 @@ export function SettingsPage() {
@@ -329,7 +329,7 @@ export function SettingsPage() {
@@ -354,9 +354,9 @@ export function SettingsPage() {
}>
- Rate limiting
+ {t('admin.settings.sections.rateLimiting.title')}
- API and login throttling. Max limits apply within seconds; window size needs a restart.
+ {t('admin.settings.sections.rateLimiting.subtitle')}
@@ -370,8 +370,8 @@ export function SettingsPage() {
>
set('rate_limit_window_ms', parseNum(e.target.value))}
@@ -380,7 +380,7 @@ export function SettingsPage() {
set('rate_limit_max', parseNum(e.target.value))}
@@ -389,7 +389,7 @@ export function SettingsPage() {
set('login_rate_limit_max', parseNum(e.target.value))}
@@ -403,9 +403,9 @@ export function SettingsPage() {
}>
- Candle Predict engine
+ {t('admin.settings.sections.candlePredict.title')}
- Tick interval and backfill pacing (lower backfill = less DB load at scale).
+ {t('admin.settings.sections.candlePredict.subtitle')}
@@ -419,8 +419,8 @@ export function SettingsPage() {
>
@@ -431,8 +431,8 @@ export function SettingsPage() {
@@ -443,8 +443,8 @@ export function SettingsPage() {
@@ -455,8 +455,8 @@ export function SettingsPage() {
@@ -475,7 +475,7 @@ export function SettingsPage() {
disabled={saving}
startIcon={}
>
- Reset
+ {t('admin.settings.reset')}
}
>
- {saving ? 'Saving…' : 'Save settings'}
+ {saving ? t('admin.settings.saving') : t('admin.settings.save')}
diff --git a/prediqo_web/src/features/support/SupportAdminPage.tsx b/prediqo_web/src/features/support/SupportAdminPage.tsx
index 80c81238..3e8a5269 100644
--- a/prediqo_web/src/features/support/SupportAdminPage.tsx
+++ b/prediqo_web/src/features/support/SupportAdminPage.tsx
@@ -22,6 +22,7 @@ import SendRoundedIcon from '@mui/icons-material/SendRounded';
import HeadsetMicRoundedIcon from '@mui/icons-material/HeadsetMicRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useCallback, useEffect, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { useAuth } from '../../shared/auth/AuthContext';
import {
adminFetchMessages,
@@ -39,12 +40,7 @@ import { notifySupportMessage, requestSupportNotificationPermission } from './ut
import type { SupportConversation, SupportMessage } from './types';
import type { SupportWsServerMessage } from './ws/protocol';
-const STATUS_LABELS: Record = {
- open: 'Ouverte',
- pending: 'En attente',
- resolved: 'Résolue',
- closed: 'Fermée',
-};
+const STATUS_KEYS = ['open', 'pending', 'resolved', 'closed'] as const;
const STATUS_COLORS: Record = {
open: 'success',
@@ -56,9 +52,11 @@ const STATUS_COLORS: Record
function AdminMessageList({
messages,
staffTyping,
+ t,
}: {
messages: SupportMessage[];
staffTyping?: boolean;
+ t: (key: string) => string;
}) {
return (
@@ -77,7 +75,7 @@ function AdminMessageList({
>
{!isStaff && (
- {msg.senderType === 'visitor' ? 'Visiteur' : 'Utilisateur'}
+ {msg.senderType === 'visitor' ? t('admin.supportAdmin.visitor') : t('admin.supportAdmin.user')}
)}
{msg.body && (
@@ -99,7 +97,7 @@ function AdminMessageList({
)}
{new Date(msg.createdAt).toLocaleString()}
- {msg.readAt ? ' · Lu' : ''}
+ {msg.readAt ? t('admin.supportAdmin.read') : ''}
@@ -107,7 +105,7 @@ function AdminMessageList({
})}
{staffTyping && (
- Le visiteur écrit…
+ {t('admin.supportAdmin.visitorTyping')}
)}
@@ -116,6 +114,7 @@ function AdminMessageList({
/** Admin / moderator support inbox. */
export function SupportAdminPage() {
+ const { t } = useTranslation();
const { auth } = useAuth();
const qc = useQueryClient();
const [selectedId, setSelectedId] = useState(null);
@@ -142,8 +141,8 @@ export function SupportAdminPage() {
});
} else if (msg.message && msg.message.senderType !== 'staff') {
notifySupportMessage({
- title: 'Nouveau message support',
- body: msg.message.body ?? 'Message reçu',
+ title: t('admin.supportAdmin.newMessageTitle'),
+ body: msg.message.body ?? t('admin.supportAdmin.newMessageBody'),
tag: `admin-support-${msg.conversationId}`,
});
}
@@ -248,7 +247,7 @@ export function SupportAdminPage() {
- Centre d'assistance
+ {t('admin.supportAdmin.title')}
void listQ.refetch()}>
@@ -267,7 +266,7 @@ export function SupportAdminPage() {
{
setSearch(e.target.value);
@@ -276,20 +275,20 @@ export function SupportAdminPage() {
sx={{ mb: 1.5 }}
/>
- Statut
+ {t('admin.supportAdmin.status')}
{
setStatusFilter(e.target.value);
setPage(1);
}}
>
- Tous
- Ouverte
- En attente
- Résolue
- Fermée
+ {t('admin.supportAdmin.allStatuses')}
+ {t('admin.supportAdmin.statuses.open')}
+ {t('admin.supportAdmin.statuses.pending')}
+ {t('admin.supportAdmin.statuses.resolved')}
+ {t('admin.supportAdmin.statuses.closed')}
@@ -311,7 +310,7 @@ export function SupportAdminPage() {
>
- {c.isAnonymous ? 'Visiteur anonyme' : `Utilisateur ${c.userId?.slice(0, 8)}…`}
+ {c.isAnonymous ? t('admin.supportAdmin.anonymousVisitor') : t('admin.supportAdmin.userPrefix', { id: c.userId?.slice(0, 8) })}
{c.unreadStaff > 0 && (
@@ -322,7 +321,11 @@ export function SupportAdminPage() {
@@ -330,7 +333,7 @@ export function SupportAdminPage() {
))}
{!listQ.data?.items.length && (
- Aucune conversation
+ {t('admin.supportAdmin.noConversations')}
)}
@@ -349,21 +352,21 @@ export function SupportAdminPage() {
{/* Chat */}
{!selectedId ? (
- Sélectionnez une conversation
+ {t('admin.supportAdmin.selectConversation')}
) : (
<>
- Statut
+ {t('admin.supportAdmin.status')}
updateMut.mutate({ status: e.target.value })}
>
- Ouverte
- En attente
- Résolue
- Fermée
+ {t('admin.supportAdmin.statuses.open')}
+ {t('admin.supportAdmin.statuses.pending')}
+ {t('admin.supportAdmin.statuses.resolved')}
+ {t('admin.supportAdmin.statuses.closed')}
-
+
{
setDraft(e.target.value);
@@ -443,54 +446,54 @@ export function SupportAdminPage() {
{/* User context */}
- Contexte
+ {t('admin.supportAdmin.contextTitle')}
{conv?.isAnonymous && (
- Conversation anonyme — aucun compte associé.
+ {t('admin.supportAdmin.anonymousAlert')}
)}
{user ? (
- Nom : {user.displayName ?? '—'}
+ {t('admin.supportAdmin.name')} {user.displayName ?? '—'}
- ID : {user.id}
+ {t('admin.supportAdmin.id')} {user.id}
- E-mail : {user.email ?? '—'}
+ {t('admin.supportAdmin.email')} {user.email ?? '—'}
- Rôle : {user.role}
+ {t('admin.supportAdmin.role')} {user.role}
- Statut :{' '}
+ {t('admin.supportAdmin.accountStatus')}{' '}
{user.isEnabled ? (
-
+
) : (
-
+
)}
- E-mail vérifié : {user.emailVerified ? 'Oui' : 'Non'}
+ {t('admin.supportAdmin.emailVerified')} {user.emailVerified ? t('common.yes') : t('common.no')}
- Inscrit le {new Date(user.createdAt).toLocaleDateString()}
+ {t('admin.supportAdmin.registeredOn', { date: new Date(user.createdAt).toLocaleDateString() })}
) : (
!conv?.isAnonymous && (
- Chargement…
+ {t('common.loading')}
)
)}
{conv && (
- Conversation créée le {new Date(conv.createdAt).toLocaleString()}
+ {t('admin.supportAdmin.conversationCreated', { date: new Date(conv.createdAt).toLocaleString() })}
)}
diff --git a/prediqo_web/src/features/support/components/SupportChatPanel.tsx b/prediqo_web/src/features/support/components/SupportChatPanel.tsx
index 3c5e02b4..bba84781 100644
--- a/prediqo_web/src/features/support/components/SupportChatPanel.tsx
+++ b/prediqo_web/src/features/support/components/SupportChatPanel.tsx
@@ -14,6 +14,7 @@ import DoneRoundedIcon from '@mui/icons-material/DoneRounded';
import SendRoundedIcon from '@mui/icons-material/SendRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useCallback, useEffect, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import {
attachmentFullUrl,
fetchCurrentConversation,
@@ -33,13 +34,13 @@ function formatMessageTime(iso: string): string {
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
-function formatDayLabel(iso: string): string {
+function formatDayLabel(iso: string, t: (key: string) => string): string {
const d = new Date(iso);
const today = new Date();
- if (d.toDateString() === today.toDateString()) return "Aujourd'hui";
+ if (d.toDateString() === today.toDateString()) return t('support.chat.today');
const yesterday = new Date(today);
yesterday.setDate(today.getDate() - 1);
- if (d.toDateString() === yesterday.toDateString()) return 'Hier';
+ if (d.toDateString() === yesterday.toDateString()) return t('support.chat.yesterday');
return d.toLocaleDateString();
}
@@ -50,7 +51,15 @@ function ReadIndicator({ readAt }: { readAt: string | null }) {
return ;
}
-function MessageBubble({ msg, isMine }: { msg: SupportMessage; isMine: boolean }) {
+function MessageBubble({
+ msg,
+ isMine,
+ t,
+}: {
+ msg: SupportMessage;
+ isMine: boolean;
+ t: (key: string) => string;
+}) {
const isImage = msg.attachmentMime?.startsWith('image/');
return (
) : (
@@ -101,7 +110,7 @@ function MessageBubble({ msg, isMine }: { msg: SupportMessage; isMine: boolean }
variant="body2"
sx={{ color: 'inherit', fontWeight: 600 }}
>
- 📎 {msg.attachmentName ?? 'Fichier'}
+ 📎 {msg.attachmentName ?? t('support.chat.file')}
)}
@@ -124,6 +133,7 @@ type Props = {
/** WhatsApp-style support chat panel for users and anonymous visitors. */
export function SupportChatPanel({ widgetOpen = true, onOpenWidget }: Props) {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [draft, setDraft] = useState('');
const [messages, setMessages] = useState([]);
@@ -153,8 +163,8 @@ export function SupportChatPanel({ widgetOpen = true, onOpenWidget }: Props) {
});
if (msg.message.senderType === 'staff' && !widgetOpen) {
notifySupportMessage({
- title: 'Assistance Prediqo',
- body: msg.message.body ?? 'Nouveau message',
+ title: t('support.widget.title'),
+ body: msg.message.body ?? t('support.chat.newMessage'),
tag: `support-${conversationId}`,
onClick: onOpenWidget,
});
@@ -173,7 +183,7 @@ export function SupportChatPanel({ widgetOpen = true, onOpenWidget }: Props) {
);
}
},
- [conversationId, widgetOpen, onOpenWidget, qc]
+ [conversationId, widgetOpen, onOpenWidget, qc, t]
);
const { connected: wsConnected } = useSupportSocket({
@@ -266,11 +276,11 @@ export function SupportChatPanel({ widgetOpen = true, onOpenWidget }: Props) {
)}
{!convQ.isLoading && messages.length === 0 && (
- Bonjour ! Comment pouvons-nous vous aider ?
+ {t('support.chat.greeting')}
)}
{messages.map((msg) => {
- const day = formatDayLabel(msg.createdAt);
+ const day = formatDayLabel(msg.createdAt, t);
const showDay = day !== lastDay;
lastDay = day;
const isMine = msg.senderType === 'user' || msg.senderType === 'visitor';
@@ -290,13 +300,13 @@ export function SupportChatPanel({ widgetOpen = true, onOpenWidget }: Props) {
{day}
)}
-
+
);
})}
{staffTyping && (
- L'équipe est en train d'écrire…
+ {t('support.chat.typing')}
)}
@@ -318,7 +328,7 @@ export function SupportChatPanel({ widgetOpen = true, onOpenWidget }: Props) {
size="small"
multiline
maxRows={4}
- placeholder="Écrivez votre message…"
+ placeholder={t('support.chat.placeholder')}
value={draft}
onChange={(e) => onDraftChange(e.target.value)}
onKeyDown={(e) => {
diff --git a/prediqo_web/src/features/support/components/SupportWidget.tsx b/prediqo_web/src/features/support/components/SupportWidget.tsx
index ff2c339e..33269974 100644
--- a/prediqo_web/src/features/support/components/SupportWidget.tsx
+++ b/prediqo_web/src/features/support/components/SupportWidget.tsx
@@ -11,11 +11,13 @@ import {
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
import HeadsetMicRoundedIcon from '@mui/icons-material/HeadsetMicRounded';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { SupportChatPanel } from './SupportChatPanel';
import { requestSupportNotificationPermission, shouldAskNotificationPermission } from '../utils/notifications';
/** Floating support button — visible on all pages including login/register. */
export function SupportWidget() {
+ const { t } = useTranslation();
const [open, setOpen] = useState(false);
const [mounted, setMounted] = useState(false);
@@ -35,7 +37,7 @@ export function SupportWidget() {
- Assistance Prediqo
+ {t('support.widget.title')}
- Réponse en temps réel de notre équipe
+ {t('support.widget.subtitle')}
setOpen(false)} sx={{ color: 'inherit' }}>
diff --git a/prediqo_web/src/features/test-wallet/TestWalletAdminPage.tsx b/prediqo_web/src/features/test-wallet/TestWalletAdminPage.tsx
index 182cde51..b0b2c5d8 100644
--- a/prediqo_web/src/features/test-wallet/TestWalletAdminPage.tsx
+++ b/prediqo_web/src/features/test-wallet/TestWalletAdminPage.tsx
@@ -22,6 +22,7 @@ import {
import ScienceRoundedIcon from '@mui/icons-material/ScienceRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { ScrollableTable } from '../../shared/components/ScrollableTable';
import { humanToRaw, rawToHuman } from '../wallet/utils/walletFormat';
@@ -48,6 +49,7 @@ type CreditHistoryItem = {
const USDT_DECIMALS = 6;
export function TestWalletAdminPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [form, setForm] = useState(null);
const [creditDisplay, setCreditDisplay] = useState('1000');
@@ -102,7 +104,7 @@ export function TestWalletAdminPage() {
});
if (configQ.isLoading || !form) {
- return Loading test wallet settings…;
+ return {t('admin.testWallet.loading')};
}
return (
@@ -111,17 +113,15 @@ export function TestWalletAdminPage() {
- Test wallet
+ {t('admin.testWallet.title')}
-
- Configure play-money credits so new users can practice predictions before using real funds.
-
+ {t('admin.testWallet.subtitle')}
@@ -134,57 +134,57 @@ export function TestWalletAdminPage() {
onChange={(e) => setForm({ ...form, enabled: e.target.checked })}
/>
}
- label="Allow users to request test credits"
+ label={t('admin.testWallet.allowRequests')}
/>
setCreditDisplay(e.target.value)}
- helperText="Amount credited automatically when a user requests test funds"
+ helperText={t('admin.testWallet.creditHelper')}
fullWidth
/>
setForm({ ...form, maxRequestsPerUser: Math.max(0, Number(e.target.value) || 0) })
}
- helperText="0 = unlimited"
+ helperText={t('admin.testWallet.maxRequestsHelper')}
fullWidth
/>
setForm({ ...form, cooldownHours: Math.max(0, Number(e.target.value) || 0) })
}
- helperText="0 = no waiting period"
+ helperText={t('admin.testWallet.cooldownHelper')}
fullWidth
/>
{saveMut.isError && (
{(saveMut.error as { response?: { data?: { error?: string } } })?.response?.data
- ?.error ?? 'Save failed'}
+ ?.error ?? t('admin.testWallet.saveFailed')}
)}
- {saveMut.isSuccess && Settings saved.}
+ {saveMut.isSuccess && {t('admin.testWallet.saved')}}
- Credit history
+ {t('admin.testWallet.history')}
@@ -192,9 +192,9 @@ export function TestWalletAdminPage() {
- Date
- User
- Amount
+ {t('admin.testWallet.date')}
+ {t('admin.testWallet.user')}
+ {t('admin.testWallet.amount')}
@@ -212,7 +212,7 @@ export function TestWalletAdminPage() {
{!historyQ.data?.items?.length && (
- No test credits granted yet.
+ {t('admin.testWallet.noHistory')}
)}
diff --git a/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx b/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx
index a2605267..46d6d0f3 100644
--- a/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx
+++ b/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx
@@ -24,6 +24,7 @@ import {
import AccountBalanceWalletRoundedIcon from '@mui/icons-material/AccountBalanceWalletRounded';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { api } from '../../shared/services/api';
import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader';
import { ScrollableTable } from '../../shared/components/ScrollableTable';
@@ -81,6 +82,7 @@ function formatRaw(amount: string | null, decimals: number): string {
}
export function TreasuryAdminPage() {
+ const { t } = useTranslation();
const qc = useQueryClient();
const [coldForms, setColdForms] = useState>({});
const [fundingForm, setFundingForm] = useState({ walletTypeId: 2, amount: '', notes: '' });
@@ -116,7 +118,7 @@ export function TreasuryAdminPage() {
const runSweepsMut = useMutation({
mutationFn: () => api.post<{ message?: string }>('/api/v1/admin/treasury/sweeps/run'),
onSuccess: (res) => {
- setPendingMsg(res.data.message ?? 'Sweep request submitted — pending super-admin approval');
+ setPendingMsg(res.data.message ?? t('admin.treasury.sweepPending'));
void qc.invalidateQueries({ queryKey: ['admin-treasury-sweeps'] });
void qc.invalidateQueries({ queryKey: ['admin-treasury-overview'] });
},
@@ -126,7 +128,7 @@ export function TreasuryAdminPage() {
mutationFn: (body: { walletTypeId: number; amount: string; notes?: string }) =>
api.post<{ message?: string }>('/api/v1/admin/treasury/funding', body),
onSuccess: (res) => {
- setPendingMsg(res.data.message ?? 'Funding request submitted — pending super-admin approval');
+ setPendingMsg(res.data.message ?? t('admin.treasury.fundingPending'));
void qc.invalidateQueries({ queryKey: ['admin-treasury-overview'] });
setFundingForm((f) => ({ ...f, amount: '', notes: '' }));
},
@@ -147,10 +149,10 @@ export function TreasuryAdminPage() {
}
- title="Treasury"
+ title={t('admin.treasury.title')}
actions={
{
void overviewQ.refetch();
void sweepsQ.refetch();
@@ -167,7 +169,7 @@ export function TreasuryAdminPage() {
{overviewQ.isError && (
- Failed to load treasury overview.
+ {t('admin.treasury.loadError')}
)}
@@ -175,25 +177,23 @@ export function TreasuryAdminPage() {
{overview.recentPendingSweeps > 0 && (
-
+
)}
{overview.recentFailedSweeps > 0 && (
-
+
)}
{!overview.sweepEnabled && (
-
- Set SWEEP_ENABLED=true in backend .env to auto-move deposits to cold storage.
-
+ {t('admin.treasury.sweepDisabledHint')}
)}
{overview.assets.map((asset) => {
@@ -210,18 +210,22 @@ export function TreasuryAdminPage() {
- Cold: {asset.coldWallet?.address ?? '—'} · on-chain{' '}
- {formatRaw(asset.coldOnChainBalance, wt.decimals)}
+ {t('admin.treasury.coldOnChain', {
+ address: asset.coldWallet?.address ?? '—',
+ balance: formatRaw(asset.coldOnChainBalance, wt.decimals),
+ })}
- Hot: {asset.hotWallet?.address ?? '—'} · on-chain{' '}
- {formatRaw(asset.hotOnChainBalance, wt.decimals)}
+ {t('admin.treasury.hotOnChain', {
+ address: asset.hotWallet?.address ?? '—',
+ balance: formatRaw(asset.hotOnChainBalance, wt.decimals),
+ })}
@@ -233,7 +237,7 @@ export function TreasuryAdminPage() {
/>
setColdForms((prev) => ({
@@ -253,7 +257,7 @@ export function TreasuryAdminPage() {
})
}
>
- Save cold
+ {t('admin.treasury.saveCold')}
@@ -266,15 +270,15 @@ export function TreasuryAdminPage() {
- Cold → Hot funding
+ {t('admin.treasury.fundingTitle')}
- Create a request, transfer manually from cold wallet, then confirm with the blockchain transaction ID.
+ {t('admin.treasury.fundingSubtitle')}
@@ -283,13 +287,13 @@ export function TreasuryAdminPage() {
/>
setFundingForm((f) => ({ ...f, amount: e.target.value }))}
/>
setFundingForm((f) => ({ ...f, notes: e.target.value }))}
@@ -305,7 +309,7 @@ export function TreasuryAdminPage() {
})
}
>
- Request funding for approval
+ {t('admin.treasury.requestFunding')}
{overview?.pendingColdToHotFunding?.length ? (
@@ -313,8 +317,8 @@ export function TreasuryAdminPage() {
- Amount
- From → To
+ {t('admin.treasury.amount')}
+ {t('admin.treasury.fromTo')}
@@ -327,7 +331,7 @@ export function TreasuryAdminPage() {
@@ -337,7 +341,7 @@ export function TreasuryAdminPage() {
) : (
- No pending funding requests.
+ {t('admin.treasury.noPendingFunding')}
)}
@@ -351,7 +355,7 @@ export function TreasuryAdminPage() {
sx={{ alignItems: { sm: 'center' }, mb: 2 }}
>
- Deposit sweeps
+ {t('admin.treasury.sweepsTitle')}
- Status
- Amount
- To cold
- Tx
+ {t('admin.treasury.status')}
+ {t('admin.treasury.amount')}
+ {t('admin.treasury.toCold')}
+ {t('admin.treasury.tx')}
@@ -395,11 +399,11 @@ export function TreasuryAdminPage() {
diff --git a/prediqo_web/src/features/users/UserManagementPage.tsx b/prediqo_web/src/features/users/UserManagementPage.tsx
index 53bad02d..fa264bc3 100644
--- a/prediqo_web/src/features/users/UserManagementPage.tsx
+++ b/prediqo_web/src/features/users/UserManagementPage.tsx
@@ -42,6 +42,7 @@ import DownloadRoundedIcon from '@mui/icons-material/DownloadRounded';
import FilterListRoundedIcon from '@mui/icons-material/FilterListRounded';
import { useTheme } from '@mui/material/styles';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import dayjs from 'dayjs';
import { api } from '../../shared/services/api';
@@ -86,18 +87,20 @@ function UsersGridToolbar({
exportLimitLabel,
disabled,
selectedCount,
+ t,
}: {
onOpenDownload: (e: React.MouseEvent) => void;
exportLimitLabel: string;
disabled: boolean;
selectedCount: number;
+ t: ReturnType['t'];
}) {
return (
-
+
{selectedCount > 0 && (
-
+
)}
@@ -169,6 +172,7 @@ function FlagSwitch({
}
export function UserManagementPage() {
+ const { t } = useTranslation();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
const qc = useQueryClient();
@@ -382,7 +386,7 @@ export function UserManagementPage() {
setToast(failed ? `${ok} succeeded, ${failed} failed` : `${ok} user(s) updated`);
},
onError: (e: any) => {
- setToast(e?.response?.data?.error ?? e?.message ?? 'Batch operation failed');
+ setToast(e?.response?.data?.error ?? e?.message ?? t('admin.users.batchFailed'));
},
});
@@ -392,12 +396,12 @@ export function UserManagementPage() {
return res.data;
},
onSuccess: () => {
- setToast('Email marked as verified');
+ setToast(t('admin.users.emailVerified'));
void qc.invalidateQueries({ queryKey: ['admin-users'] });
},
onError: (e: unknown) => {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setToast(err?.response?.data?.error ?? err?.message ?? 'Failed to verify email');
+ setToast(err?.response?.data?.error ?? err?.message ?? t('admin.users.emailVerifyFailed'));
},
});
@@ -406,12 +410,12 @@ export function UserManagementPage() {
api.patch(`/api/v1/admin/users/${body.userId}/roles`, { roles: body.roles }),
onSuccess: () => {
setRoleDialog(null);
- setToast('Roles updated');
+ setToast(t('admin.users.rolesUpdated'));
void qc.invalidateQueries({ queryKey: ['admin-users'] });
},
onError: (e: unknown) => {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setToast(err?.response?.data?.error ?? err?.message ?? 'Role update failed');
+ setToast(err?.response?.data?.error ?? err?.message ?? t('admin.users.roleUpdateFailed'));
},
});
@@ -435,10 +439,10 @@ export function UserManagementPage() {
const users = q.data?.users ?? [];
const total = cachedTotal ?? q.data?.total ?? 0;
const totalLabel = q.isLoading
- ? 'Loading…'
+ ? t('common.loading')
: totalIsExact
- ? `${total} user(s)`
- : `~${total.toLocaleString()} user(s) (est.)`;
+ ? t('admin.users.totalExact', { count: total })
+ : t('admin.users.totalEstimate', { count: total.toLocaleString() });
const selectedIds = useMemo(() => {
if (rowSelection.type === 'include') {
return [...rowSelection.ids].map(String);
@@ -449,21 +453,21 @@ export function UserManagementPage() {
const copy = async (text: string) => {
try {
await navigator.clipboard.writeText(text);
- setToast('Copied to clipboard');
+ setToast(t('admin.users.copied'));
} catch {
- setToast('Copy failed');
+ setToast(t('admin.users.copyFailed'));
}
};
const onToggle = useCallback((u: AdminUser, field: NonNullable['field'], next: boolean) => {
- const fieldLabel = field;
+ const fieldLabel = t(`admin.users.fields.${field}`);
setConfirm({
userId: u.id,
label: `${u.email ?? u.id} · ${fieldLabel}`,
field,
next,
});
- }, []);
+ }, [t]);
const applyToggle = async () => {
if (!confirm) return;
@@ -492,45 +496,45 @@ export function UserManagementPage() {
setConfirm(null);
void q.refetch();
} catch (e: any) {
- setToast(e?.response?.data?.error ?? e?.message ?? 'Update failed');
+ setToast(e?.response?.data?.error ?? e?.message ?? t('admin.users.updateFailed'));
}
};
const columns = useMemo(
() => [
- { field: 'id', headerName: 'ID', width: 180, sortable: true },
+ { field: 'id', headerName: t('admin.users.columns.id'), width: 180, sortable: true },
{
field: 'email',
- headerName: 'Email',
+ headerName: t('admin.users.columns.email'),
width: 280,
valueGetter: (_v: unknown, row: AdminUser) => row.email ?? '—',
},
{
field: 'full_name',
- headerName: 'Full name',
+ headerName: t('admin.users.columns.fullName'),
width: 200,
sortable: false,
valueGetter: (_v: unknown, row: AdminUser) => fullName(row),
},
{
field: 'account_status',
- headerName: 'Status',
+ headerName: t('admin.users.columns.status'),
width: 120,
sortable: false,
renderCell: (p: { row: AdminUser }) => {
const status = deriveAccountStatus(p.row);
- const reasons = accountStatusReasons(p.row);
+ const reasons = accountStatusReasons(t, p.row);
const tip =
status === 'active'
- ? 'Account fully active'
+ ? t('admin.users.accountStatus.fullyActive')
: reasons.length
? reasons.join(' · ')
- : status;
+ : t(`admin.users.accountStatus.${status}`);
return (
@@ -540,17 +544,17 @@ export function UserManagementPage() {
},
{
field: 'email_verified',
- headerName: 'Email OK',
+ headerName: t('admin.users.columns.emailOk'),
width: 110,
sortable: true,
renderCell: (p: { row: AdminUser }) =>
p.row.email_verified ? (
-
+
) : (
-
+
{
@@ -565,11 +569,11 @@ export function UserManagementPage() {
},
{
field: 'role_name',
- headerName: 'Role',
+ headerName: t('admin.users.columns.role'),
width: 120,
sortable: true,
renderCell: (p: { row: AdminUser }) => (
-
+
countryLabel(row.country_of_residence),
},
{
field: 'nationality',
- headerName: 'Nationality',
+ headerName: t('admin.users.columns.nationality'),
width: 160,
sortable: false,
valueGetter: (_v: unknown, row: AdminUser) => countryLabel(row.nationality),
},
{
field: 'date_of_birth',
- headerName: 'DOB',
+ headerName: t('admin.users.columns.dob'),
width: 110,
sortable: false,
valueGetter: (_v: unknown, row: AdminUser) => formatDateOfBirth(row.date_of_birth),
},
{
field: 'age_category',
- headerName: 'Age group',
+ headerName: t('admin.users.columns.ageGroup'),
width: 110,
sortable: false,
- valueGetter: (_v: unknown, row: AdminUser) => ageCategory(row.date_of_birth),
+ valueGetter: (_v: unknown, row: AdminUser) => ageCategory(t, row.date_of_birth),
},
{
field: 'referral_code',
- headerName: 'Referral code',
+ headerName: t('admin.users.columns.referralCode'),
width: 130,
sortable: false,
valueGetter: (_v: unknown, row: AdminUser) => row.referral_code ?? '—',
},
{
field: 'first_deposit_at',
- headerName: 'First deposit',
+ headerName: t('admin.users.columns.firstDeposit'),
width: 150,
sortable: false,
valueGetter: (_v: unknown, row: AdminUser) => formatDate(row.first_deposit_at),
},
{
field: 'first_deposit_transaction_id',
- headerName: 'First deposit tx',
+ headerName: t('admin.users.columns.firstDepositTx'),
width: 180,
sortable: false,
valueGetter: (_v: unknown, row: AdminUser) => row.first_deposit_transaction_id ?? '—',
},
{
field: 'main_balance_raw',
- headerName: 'Main USDT',
+ headerName: t('admin.users.columns.mainUsdt'),
width: 120,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatUsdt(row.main_balance_raw),
},
{
field: 'bonus_balance_raw',
- headerName: 'Bonus USDT',
+ headerName: t('admin.users.columns.bonusUsdt'),
width: 120,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatUsdt(row.bonus_balance_raw),
},
{
field: 'total_bonus_received_raw',
- headerName: 'Bonus received',
+ headerName: t('admin.users.columns.bonusReceived'),
width: 130,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatUsdt(row.total_bonus_received_raw),
},
{
field: 'prediction_count',
- headerName: 'Predictions',
+ headerName: t('admin.users.columns.predictions'),
width: 110,
sortable: true,
type: 'number' as const,
},
{
field: 'net_pnl_raw',
- headerName: 'Net P/L',
+ headerName: t('admin.users.columns.netPnl'),
width: 130,
sortable: true,
description: 'Cumulative result on Candle Predict: total payouts minus total stakes (USDT).',
@@ -686,42 +690,42 @@ export function UserManagementPage() {
},
{
field: 'total_stake_raw',
- headerName: 'Total stake',
+ headerName: t('admin.users.columns.totalStake'),
width: 110,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatUsdt(row.total_stake_raw),
},
{
field: 'total_payout_raw',
- headerName: 'Total payout',
+ headerName: t('admin.users.columns.totalPayout'),
width: 110,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatUsdt(row.total_payout_raw),
},
{
field: 'created_at',
- headerName: 'Created',
+ headerName: t('admin.users.columns.created'),
width: 150,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatDate(row.created_at),
},
{
field: 'last_login_at',
- headerName: 'Last login',
+ headerName: t('admin.users.columns.lastLogin'),
width: 150,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatDate(row.last_login_at),
},
{
field: 'last_activity_at',
- headerName: 'Last activity',
+ headerName: t('admin.users.columns.lastActivity'),
width: 150,
sortable: true,
valueGetter: (_v: unknown, row: AdminUser) => formatDate(row.last_activity_at),
},
{
field: 'is_enabled',
- headerName: 'Enabled',
+ headerName: t('admin.users.columns.enabled'),
width: 100,
sortable: true,
align: 'center' as const,
@@ -729,14 +733,14 @@ export function UserManagementPage() {
renderCell: (p: { row: AdminUser }) => (
onToggle(p.row, 'isEnabled', v)}
/>
),
},
{
field: 'withdrawals_suspended',
- headerName: 'Wd. suspended',
+ headerName: t('admin.users.columns.wdSuspended'),
width: 120,
sortable: false,
align: 'center' as const,
@@ -744,14 +748,14 @@ export function UserManagementPage() {
renderCell: (p: { row: AdminUser }) => (
onToggle(p.row, 'withdrawalsSuspended', v)}
/>
),
},
{
field: 'under_surveillance',
- headerName: 'Surveillance',
+ headerName: t('admin.users.columns.surveillance'),
width: 110,
sortable: false,
align: 'center' as const,
@@ -759,23 +763,23 @@ export function UserManagementPage() {
renderCell: (p: { row: AdminUser }) => (
onToggle(p.row, 'underSurveillance', v)}
/>
),
},
{
field: 'totp_enabled',
- headerName: '2FA',
+ headerName: t('admin.users.columns.twoFa'),
width: 80,
sortable: false,
renderCell: (p: { row: AdminUser }) => (
-
+
),
},
{
field: 'is_account_non_expired',
- headerName: 'Non expired',
+ headerName: t('admin.users.columns.nonExpired'),
width: 120,
sortable: false,
align: 'center' as const,
@@ -783,14 +787,14 @@ export function UserManagementPage() {
renderCell: (p: { row: AdminUser }) => (
onToggle(p.row, 'isAccountNonExpired', v)}
/>
),
},
{
field: 'is_account_non_locked',
- headerName: 'Non locked',
+ headerName: t('admin.users.columns.nonLocked'),
width: 120,
sortable: false,
align: 'center' as const,
@@ -798,14 +802,14 @@ export function UserManagementPage() {
renderCell: (p: { row: AdminUser }) => (
onToggle(p.row, 'isAccountNonLocked', v)}
/>
),
},
{
field: 'is_credentials_non_expired',
- headerName: 'Creds valid',
+ headerName: t('admin.users.columns.credsValid'),
width: 120,
sortable: false,
align: 'center' as const,
@@ -813,26 +817,26 @@ export function UserManagementPage() {
renderCell: (p: { row: AdminUser }) => (
onToggle(p.row, 'isCredentialsNonExpired', v)}
/>
),
},
{
field: 'actions',
- headerName: 'Copy',
+ headerName: t('admin.users.columns.copy'),
width: 90,
sortable: false,
renderCell: (p: { row: AdminUser }) => (
-
- copy(p.row.id)} aria-label="Copy user id">
+
+ copy(p.row.id)} aria-label={t('admin.users.tooltips.copyUserId')}>
{p.row.email && (
-
- copy(p.row.email!)} aria-label="Copy email">
+
+ copy(p.row.email!)} aria-label={t('admin.users.tooltips.copyEmail')}>
@@ -841,83 +845,83 @@ export function UserManagementPage() {
),
},
],
- [copy, onToggle, countryLabel, verifyEmailMut, openRoleDialog]
+ [copy, onToggle, countryLabel, verifyEmailMut, openRoleDialog, t]
);
const exportColumnDefs = useMemo(
() => [
- { field: 'id', header: 'ID', get: (u: AdminUser) => u.id },
- { field: 'email', header: 'Email', get: (u: AdminUser) => u.email ?? '' },
- { field: 'full_name', header: 'Full name', get: (u: AdminUser) => fullName(u) },
- { field: 'account_status', header: 'Account status', get: (u: AdminUser) => deriveAccountStatus(u) },
- { field: 'role_name', header: 'Role', get: (u: AdminUser) => u.role_name },
+ { field: 'id', header: t('admin.users.columns.id'), get: (u: AdminUser) => u.id },
+ { field: 'email', header: t('admin.users.columns.email'), get: (u: AdminUser) => u.email ?? '' },
+ { field: 'full_name', header: t('admin.users.columns.fullName'), get: (u: AdminUser) => fullName(u) },
+ { field: 'account_status', header: t('admin.users.columns.status'), get: (u: AdminUser) => deriveAccountStatus(u) },
+ { field: 'role_name', header: t('admin.users.columns.role'), get: (u: AdminUser) => u.role_name },
{
field: 'country_of_residence',
- header: 'Country',
+ header: t('admin.users.columns.country'),
get: (u: AdminUser) => countryLabel(u.country_of_residence),
},
{
field: 'nationality',
- header: 'Nationality',
+ header: t('admin.users.columns.nationality'),
get: (u: AdminUser) => countryLabel(u.nationality),
},
- { field: 'date_of_birth', header: 'DOB', get: (u: AdminUser) => formatDateOfBirth(u.date_of_birth) },
- { field: 'age_category', header: 'Age group', get: (u: AdminUser) => ageCategory(u.date_of_birth) },
- { field: 'referral_code', header: 'Referral code', get: (u: AdminUser) => u.referral_code ?? '' },
+ { field: 'date_of_birth', header: t('admin.users.columns.dob'), get: (u: AdminUser) => formatDateOfBirth(u.date_of_birth) },
+ { field: 'age_category', header: t('admin.users.columns.ageGroup'), get: (u: AdminUser) => ageCategory(t, u.date_of_birth) },
+ { field: 'referral_code', header: t('admin.users.columns.referralCode'), get: (u: AdminUser) => u.referral_code ?? '' },
{
field: 'first_deposit_at',
- header: 'First deposit',
+ header: t('admin.users.columns.firstDeposit'),
get: (u: AdminUser) => formatDate(u.first_deposit_at),
},
{
field: 'first_deposit_transaction_id',
- header: 'First deposit tx ID',
+ header: t('admin.users.columns.firstDepositTx'),
get: (u: AdminUser) => u.first_deposit_transaction_id ?? '',
},
- { field: 'email_verified', header: 'Email verified', get: (u: AdminUser) => (u.email_verified ? 'yes' : 'no') },
- { field: 'main_balance_raw', header: 'Main USDT', get: (u: AdminUser) => formatUsdt(u.main_balance_raw) },
- { field: 'bonus_balance_raw', header: 'Bonus USDT', get: (u: AdminUser) => formatUsdt(u.bonus_balance_raw) },
+ { field: 'email_verified', header: t('admin.users.filterLabels.emailVerified'), get: (u: AdminUser) => (u.email_verified ? 'yes' : 'no') },
+ { field: 'main_balance_raw', header: t('admin.users.columns.mainUsdt'), get: (u: AdminUser) => formatUsdt(u.main_balance_raw) },
+ { field: 'bonus_balance_raw', header: t('admin.users.columns.bonusUsdt'), get: (u: AdminUser) => formatUsdt(u.bonus_balance_raw) },
{
field: 'total_bonus_received_raw',
- header: 'Bonus received',
+ header: t('admin.users.columns.bonusReceived'),
get: (u: AdminUser) => formatUsdt(u.total_bonus_received_raw),
},
- { field: 'prediction_count', header: 'Predictions', get: (u: AdminUser) => String(u.prediction_count) },
- { field: 'net_pnl_raw', header: 'Net P/L USDT', get: (u: AdminUser) => formatSignedUsdt(u.net_pnl_raw) },
- { field: 'total_stake_raw', header: 'Total stake', get: (u: AdminUser) => formatUsdt(u.total_stake_raw) },
- { field: 'total_payout_raw', header: 'Total payout', get: (u: AdminUser) => formatUsdt(u.total_payout_raw) },
- { field: 'created_at', header: 'Created', get: (u: AdminUser) => formatDate(u.created_at) },
- { field: 'last_login_at', header: 'Last login', get: (u: AdminUser) => formatDate(u.last_login_at) },
- { field: 'last_activity_at', header: 'Last activity', get: (u: AdminUser) => formatDate(u.last_activity_at) },
- { field: 'is_enabled', header: 'Enabled', get: (u: AdminUser) => (u.is_enabled ? 'true' : 'false') },
+ { field: 'prediction_count', header: t('admin.users.columns.predictions'), get: (u: AdminUser) => String(u.prediction_count) },
+ { field: 'net_pnl_raw', header: t('admin.users.columns.netPnl'), get: (u: AdminUser) => formatSignedUsdt(u.net_pnl_raw) },
+ { field: 'total_stake_raw', header: t('admin.users.columns.totalStake'), get: (u: AdminUser) => formatUsdt(u.total_stake_raw) },
+ { field: 'total_payout_raw', header: t('admin.users.columns.totalPayout'), get: (u: AdminUser) => formatUsdt(u.total_payout_raw) },
+ { field: 'created_at', header: t('admin.users.columns.created'), get: (u: AdminUser) => formatDate(u.created_at) },
+ { field: 'last_login_at', header: t('admin.users.columns.lastLogin'), get: (u: AdminUser) => formatDate(u.last_login_at) },
+ { field: 'last_activity_at', header: t('admin.users.columns.lastActivity'), get: (u: AdminUser) => formatDate(u.last_activity_at) },
+ { field: 'is_enabled', header: t('admin.users.columns.enabled'), get: (u: AdminUser) => (u.is_enabled ? 'true' : 'false') },
{
field: 'withdrawals_suspended',
- header: 'Withdrawals suspended',
+ header: t('admin.users.fields.withdrawalsSuspended'),
get: (u: AdminUser) => (u.withdrawals_suspended ? 'true' : 'false'),
},
{
field: 'under_surveillance',
- header: 'Under surveillance',
+ header: t('admin.users.fields.underSurveillance'),
get: (u: AdminUser) => (u.under_surveillance ? 'true' : 'false'),
},
- { field: 'totp_enabled', header: '2FA', get: (u: AdminUser) => (u.totp_enabled ? 'yes' : 'no') },
+ { field: 'totp_enabled', header: t('admin.users.columns.twoFa'), get: (u: AdminUser) => (u.totp_enabled ? 'yes' : 'no') },
{
field: 'is_account_non_expired',
- header: 'Account non expired',
+ header: t('admin.users.fields.isAccountNonExpired'),
get: (u: AdminUser) => (u.is_account_non_expired ? 'true' : 'false'),
},
{
field: 'is_account_non_locked',
- header: 'Account non locked',
+ header: t('admin.users.fields.isAccountNonLocked'),
get: (u: AdminUser) => (u.is_account_non_locked ? 'true' : 'false'),
},
{
field: 'is_credentials_non_expired',
- header: 'Credentials valid',
+ header: t('admin.users.fields.isCredentialsNonExpired'),
get: (u: AdminUser) => (u.is_credentials_non_expired ? 'true' : 'false'),
},
],
- [countryLabel]
+ [countryLabel, t]
);
useEffect(() => {
@@ -961,9 +965,9 @@ export function UserManagementPage() {
const exportLimitLabel = useMemo(() => {
const n = exportLimitInput.trim() ? parseInt(exportLimitInput.trim(), 10) : 0;
- if (Number.isFinite(n) && n > 0) return `Export limit: ${n}`;
- return 'Export limit: 100k (server)';
- }, [exportLimitInput]);
+ if (Number.isFinite(n) && n > 0) return t('admin.users.exportLimit', { count: n });
+ return t('admin.users.exportLimitDefault');
+ }, [exportLimitInput, t]);
const sleep = (ms: number) => new Promise((resolve) => window.setTimeout(resolve, ms));
@@ -976,7 +980,7 @@ export function UserManagementPage() {
setExportProgress(0);
if (selectedOnly && selectedIds.length === 0) {
- setToast('No users selected');
+ setToast(t('admin.users.noUsersSelected'));
return;
}
@@ -1017,7 +1021,7 @@ export function UserManagementPage() {
}
if (job.status === 'failed') {
- throw new Error(job.error ?? 'Export failed');
+ throw new Error(job.error ?? t('admin.users.exportFailed'));
}
const download = await api.get(`/api/v1/admin/users/export/${job.id}/download`, {
@@ -1033,7 +1037,7 @@ export function UserManagementPage() {
setToast(`Exported ${job.rowCount} row(s)`);
} catch (e: unknown) {
const err = e as { response?: { data?: { error?: string } }; message?: string };
- setToast(err?.response?.data?.error ?? err?.message ?? 'Export failed');
+ setToast(err?.response?.data?.error ?? err?.message ?? t('admin.users.exportFailed'));
} finally {
setExporting(false);
setExportProgress(null);
@@ -1069,7 +1073,7 @@ export function UserManagementPage() {
} else if (batchDialog === 'bonus') {
const amountRaw = humanToRaw(batchBonusForm.amountDisplay, USDT_DECIMALS);
if (amountRaw === '0') {
- setToast('Enter a valid bonus amount');
+ setToast(t('admin.users.invalidBonusAmount'));
return;
}
batchMut.mutate({
@@ -1084,22 +1088,22 @@ export function UserManagementPage() {
const batchLabel =
batchDialog === 'enable'
- ? 'Enable accounts'
+ ? t('admin.users.batch.enableAccounts')
: batchDialog === 'disable'
- ? 'Disable accounts'
+ ? t('admin.users.batch.disableAccounts')
: batchDialog === 'suspend'
- ? 'Suspend withdrawals'
+ ? t('admin.users.batch.suspendAccounts')
: batchDialog === 'reactivate'
- ? 'Reactivate withdrawals'
- : 'Grant bonus';
+ ? t('admin.users.batch.reactivateAccounts')
+ : t('admin.users.batch.grantBonusTitle');
return (