fix(products): rótulo "Nome do X" nos formulários de catálogo + verificação em navegador real
CatalogCreateForm/SimpleCatalogCard ganham nameLabel (default "Nome"), propagado aos 5 catálogos: "Nome do tipo/grupo/subgrupo", "Nome da marca/unidade". Verificado desta vez em navegador real (Playwright headless, sem a extensão claude-in-chrome disponível nesta sessão) em vez de só por API — pegou um bug real que a verificação anterior não pegaria: o prop nameLabel tinha sido adicionado à assinatura mas esquecido de usar no JSX, então nenhum rótulo mudava apesar do build passar limpo. Corrigido e reverificado. Suíte: 95/95. pnpm turbo run typecheck build: 28/28. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ export function BrandsListPage() {
|
||||
onCreate={create}
|
||||
onToggleActive={toggleActive}
|
||||
namePlaceholder="ex.: Intelbras"
|
||||
nameLabel="Nome da marca"
|
||||
createLabel="Adicionar marca"
|
||||
emptyMessage="Nenhuma marca cadastrada."
|
||||
/>
|
||||
|
||||
@@ -6,12 +6,14 @@ import { Alert, Button, Input } from "@eden/ui";
|
||||
export function CatalogCreateForm({
|
||||
placeholder,
|
||||
buttonLabel = "Adicionar",
|
||||
nameLabel = "Nome",
|
||||
creating,
|
||||
error,
|
||||
onCreate,
|
||||
}: {
|
||||
placeholder: string;
|
||||
buttonLabel?: string;
|
||||
nameLabel?: string;
|
||||
creating: boolean;
|
||||
error: string | null;
|
||||
onCreate: (name: string) => Promise<boolean>;
|
||||
@@ -36,7 +38,7 @@ export function CatalogCreateForm({
|
||||
<form className="flex flex-col gap-3 sm:flex-row sm:items-end" onSubmit={handleSubmit}>
|
||||
<div className="flex-1">
|
||||
<Input
|
||||
label="Nome"
|
||||
label={nameLabel}
|
||||
placeholder={placeholder}
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
|
||||
@@ -36,6 +36,7 @@ export function GroupSubgroupsPanel({ group }: { group: ProductGroupRow }) {
|
||||
) : null}
|
||||
<CatalogCreateForm
|
||||
placeholder="ex.: Fibra residencial"
|
||||
nameLabel="Nome do subgrupo"
|
||||
buttonLabel="Adicionar subgrupo"
|
||||
creating={creating}
|
||||
error={formError}
|
||||
|
||||
@@ -57,6 +57,7 @@ export function ProductGroupsListPage() {
|
||||
) : null}
|
||||
<CatalogCreateForm
|
||||
placeholder="ex.: Banda larga"
|
||||
nameLabel="Nome do grupo"
|
||||
buttonLabel="Adicionar grupo"
|
||||
creating={creating}
|
||||
error={formError}
|
||||
|
||||
@@ -29,6 +29,7 @@ export function ProductTypesListPage() {
|
||||
onCreate={create}
|
||||
onToggleActive={toggleActive}
|
||||
namePlaceholder="ex.: Internet"
|
||||
nameLabel="Nome do tipo"
|
||||
createLabel="Adicionar tipo"
|
||||
emptyMessage="Nenhum tipo de produto cadastrado."
|
||||
/>
|
||||
|
||||
@@ -14,6 +14,7 @@ export function SimpleCatalogCard<T extends SimpleCatalogRow>({
|
||||
onCreate,
|
||||
onToggleActive,
|
||||
namePlaceholder,
|
||||
nameLabel,
|
||||
createLabel,
|
||||
emptyMessage,
|
||||
extraColumn,
|
||||
@@ -26,6 +27,7 @@ export function SimpleCatalogCard<T extends SimpleCatalogRow>({
|
||||
onCreate: (name: string) => Promise<boolean>;
|
||||
onToggleActive: (item: T) => void;
|
||||
namePlaceholder: string;
|
||||
nameLabel?: string;
|
||||
createLabel?: string;
|
||||
emptyMessage?: string;
|
||||
extraColumn?: TableColumn<T>;
|
||||
@@ -39,6 +41,7 @@ export function SimpleCatalogCard<T extends SimpleCatalogRow>({
|
||||
) : null}
|
||||
<CatalogCreateForm
|
||||
placeholder={namePlaceholder}
|
||||
nameLabel={nameLabel}
|
||||
buttonLabel={createLabel}
|
||||
creating={creating}
|
||||
error={formError}
|
||||
|
||||
@@ -105,7 +105,7 @@ export function SubgroupsListPage() {
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<Input
|
||||
label="Nome"
|
||||
label="Nome do subgrupo"
|
||||
placeholder="ex.: Fibra residencial"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
|
||||
@@ -29,6 +29,7 @@ export function UnitsListPage() {
|
||||
onCreate={create}
|
||||
onToggleActive={toggleActive}
|
||||
namePlaceholder="ex.: Unidade"
|
||||
nameLabel="Nome da unidade"
|
||||
createLabel="Adicionar unidade"
|
||||
emptyMessage="Nenhuma unidade cadastrada."
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user