|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | | -import { useLocale } from 'next-intl'; |
| 3 | +import { useLocale, useTranslations } from 'next-intl'; |
4 | 4 | import { savePendingQuizResult } from '@/lib/guest-quiz'; |
5 | 5 | import { useReducer, useTransition } from 'react'; |
6 | 6 | import { useAntiCheat } from '@/hooks/useAntiCheat'; |
@@ -114,6 +114,7 @@ export function QuizContainer({ |
114 | 114 | timeLimitSeconds, |
115 | 115 | onBackToTopics, |
116 | 116 | }: QuizContainerProps) { |
| 117 | + const tRules = useTranslations('quiz.rules'); |
117 | 118 | const [isPending, startTransition] = useTransition(); |
118 | 119 | const [state, dispatch] = useReducer(quizReducer, { |
119 | 120 | status: 'rules', |
@@ -230,59 +231,56 @@ const locale = useLocale(); |
230 | 231 | return ( |
231 | 232 | <div className="max-w-2xl mx-auto space-y-6 p-6 rounded-xl border border-gray-200 dark:border-gray-800"> |
232 | 233 | <h2 className="text-2xl font-bold text-gray-900 dark:text-gray-100"> |
233 | | - Правила проходження квізу |
| 234 | + {tRules('title')} |
234 | 235 | </h2> |
235 | 236 |
|
236 | 237 | <div className="space-y-4 text-gray-700 dark:text-gray-300"> |
237 | 238 | <div className="flex gap-3"> |
238 | 239 | <span className="text-xl">📝</span> |
239 | 240 | <div> |
240 | | - <p className="font-medium">Загальні правила</p> |
| 241 | + <p className="font-medium">{tRules('general.title')}</p> |
241 | 242 | <p className="text-sm text-gray-600 dark:text-gray-400"> |
242 | | - Відповідайте на питання чесно. Кожне питання має тільки одну |
243 | | - правильну відповідь. |
| 243 | + {tRules('general.description')} |
244 | 244 | </p> |
245 | 245 | </div> |
246 | 246 | </div> |
247 | 247 |
|
248 | 248 | <div className="flex gap-3"> |
249 | 249 | <span className="text-xl">🚫</span> |
250 | 250 | <div> |
251 | | - <p className="font-medium">Заборонено</p> |
| 251 | + <p className="font-medium">{tRules('forbidden.title')}</p> |
252 | 252 | <ul className="text-sm text-gray-600 dark:text-gray-400 list-disc list-inside space-y-1"> |
253 | | - <li>Копіювання та вставка тексту</li> |
254 | | - <li>Використання контекстного меню (права кнопка миші)</li> |
255 | | - <li>Переключення на інші вкладки або програми</li> |
256 | | - <li>Використання сторонніх джерел інформації</li> |
| 253 | + <li>{tRules('forbidden.copyPaste')}</li> |
| 254 | + <li>{tRules('forbidden.contextMenu')}</li> |
| 255 | + <li>{tRules('forbidden.tabSwitch')}</li> |
| 256 | + <li>{tRules('forbidden.externalSources')}</li> |
257 | 257 | </ul> |
258 | 258 | </div> |
259 | 259 | </div> |
260 | 260 |
|
261 | 261 | <div className="flex gap-3"> |
262 | 262 | <span className="text-xl">⚠️</span> |
263 | 263 | <div> |
264 | | - <p className="font-medium">Система контролю</p> |
| 264 | + <p className="font-medium">{tRules('control.title')}</p> |
265 | 265 | <p className="text-sm text-gray-600 dark:text-gray-400"> |
266 | | - Порушення правил фіксуються автоматично. При 3+ порушеннях |
267 | | - результат не зараховується до рейтингу. |
| 266 | + {tRules('control.description')} |
268 | 267 | </p> |
269 | 268 | </div> |
270 | 269 | </div> |
271 | 270 |
|
272 | 271 | <div className="flex gap-3"> |
273 | 272 | <span className="text-xl">⏱️</span> |
274 | 273 | <div> |
275 | | - <p className="font-medium">Час проходження</p> |
| 274 | + <p className="font-medium">{tRules('time.title')}</p> |
276 | 275 | <p className="text-sm text-gray-600 dark:text-gray-400"> |
277 | | - Мінімальний час: {totalQuestions * 3} секунд (по 3 секунди на |
278 | | - питання). Занадто швидке проходження не зараховується. |
| 276 | + {tRules('time.description', { seconds: totalQuestions * 3 })} |
279 | 277 | </p> |
280 | 278 | </div> |
281 | 279 | </div> |
282 | 280 | </div> |
283 | 281 |
|
284 | 282 | <Button onClick={handleStart} className="w-full" size="lg"> |
285 | | - Почати квіз |
| 283 | + {tRules('startButton')} |
286 | 284 | </Button> |
287 | 285 | </div> |
288 | 286 | ); |
|
0 commit comments