fix(invoices): real empty states in the editor pickers (#1678)
Zero customers rendered the customer Select as a bare few-pixel sliver; it now shows 'Inga kunder än'. The supplier menu showed an orphan separator above its create action when no suppliers exist; it now shows 'Inga leverantörer än' and drops the separator. The row-entry suggestion hint loses its top border when no article list renders above it. Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Jakob Wennberg
Claude Fable 5
parent
bc357531cc
commit
1000f18169
@@ -1960,6 +1960,13 @@ export default function InvoiceEditor(props: InvoiceEditorProps = { mode: 'creat
|
||||
<SelectValue placeholder={t('select_customer_placeholder')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{/* Radix renders an empty viewport as a bare few-pixel
|
||||
sliver; give the zero-customer state real content. */}
|
||||
{customers.length === 0 && (
|
||||
<div className="px-3 py-2 text-[13px] text-muted-foreground">
|
||||
{t('no_customers_yet')}
|
||||
</div>
|
||||
)}
|
||||
{customers.map((customer) => (
|
||||
<SelectItem key={customer.id} value={customer.id}>
|
||||
{customer.name}
|
||||
@@ -2608,7 +2615,12 @@ export default function InvoiceEditor(props: InvoiceEditorProps = { mode: 'creat
|
||||
</div>
|
||||
<div
|
||||
id={`${entryListId}-hint`}
|
||||
className="border-t border-border px-3 py-2 text-[11px] text-muted-foreground"
|
||||
className={cn(
|
||||
'px-3 py-2 text-[11px] text-muted-foreground',
|
||||
// Border only when a list renders above; alone it reads
|
||||
// as a stray hairline at the top of the popover.
|
||||
entryMatches.length > 0 && 'border-t border-border',
|
||||
)}
|
||||
>
|
||||
{entryMatches.length > 0 ? t('entry_hint_matches') : t('entry_hint_free')}
|
||||
</div>
|
||||
|
||||
@@ -1677,6 +1677,11 @@ export default function NewSupplierInvoiceForm({
|
||||
e.preventDefault()
|
||||
}}
|
||||
>
|
||||
{suppliers.length === 0 && (
|
||||
<div className="px-2 py-2 text-[13px] text-muted-foreground">
|
||||
{t('no_suppliers_yet')}
|
||||
</div>
|
||||
)}
|
||||
{suppliers.map((s) => (
|
||||
<DropdownMenuItem
|
||||
key={s.id}
|
||||
@@ -1695,7 +1700,8 @@ export default function NewSupplierInvoiceForm({
|
||||
</div>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
<DropdownMenuSeparator />
|
||||
{/* No separator over an empty list: it reads as a stray line. */}
|
||||
{suppliers.length > 0 && <DropdownMenuSeparator />}
|
||||
<DropdownMenuItem onSelect={openSupplierDialogBlank} className="text-muted-foreground">
|
||||
{t('add_new_supplier')}
|
||||
</DropdownMenuItem>
|
||||
|
||||
Reference in New Issue
Block a user