Nouvelle correction demandée sur cette PR : l'onglet générique
« Sources » (avec un <select> interne quand le foyer en a activé
plusieurs) devient une tab à part entière par source activée — au même
niveau que Favoris/Perso/Foyer/Publique, plus transparent qu'un
sélecteur caché dans un sous-menu.
- `RecipeTabs` accepte désormais `sources: SourceView[]` et rend une
tab par source (icône propre à la source si elle en a une, sinon
l'icône générique `SourcesIcon` ; libellé = le nom réel de la
source, pas une clé i18n). Nouveau type `RecipesPageTab` en
`RecipeTab | "source:<key>"`, avec `sourceTabValue`/
`parseSourceTabValue`/`isSourceTab` comme seul point d'assemblage/
lecture de ce format.
- Nouveau hook partagé `useEnabledSources` (déplacé hors de
`RecipeSourcesPanel`, maintenant utilisé par `RecipesPage` ET
`RecipePickerDialog` pour construire leurs tabs).
- `RecipeSourcesPanel` simplifié : `sourceKey` devient une prop requise
(fournie par la tab elle-même) au lieu d'un état interne avec son
propre sélecteur — plus de `<select>`, plus de message « aucune
source activée » (une tab qui n'existe pas ne peut plus être
cliquée). Remonté via `key={sourceKey}` par l'appelant au changement
de tab, même convention que `RecipePickerDialog`/`CalendarPopover`
ailleurs dans l'app.
- Un bug distinct trouvé en écrivant ce changement : passer tel quel
`initialSelection` (dérivé de l'URL) au panneau nouvellement monté
en changeant directement de tab source à tab source aurait fait
prévisualiser l'ancien item contre la nouvelle source. Gardé en ne
transmettant `initialSelection` que lorsqu'il appartient réellement
à `activeSourceKey`.
Aucun changement backend.
Tests :
- Vérifié manuellement en local (foyer avec TheMealDB activé) :
tab dédiée dans /recettes et dans le sélecteur du planning, parcours
d'un item, aperçu unifié, aucune régression console.
- Cypress : `recipe-sources.feature`/`planning.feature` mis à jour
(« I click the button "Sources" » → « ... "TheMealDB" »), scénario
« aucune source activée » réécrit pour vérifier l'absence de tab
plutôt qu'un message dans un onglet qui n'existe plus.
- `pnpm exec tsc -b --force` (web) — propre.
- `pnpm exec biome check` — propre.
- `pnpm --filter web build` — propre.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
36 lines
1.8 KiB
Gherkin
36 lines
1.8 KiB
Gherkin
Feature: Adding a recipe to the planning
|
|
As a signed-in user
|
|
I want to add a recipe to a planning slot even when I haven't imported it yet
|
|
So that browsing an external source and planning it is a single trip
|
|
|
|
Background:
|
|
Given I am signed in as "Alice" "Martin"
|
|
And my household id is 1
|
|
And today is frozen at "2026-08-17T09:00:00.000Z"
|
|
And the household request returns no household
|
|
And the recipe catalog contains nothing
|
|
And the ingredient and diet catalog is available for import
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And the planning request reflects whatever's been added so far
|
|
|
|
Scenario: Adds a not-yet-imported source item to a planning slot, importing it on the way
|
|
Given previewing TheMealDB item "9999" is available
|
|
And importing the previewed item will succeed and return id 99
|
|
And adding the imported recipe to the planning will succeed
|
|
When I visit "/"
|
|
And I click the add button for the first empty planning slot
|
|
And I click the button "TheMealDB"
|
|
And I click the source item "Fish Pie"
|
|
And I click the link "Importer cette recette"
|
|
Then I should see "Cette recette sera automatiquement ajoutée à votre planning une fois importée."
|
|
|
|
When I choose an ingredient for the unresolved line "some mystery paste"
|
|
And I select the ingredient "Sel" from the picker
|
|
And I select unit "unité" for the first ingredient
|
|
And I fill in the last ingredient's quantity with "1" and unit "unité"
|
|
And I click the button "Importer"
|
|
Then the planning add request should have included recipe 99, weekDay "lundi", meal "petit-dejeuner", and portions 4
|
|
And the URL should be the home page
|
|
And the recipe "Fish Pie" should appear in the first planning slot with 4 portions
|