@@ -114,9 +121,9 @@ export function Exercise() {
value={selectedExercise}
onChange={e => setSelectedExercise(e.target.value as Exercise)}
>
- {Object.keys(EXERCISE_PHASES).map(exercise => (
-
))}
diff --git a/src/components/modals/isochronic/isochronic.tsx b/src/components/modals/isochronic/isochronic.tsx
index 75222e9..63ca203 100644
--- a/src/components/modals/isochronic/isochronic.tsx
+++ b/src/components/modals/isochronic/isochronic.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState, useRef, useCallback } from 'react';
-
+import { useTranslation } from 'react-i18next';
import { Modal } from '@/components/modal';
import { Slider } from '@/components/slider';
@@ -14,18 +14,50 @@ interface Preset {
baseFrequency: number;
beatFrequency: number;
name: string;
+ translationKey: string;
}
const presets: Preset[] = [
- { baseFrequency: 100, beatFrequency: 2, name: 'Delta (Deep Sleep) 2 Hz' },
- { baseFrequency: 100, beatFrequency: 5, name: 'Theta (Meditation) 5 Hz' },
- { baseFrequency: 100, beatFrequency: 10, name: 'Alpha (Relaxation) 10 Hz' },
- { baseFrequency: 100, beatFrequency: 20, name: 'Beta (Focus) 20 Hz' },
- { baseFrequency: 100, beatFrequency: 40, name: 'Gamma (Cognition) 40 Hz' },
- { baseFrequency: 440, beatFrequency: 10, name: 'Custom' },
+ {
+ baseFrequency: 100,
+ beatFrequency: 2,
+ name: 'Delta (Deep Sleep) 2 Hz',
+ translationKey: 'modals.generators.presets.delta',
+ },
+ {
+ baseFrequency: 100,
+ beatFrequency: 5,
+ name: 'Theta (Meditation) 5 Hz',
+ translationKey: 'modals.generators.presets.theta',
+ },
+ {
+ baseFrequency: 100,
+ beatFrequency: 10,
+ name: 'Alpha (Relaxation) 10 Hz',
+ translationKey: 'modals.generators.presets.alpha',
+ },
+ {
+ baseFrequency: 100,
+ beatFrequency: 20,
+ name: 'Beta (Focus) 20 Hz',
+ translationKey: 'modals.generators.presets.beta',
+ },
+ {
+ baseFrequency: 100,
+ beatFrequency: 40,
+ name: 'Gamma (Cognition) 40 Hz',
+ translationKey: 'modals.generators.presets.gamma',
+ },
+ {
+ baseFrequency: 440,
+ beatFrequency: 10,
+ name: 'Custom',
+ translationKey: 'modals.generators.presets.custom',
+ },
];
export function IsochronicModal({ onClose, show }: IsochronicProps) {
+ const { t } = useTranslation();
const [baseFrequency, setBaseFrequency] = useState
(440); // Default A4 note
const [beatFrequency, setBeatFrequency] = useState(10); // Default 10 Hz beat
const [volume, setVolume] = useState(0.5); // Default volume at 50%
@@ -164,17 +196,17 @@ export function IsochronicModal({ onClose, show }: IsochronicProps) {
return (
diff --git a/src/components/toolbox/notepad/notepad.tsx b/src/components/toolbox/notepad/notepad.tsx
index 921556f..636394e 100644
--- a/src/components/toolbox/notepad/notepad.tsx
+++ b/src/components/toolbox/notepad/notepad.tsx
@@ -3,7 +3,7 @@ import { BiTrash } from 'react-icons/bi/index';
import { LuCopy, LuDownload } from 'react-icons/lu/index';
import { FaCheck } from 'react-icons/fa6/index';
import { FaUndo } from 'react-icons/fa/index';
-
+import { useTranslation } from 'react-i18next';
import { Modal } from '@/components/modal';
import { Button } from './button';
@@ -19,6 +19,7 @@ interface NotepadProps {
}
export function Notepad({ onClose, show }: NotepadProps) {
+ const { t } = useTranslation();
const textareaRef = useRef(null);
const note = useNoteStore(state => state.note);
@@ -45,26 +46,42 @@ export function Notepad({ onClose, show }: NotepadProps) {
if (e.key === 'Escape') onClose();
};
+ const counterOptions = {
+ chars: characters,
+ chars_plural:
+ characters !== 1 ? t('common.plural-suffix', { defaultValue: 's' }) : '',
+ words: words,
+ words_plural:
+ words !== 1 ? t('common.plural-suffix', { defaultValue: 's' }) : '',
+ };
+
+ const clearOrRestoreTooltip = history
+ ? t('modals.notepad.restore-tooltip')
+ : t('modals.notepad.clear-tooltip');
+ const copyTooltip = copying
+ ? t('common.copied')
+ : t('modals.notepad.copy-tooltip');
+
return (
- Your Note
+ {t('modals.notepad.title-label')}
: }
- tooltip="Copy Note"
+ tooltip={copyTooltip}
onClick={() => copy(note)}
/>
}
- tooltip="Download Note"
- onClick={() => download('Moodit Note.txt', note)}
+ tooltip={t('modals.notepad.download-tooltip')}
+ onClick={() => download('Moodist Note.txt', note)}
/>
: }
recommended={!!history}
- tooltip={history ? 'Restore Note' : 'Clear Note'}
+ tooltip={clearOrRestoreTooltip}
onClick={() => (history ? restore() : clear())}
/>
@@ -73,7 +90,7 @@ export function Notepad({ onClose, show }: NotepadProps) {
- {characters} character{characters !== 1 && 's'} • {words} word
- {words !== 1 && 's'}
+ {t('modals.notepad.counter-stats', counterOptions)}
);
diff --git a/src/components/toolbox/pomodoro/pomodoro.tsx b/src/components/toolbox/pomodoro/pomodoro.tsx
index 7d6ea7b..42b731f 100644
--- a/src/components/toolbox/pomodoro/pomodoro.tsx
+++ b/src/components/toolbox/pomodoro/pomodoro.tsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useRef, useMemo } from 'react';
import { FaUndo, FaPlay, FaPause } from 'react-icons/fa/index';
import { IoMdSettings } from 'react-icons/io/index';
-
+import { useTranslation } from 'react-i18next';
import { Modal } from '@/components/modal';
import { Button } from '../generics/button';
import { Timer } from './timer';
@@ -12,7 +12,6 @@ import { useLocalStorage } from '@/hooks/use-local-storage';
import { useSoundEffect } from '@/hooks/use-sound-effect';
import { usePomodoroStore } from '@/stores/pomodoro';
import { useCloseListener } from '@/hooks/use-close-listener';
-
import styles from './pomodoro.module.css';
interface PomodoroProps {
@@ -22,6 +21,7 @@ interface PomodoroProps {
}
export function Pomodoro({ onClose, open, show }: PomodoroProps) {
+ const { t } = useTranslation();
const [showSetting, setShowSetting] = useState(false);
const [selectedTab, setSelectedTab] = useState('pomodoro');
@@ -56,11 +56,11 @@ export function Pomodoro({ onClose, open, show }: PomodoroProps) {
const tabs = useMemo(
() => [
- { id: 'pomodoro', label: 'Pomodoro' },
- { id: 'short', label: 'Break' },
- { id: 'long', label: 'Long Break' },
+ { id: 'pomodoro', label: t('modals.pomodoro.tabs.pomodoro') },
+ { id: 'short', label: t('modals.pomodoro.tabs.short-break') },
+ { id: 'long', label: t('modals.pomodoro.tabs.long-break') },
],
- [],
+ [t],
);
useCloseListener(() => setShowSetting(false));
@@ -123,12 +123,11 @@ export function Pomodoro({ onClose, open, show }: PomodoroProps) {
<>