diff --git a/front/components/GtkUI/RawElement.tsx b/front/components/GtkUI/RawElement.tsx index fc809aa..e52a4d7 100644 --- a/front/components/GtkUI/RawElement.tsx +++ b/front/components/GtkUI/RawElement.tsx @@ -20,6 +20,7 @@ import { } from './ElementTypes'; import { ArrowDown2 } from 'iconsax-react-native'; import { useWindowDimensions } from 'react-native'; +import Translate from '../Translate'; type RawElementProps = { element: ElementProps; @@ -149,7 +150,7 @@ export const RawElement = ({ element }: RawElementProps) => { /> ); default: - return Unknown type; + return } })()} diff --git a/front/components/Metronome.tsx b/front/components/Metronome.tsx index 9526bb3..8135c3d 100644 --- a/front/components/Metronome.tsx +++ b/front/components/Metronome.tsx @@ -3,6 +3,7 @@ import { Slider, Text, View, IconButton, Icon } from 'native-base'; import { MaterialCommunityIcons } from '@expo/vector-icons'; import { Audio } from 'expo-av'; import { VolumeHigh, VolumeSlash } from 'iconsax-react-native'; +import { Translate } from '../i18n/i18n'; export const MetronomeControls = ({ paused = false, bpm }: { paused?: boolean; bpm: number }) => { const audio = useRef(null); @@ -43,7 +44,7 @@ export const MetronomeControls = ({ paused = false, bpm }: { paused?: boolean; b justifyContent: 'space-between', }} > - Metronome + } /> { - {`${translate('level')} ${level}`} + `${e} ${level}`} /> - - {xp} / {nextLevelThreshold} {translate('levelProgress')} - + `${xp} / ${nextLevelThreshold} ${e}`} + /> diff --git a/front/components/SearchResult.tsx b/front/components/SearchResult.tsx index c761f4f..0543526 100644 --- a/front/components/SearchResult.tsx +++ b/front/components/SearchResult.tsx @@ -13,7 +13,7 @@ import { import { SafeAreaView } from 'react-native'; import { SearchContext } from '../views/SearchView'; import { useQuery } from '../Queries'; -import { translate } from '../i18n/i18n'; +import { Translate, translate } from '../i18n/i18n'; import API from '../API'; import LoadingComponent, { LoadingView } from './Loading'; import ArtistCard from './ArtistCard'; @@ -115,7 +115,7 @@ const SongsSearchComponent = (props: SongsSearchComponentProps) => { /> )) ) : ( - {translate('errNoResults')} + )} @@ -151,7 +151,7 @@ const ArtistSearchComponent = (props: ItemSearchComponentProps) => { cardComponent={ArtistCard} /> ) : ( - {translate('errNoResults')} + )} ); @@ -180,7 +180,7 @@ const GenreSearchComponent = (props: ItemSearchComponentProps) => { cardComponent={GenreCard} /> ) : ( - {translate('errNoResults')} + )} ); @@ -268,7 +268,7 @@ const FilterSwitch = () => { case 'favorites': return ; default: - return Something very bad happened: {currentFilter}; + return `${e}: ${currentFilter}`}/>; } }; diff --git a/front/i18n/Translations.ts b/front/i18n/Translations.ts index 491366e..940f075 100644 --- a/front/i18n/Translations.ts +++ b/front/i18n/Translations.ts @@ -226,9 +226,6 @@ export const en = { SettingsPreferencesTabLanguageSectionDescription: 'Set the language of your application', SettingsPreferencesTabDifficultySectionTitle: 'Difficulty', SettingsPreferencesTabDifficultySectionDescription: 'The precision of the tempo increases', - SettingsPreferencesTabColorblindModeSectionTitle: 'Colorblind Mode', - SettingsPreferencesTabColorblindModeSectionDescription: 'Increases contrast', - SettingsPreferencesTabMicVolumeSectionTitle: 'Mic Volume', SettingsPreferencesTabMicVolumeSectionDescription: 'Adjust the volume of your microphone according to your preference', // Notifications Tab @@ -277,7 +274,6 @@ export const en = { SettingsPreferencesTheme: 'Theme', SettingsPreferencesLanguage: 'Language', SettingsPreferencesDifficulty: 'Difficulty', - SettingsPreferencesColorblindMode: 'Colorblind mode', SettingsPreferencesMicVolume: 'Mic volume', SettingsPreferencesDevice: 'Device', @@ -308,6 +304,10 @@ export const en = { leaderBoardHeadingFull: 'The players having the best scores, thanks to their exceptional accuracy, are highlighted here.', emptySelection: 'None,', + gamesPlayed: 'Games Played', + metronome: 'Metronome', + loading: "Loading... Please Wait", + emailCheckFailed: 'Email verification failed. The token has expired or is invalid.' }; export const fr: typeof en = { @@ -371,7 +371,7 @@ export const fr: typeof en = { menuLeaderBoard: 'Classement', menuSettings: 'Paramètres', - menuRecentlyPlayed: 'Récemment jouée', + menuRecentlyPlayed: 'Récemment joués', menuNoSongsPlayedYet: "Aucune chanson jouée pour l'instant", //signup @@ -389,7 +389,7 @@ export const fr: typeof en = { //music musicTabFavorites: 'Favoris', musicTabRecentlyPlayed: 'Récemment joué', - musicTabStepUp: 'Recommandation', + musicTabStepUp: 'Recommandations', //search allFilter: 'Tout', @@ -538,9 +538,6 @@ export const fr: typeof en = { SettingsPreferencesTabDifficultySectionTitle: 'Difficulté', SettingsPreferencesTabDifficultySectionDescription: 'La précision du tempo est de plus en plus élevée', - SettingsPreferencesTabColorblindModeSectionTitle: 'Mode daltonien', - SettingsPreferencesTabColorblindModeSectionDescription: 'Augmente le contraste', - SettingsPreferencesTabMicVolumeSectionTitle: 'Volume du micro', SettingsPreferencesTabMicVolumeSectionDescription: 'Réglez le volume de votre micro selon vos préférences', // Notifications Tab @@ -582,8 +579,6 @@ export const fr: typeof en = { SettingsNotificationsPushNotifications: 'Notifications push', SettingsNotificationsReleaseAlert: 'Alertes de nouvelles Sorties', SettingsNotificationsTrainingReminder: "Rappel d'entrainement", - - SettingsPreferencesColorblindMode: 'Mode daltonien', SettingsPreferencesDevice: 'Appareil', SettingsPreferencesDifficulty: 'Difficulté', SettingsPreferencesLanguage: 'Langue', @@ -621,6 +616,10 @@ export const fr: typeof en = { leaderBoardHeadingFull: 'Les joueurs présentant les meilleurs scores, grâce à leur précision exceptionnelle, sont mis en lumière ici.', emptySelection: 'Aucun', + gamesPlayed: 'Parties Jouées', + metronome: 'Métronome', + loading: "Chargement en cours... Veuillez Patienter", + emailCheckFailed: 'Email verification failed. The token has expired or is invalid.' }; export const sp: typeof en = { @@ -854,9 +853,6 @@ export const sp: typeof en = { SettingsPreferencesTabLanguageSectionDescription: 'Establece el idioma de tu aplicación', SettingsPreferencesTabDifficultySectionTitle: 'Dificultad', SettingsPreferencesTabDifficultySectionDescription: 'La precisión del tempo aumenta', - SettingsPreferencesTabColorblindModeSectionTitle: 'Modo para daltónicos', - SettingsPreferencesTabColorblindModeSectionDescription: 'Aumenta el contraste', - SettingsPreferencesTabMicVolumeSectionTitle: 'Volumen del micrófono', SettingsPreferencesTabMicVolumeSectionDescription: 'Ajusta el volumen de tu micrófono según tus preferencias', // Notifications Tab @@ -900,7 +896,6 @@ export const sp: typeof en = { SettingsNotificationsReleaseAlert: 'Alertas de nuevas Sorties', SettingsNotificationsTrainingReminder: 'Recordatorio de entrenamiento', - SettingsPreferencesColorblindMode: 'Modo daltoniano', SettingsPreferencesDevice: 'Dispositivo', SettingsPreferencesDifficulty: 'Dificultad', SettingsPreferencesLanguage: 'Idioma', diff --git a/front/views/GoogleView.tsx b/front/views/GoogleView.tsx index de2153e..cf1061b 100644 --- a/front/views/GoogleView.tsx +++ b/front/views/GoogleView.tsx @@ -5,6 +5,7 @@ import { setAccessToken } from '../state/UserSlice'; import { Text } from 'native-base'; import { useRoute } from '@react-navigation/native'; import { AccessTokenResponseHandler } from '../models/AccessTokenResponse'; +import { Translate } from '../i18n/i18n'; const GoogleView = () => { const dispatch = useDispatch(); @@ -25,7 +26,7 @@ const GoogleView = () => { run(); }, []); - return Loading please wait; + return }; export default GoogleView; diff --git a/front/views/MusicView.tsx b/front/views/MusicView.tsx index d866b93..58cc664 100644 --- a/front/views/MusicView.tsx +++ b/front/views/MusicView.tsx @@ -12,7 +12,7 @@ import { import { Heart, Clock, StatusUp, FolderCross } from 'iconsax-react-native'; import { Scene } from 'react-native-tab-view/lib/typescript/src/types'; import { RouteProps, useNavigation } from '../Navigation'; -import { TranslationKey, translate } from '../i18n/i18n'; +import { Translate, TranslationKey, translate } from '../i18n/i18n'; import ScaffoldCC from '../components/UI/ScaffoldCC'; import MusicList from '../components/UI/MusicList'; import { useQuery } from '../Queries'; @@ -98,7 +98,7 @@ export const FavoritesMusic = () => { export const RecentlyPlayedMusic = () => { return (
- RecentlyPlayedMusic +
); }; @@ -106,7 +106,7 @@ export const RecentlyPlayedMusic = () => { export const StepUpMusic = () => { return (
- StepUpMusic +
); }; diff --git a/front/views/ProfileView.tsx b/front/views/ProfileView.tsx index 93afd11..53a1d40 100644 --- a/front/views/ProfileView.tsx +++ b/front/views/ProfileView.tsx @@ -7,7 +7,7 @@ import { LoadingView } from '../components/Loading'; import { useQuery } from '../Queries'; import API from '../API'; import ButtonBase from '../components/UI/ButtonBase'; -import { translate } from '../i18n/i18n'; +import { Translate, translate } from '../i18n/i18n'; import ScoreGraph from '../components/ScoreGraph'; import ScaffoldCC from '../components/UI/ScaffoldCC'; @@ -99,7 +99,7 @@ const ProfileView = (props: RouteProps<{}>) => { Your client ID is {userQuery.data.id} - {userQuery.data.data.gamesPlayed} Games played + `${userQuery.data.data.gamesPlayed} ${e}`} />
diff --git a/front/views/VerifiedView.tsx b/front/views/VerifiedView.tsx index 907cd63..7e7e5ff 100644 --- a/front/views/VerifiedView.tsx +++ b/front/views/VerifiedView.tsx @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; import API from '../API'; -import { Text } from 'native-base'; import { useNavigation } from '../Navigation'; import { useRoute } from '@react-navigation/native'; +import { Translate } from '../i18n/i18n'; const VerifiedView = () => { const navigation = useNavigation(); @@ -26,9 +26,9 @@ const VerifiedView = () => { }, []); return failed ? ( - Email verification failed. The token has expired or is invalid. + ) : ( - Loading please wait + ); }; diff --git a/front/views/settings/NotificationsSettings.tsx b/front/views/settings/NotificationsSettings.tsx deleted file mode 100644 index 1b4df41..0000000 --- a/front/views/settings/NotificationsSettings.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import React from 'react'; -import { translate } from '../../i18n/i18n'; -import ElementList from '../../components/GtkUI/ElementList'; -import useUserSettings from '../../hooks/userSettings'; -import { LoadingView } from '../../components/Loading'; -import { Calendar1, MonitorMobbile, Send2, Warning2 } from 'iconsax-react-native'; - -const NotificationsSettings = () => { - const { settings, updateSettings } = useUserSettings(); - - if (!settings.data) { - return ; - } - return ( - { - updateSettings({ - notifications: { - pushNotif: !settings.data.notifications.pushNotif, - }, - }); - }, - }, - }, - { - type: 'toggle', - icon: Send2, - title: translate('SettingsNotificationsTabEmailNotificationsSectionTitle'), - description: translate( - 'SettingsNotificationsTabEmailNotificationsSectionDescription' - ), - data: { - value: settings.data.notifications.emailNotif, - onToggle: () => { - updateSettings({ - notifications: { - emailNotif: !settings.data.notifications.emailNotif, - }, - }); - }, - }, - }, - { - type: 'toggle', - icon: Calendar1, - title: translate('SettingsNotificationsTabTrainingReminderSectionTitle'), - description: translate( - 'SettingsNotificationsTabTrainingReminderSectionDescription' - ), - data: { - value: settings.data.notifications.trainNotif, - onToggle: () => { - updateSettings({ - notifications: { - trainNotif: !settings.data.notifications.trainNotif, - }, - }); - }, - }, - }, - { - type: 'toggle', - icon: Warning2, - title: translate('SettingsNotificationsTabReleaseAlertSectionTitle'), - description: translate( - 'SettingsNotificationsTabReleaseAlertSectionDescription' - ), - data: { - value: settings.data.notifications.newSongNotif, - onToggle: () => { - updateSettings({ - notifications: { - newSongNotif: !settings.data.notifications.newSongNotif, - }, - }); - }, - }, - }, - ]} - /> - ); -}; - -export default NotificationsSettings; diff --git a/front/views/settings/PreferencesSettings.tsx b/front/views/settings/PreferencesSettings.tsx index 19593f1..a3e017f 100644 --- a/front/views/settings/PreferencesSettings.tsx +++ b/front/views/settings/PreferencesSettings.tsx @@ -7,7 +7,7 @@ import { useSelector } from '../../state/Store'; import { updateSettings } from '../../state/SettingsSlice'; import ElementList from '../../components/GtkUI/ElementList'; import LocalSettings from '../../models/LocalSettings'; -import { Brush2, Colorfilter, LanguageSquare, Rank, Sound } from 'iconsax-react-native'; +import { Brush2, LanguageSquare, Rank } from 'iconsax-react-native'; const PreferencesSettings = () => { const dispatch = useDispatch(); @@ -84,59 +84,6 @@ const PreferencesSettings = () => { }, ]} /> - { - dispatch(updateSettings({ colorBlind: !settings.colorBlind })); - }, - }, - }, - ]} - /> - { - dispatch(updateSettings({ micVolume: value })); - }, - }, - }, - /*{ - type: "dropdown", - title: translate("SettingsPreferencesDevice"), - data: { - value: settings.preferedInputName || "0", - defaultValue: "0", - onSelect: (itemValue: string) => { - dispatch(updateSettings({ preferedInputName: itemValue })); - }, - options: [ - { label: "Mic_0", value: "0" }, - { label: "Mic_1", value: "1" }, - { label: "Mic_2", value: "2" }, - ], - }, - },*/ - ]} - /> ); }; diff --git a/front/views/settings/SettingsPremium.tsx b/front/views/settings/SettingsPremium.tsx deleted file mode 100644 index 91323c2..0000000 --- a/front/views/settings/SettingsPremium.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import API from '../../API'; -import React from 'react'; -import { LoadingView } from '../../components/Loading'; -import ElementList from '../../components/GtkUI/ElementList'; -import { translate } from '../../i18n/i18n'; -import { useQuery } from '../../Queries'; -import { Designtools, Magicpen, Star1 } from 'iconsax-react-native'; - -// Too painful to infer the settings-only, typed navigator. Gave up -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const PremiumSettings = () => { - const userQuery = useQuery(API.getUserInfo); - - if (!userQuery.data || userQuery.isLoading) { - return ; - } - const user = userQuery.data; - return ( - {}, - }, - }, - { - icon: Designtools, - type: 'dropdown', - title: translate('settingsPremiumTabThemePianoSectionTitle'), - description: translate('settingsPremiumTabThemePianoSectionDescription'), - disabled: true, - data: { - value: 'default', - onSelect: () => {}, - options: [ - { - label: 'Default', - value: 'default', - }, - { - label: 'Catpuccino', - value: 'catpuccino', - }, - ], - }, - }, - ]} - /> - ); -}; - -export default PremiumSettings; diff --git a/front/views/settings/SettingsView.tsx b/front/views/settings/SettingsView.tsx index c11f338..7459c13 100644 --- a/front/views/settings/SettingsView.tsx +++ b/front/views/settings/SettingsView.tsx @@ -1,7 +1,6 @@ import React from 'react'; -import { Center, Text, useBreakpointValue, useTheme } from 'native-base'; +import { Text, useBreakpointValue, useTheme } from 'native-base'; import ProfileSettings from './SettingsProfile'; -import NotificationsSettings from './NotificationsSettings'; import PrivacySettings from './PrivacySettings'; import PreferencesSettings from './PreferencesSettings'; import { useWindowDimensions } from 'react-native'; @@ -15,50 +14,32 @@ import { } from 'react-native-tab-view'; import { HeartEdit, - Star1, UserEdit, Notification, SecurityUser, - Music, FolderCross, } from 'iconsax-react-native'; import { Scene } from 'react-native-tab-view/lib/typescript/src/types'; -import PremiumSettings from './SettingsPremium'; import { RouteProps } from '../../Navigation'; import ScaffoldCC from '../../components/UI/ScaffoldCC'; import { translate } from '../../i18n/i18n'; -export const PianoSettings = () => { - return ( -
- Global settings for the virtual piano -
- ); -}; - const renderScene = SceneMap({ profile: ProfileSettings, - premium: PremiumSettings, preferences: PreferencesSettings, - notifications: NotificationsSettings, privacy: PrivacySettings, - piano: PianoSettings, }); const getTabData = (key: string) => { switch (key) { case 'profile': return { index: 0, icon: UserEdit }; - case 'premium': - return { index: 1, icon: Star1 }; case 'preferences': return { index: 2, icon: HeartEdit }; case 'notifications': return { index: 3, icon: Notification }; case 'privacy': return { index: 4, icon: SecurityUser }; - case 'piano': - return { index: 5, icon: Music }; default: return { index: 6, icon: FolderCross }; } @@ -71,11 +52,8 @@ const SettingsTab = (props: RouteProps<{}>) => { const { colors } = useTheme(); const routes = [ { key: 'profile', title: 'settingsTabProfile' }, - { key: 'premium', title: 'settingsTabPremium' }, { key: 'preferences', title: 'settingsTabPreferences' }, - { key: 'notifications', title: 'settingsTabNotifications' }, { key: 'privacy', title: 'settingsTabPrivacy' }, - { key: 'piano', title: 'settingsTabPiano' }, ]; const screenSize = useBreakpointValue({ base: 'small', md: 'big' }); const isSmallScreen = screenSize === 'small'; @@ -113,11 +91,8 @@ const SettingsTab = (props: RouteProps<{}>) => { {translate( route.title as | 'settingsTabProfile' - | 'settingsTabPremium' | 'settingsTabPreferences' - | 'settingsTabNotifications' | 'settingsTabPrivacy' - | 'settingsTabPiano' )} )