i18n front : facettes localisées + Web Push (SW push, abonnement, toggle profil)
Build & Deploy / build (push) Successful in 6s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-19 03:46:43 +02:00
co-authored by Claude Opus 4.8
parent d8fc93ff5d
commit 4e11e97b14
6 changed files with 149 additions and 21 deletions
+6 -5
View File
@@ -1,18 +1,19 @@
<script setup lang="ts">
const { t } = useI18n()
const { t, locale } = useI18n()
const { api } = useApi()
interface ExerciseRow { id: number, name: string, slug: string, body_part: string | null, equipment: string | null, target: string | null, image_url: string | null }
interface Facets { body_parts: string[], equipments: string[], targets: string[], categories: string[] }
interface Facet { value: string, label: string }
interface Facets { body_parts: Facet[], equipments: Facet[], targets: Facet[], categories: Facet[] }
interface Paginated { data: ExerciseRow[], meta: { current_page: number, last_page: number, total: number } }
const search = ref('')
const bodyPart = ref<string | undefined>()
const page = ref(1)
const { data: facets } = await useAsyncData('ex-facets', () => api<Facets>('/api/exercises/facets'), { lazy: true })
const { data: facets } = await useAsyncData('ex-facets', () => api<Facets>('/api/exercises/facets', { query: { locale: locale.value } }), { lazy: true, watch: [locale] })
const query = computed(() => ({ search: search.value || undefined, body_part: bodyPart.value || undefined, page: page.value }))
const query = computed(() => ({ search: search.value || undefined, body_part: bodyPart.value || undefined, page: page.value, locale: locale.value }))
const { data, pending } = await useAsyncData<Paginated>(
'exercises',
() => api<Paginated>('/api/exercises', { query: query.value }),
@@ -23,7 +24,7 @@ watch([search, bodyPart], () => { page.value = 1 })
const bodyPartOptions = computed(() => [
{ label: t('exercises.all'), value: undefined },
...(facets.value?.body_parts ?? []).map(b => ({ label: b, value: b }))
...(facets.value?.body_parts ?? []).map(b => ({ label: b.label, value: b.value }))
])
</script>