Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/features/account/view-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export const ViewAccount = () => {
defaultValues: { name: session.data?.user?.name ?? '' },
validators: {
onSubmit: z.object({
name: z.string().nonempty({ error: 'Name could not be empty' }),
name: z
.string()
.nonempty({ error: t('account:user.updateName.required') }),
}),
},
onSubmit: async (submission) => {
Expand Down
4 changes: 3 additions & 1 deletion src/features/auth/view-auth-onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const ViewAuthOnboarding = () => {
defaultValues: { name: '' },
validators: {
onSubmit: z.object({
name: z.string().nonempty({ error: 'Name could not be empty' }),
name: z
.string()
.nonempty({ error: t('auth:onboarding.name.required') }),
}),
},
onSubmit: async (submission) => {
Expand Down
5 changes: 4 additions & 1 deletion src/features/books/view-books.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FlashList } from '@shopify/flash-list';
import { useInfiniteQuery } from '@tanstack/react-query';
import { Link } from 'expo-router';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { ActivityIndicator, View } from 'react-native';

import { api } from '@/lib/hey-api/api';
Expand All @@ -15,6 +16,8 @@ import { BookCover, COVER_HEIGHT } from '@/features/books/book-cover';
import { ViewTabContent } from '@/layout/view-tab-content';

export const ViewBooks = () => {
const { t } = useTranslation(['books']);

const books = useInfiniteQuery({
...api.bookGetAllInfiniteOptions(),
getNextPageParam: (lastPage) => lastPage.nextCursor,
Expand Down Expand Up @@ -66,7 +69,7 @@ export const ViewBooks = () => {
</View>
))
.match('error', () => <></>)
.match('empty', () => <Text>There is no books</Text>)
.match('empty', () => <Text>{t('books:list.empty')}</Text>)
.match('default', ({ data }) => (
<FlashList
data={data}
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/account.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"title": "Update name",
"cancel": "Cancel",
"save": "Save",
"error": "An error occurred during name update"
"error": "An error occurred during name update",
"required": "Name cannot be empty"
}
},
"displayPreferences": {
Expand Down
5 changes: 4 additions & 1 deletion src/locales/en/auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"onboarding": {
"title": "Welcome",
"subtitle": "Let's personalize your experience",
"name": { "label": "What is your name?" },
"name": {
"label": "What is your name?",
"required": "Name cannot be empty"
},
"continue": "Continue"
},
"signOut": {
Expand Down
3 changes: 3 additions & 0 deletions src/locales/en/books.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"author": "Author",
"genre": "Genre",
"publisher": "Publisher"
},
"list": {
"empty": "There are no books"
}
}
3 changes: 2 additions & 1 deletion src/locales/fr/account.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"title": "Modifier le nom",
"cancel": "Annuler",
"save": "Sauvegarder",
"error": "Une erreur est survenue lors de la modification du nom"
"error": "Une erreur est survenue lors de la modification du nom",
"required": "Le nom ne peut pas être vide"
}
},
"displayPreferences": {
Expand Down
5 changes: 4 additions & 1 deletion src/locales/fr/auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"onboarding": {
"title": "Bienvenue",
"subtitle": "Personnalisons votre expérience",
"name": { "label": "Quel est votre nom ?" },
"name": {
"label": "Quel est votre nom ?",
"required": "Le nom ne peut pas être vide"
},
"continue": "Continuer"
},
"signOut": {
Expand Down
3 changes: 3 additions & 0 deletions src/locales/fr/books.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"author": "Auteur",
"genre": "Genre",
"publisher": "Éditeur"
},
"list": {
"empty": "Aucun livre disponible"
}
}
Loading