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>
|
||||
|
||||
@@ -3487,6 +3487,7 @@
|
||||
"bank_add_now": "Add now",
|
||||
"customer_card_title": "Customer",
|
||||
"select_customer_placeholder": "Select customer",
|
||||
"no_customers_yet": "No customers yet",
|
||||
"create_customer": "Create customer",
|
||||
"create_customer_dialog_title": "Add customer",
|
||||
"create_customer_failed_title": "Could not create customer",
|
||||
@@ -4250,6 +4251,7 @@
|
||||
"paid_privately_help_ef": "Booked as a liability from the company to you (2018 Egen insättning). Refund manually later from the company account.",
|
||||
"paid_privately_help_ab": "Booked as a liability from the company to you (2893 Skuld till ägare). Refund manually later from the company account.",
|
||||
"supplier_placeholder": "Select supplier",
|
||||
"no_suppliers_yet": "No suppliers yet",
|
||||
"add_new_supplier": "+ Add new supplier...",
|
||||
"supplier_invoice_number_label": "Supplier's invoice number",
|
||||
"supplier_invoice_number_placeholder": "Invoice no. from supplier",
|
||||
|
||||
@@ -3487,6 +3487,7 @@
|
||||
"bank_add_now": "Lägg till nu",
|
||||
"customer_card_title": "Kund",
|
||||
"select_customer_placeholder": "Välj kund",
|
||||
"no_customers_yet": "Inga kunder än",
|
||||
"create_customer": "Skapa kund",
|
||||
"create_customer_dialog_title": "Lägg till kund",
|
||||
"create_customer_failed_title": "Kunde inte skapa kund",
|
||||
@@ -4250,6 +4251,7 @@
|
||||
"paid_privately_help_ef": "Bokförs som skuld från bolaget till dig (2018 Egen insättning). Återbetalas senare manuellt från företagskontot.",
|
||||
"paid_privately_help_ab": "Bokförs som skuld från bolaget till dig (2893 Skuld till ägare). Återbetalas senare manuellt från företagskontot.",
|
||||
"supplier_placeholder": "Välj leverantör",
|
||||
"no_suppliers_yet": "Inga leverantörer än",
|
||||
"add_new_supplier": "+ Lägg till ny leverantör...",
|
||||
"supplier_invoice_number_label": "Leverantörens fakturanummer",
|
||||
"supplier_invoice_number_placeholder": "Fakturanr från leverantören",
|
||||
|
||||
Reference in New Issue
Block a user