feat(F-133): completed feature
This commit is contained in:
51
work/artifacts/F-133/implementer.md
Normal file
51
work/artifacts/F-133/implementer.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# F-133 — Custom weight inline en el mismo desplegable
|
||||
|
||||
## Cambios
|
||||
|
||||
### `apps/admin/src/features/products/components/sections/PriceStockSection.tsx`
|
||||
|
||||
#### Antes
|
||||
```tsx
|
||||
<select value={weightPresetValue} onChange={...}>
|
||||
{WEIGHT_PRESETS_GR.map(g => <option>{g} g</option>)}
|
||||
<option value="custom">Personalizado…</option>
|
||||
</select>
|
||||
{weightIsCustom && (
|
||||
<input type="text" placeholder="Gramos" className="mt-2 …" />
|
||||
)}
|
||||
```
|
||||
|
||||
#### Después
|
||||
```tsx
|
||||
<input
|
||||
type="number"
|
||||
list="weight-presets-list"
|
||||
min={1}
|
||||
max={100000}
|
||||
value={unitWeightGr}
|
||||
onChange={...}
|
||||
/>
|
||||
<datalist id="weight-presets-list">
|
||||
{WEIGHT_PRESETS_GR.map(g => <option key={g} value={g} label={`${g} g`} />)}
|
||||
</datalist>
|
||||
```
|
||||
|
||||
- Un único `<input>` que actúa como combo box nativo (escribe cualquier valor o elige uno del dropdown de sugerencias).
|
||||
- Sin segundo campo condicional → no rompe el grid.
|
||||
- Sin código duplicado para estado "custom" vs "preset".
|
||||
|
||||
### Limpieza
|
||||
- Eliminados: `weightIsCustom`, `weightPresetValue`, `onWeightPresetChange` (ya no necesarios).
|
||||
- `customWeightGr` se queda declarado pero sin uso real (compatibilidad con handler que llama a `setCustomWeightGr`).
|
||||
|
||||
## Verificación
|
||||
|
||||
- `cd apps/admin && npx tsc --noEmit` → exit 0.
|
||||
- `cd apps/admin && NEXT_PUBLIC_API_URL=http://192.168.18.93:3000 npm run build` → exit 0.
|
||||
|
||||
## Notas
|
||||
|
||||
- Sin cambios en backend.
|
||||
- El comportamiento de teclado (Enter para guardar) y blur para guardar se mantiene.
|
||||
- El dropdown nativo del navegador muestra los presets como sugerencias — visualmente consistente con el resto de inputs del formulario.
|
||||
- Operador reinicia admin (`./scripts/monolith.sh prod restart`) para desplegar.
|
||||
Reference in New Issue
Block a user