Move low-stock hint to badge, right-align VAT breakdown, gate cart discount field, split billing/shipping delivery method
- Removed the inline "Nur noch wenige verfügbar" text hint from AddToCartButton/AddToCartInlineButton (was making card heights vary in every grid that renders them — RelatedProducts, ProductSpotlight's CTA row) — now only shown via the same image-overlaid pill badge Ausverkauft/discount already use (position: absolute, doesn't affect layout). Added that badge to RelatedProducts.tsx and todo-cards' Pricing.tsx, which didn't have it before. - RelatedProducts cards now also show "inkl. X% MwSt." (was missing entirely) - VatBreakdown rows are now flex rows with a spacer instead of plain text, so every € amount right-aligns to the same edge regardless of how many digits the rate itself has (was visibly staggered with mixed 7%/19% rates) - Cart's manual discount-code field only renders when Payload actually has at least one active code right now (lib/discountServer.ts's new hasActiveDiscountCode()) — no point showing an open field that could never validate. An already-applied code (e.g. from an older session) still always shows its own result row regardless. - Checkout's "1. Rechnungsadresse" no longer offers a Packstation option — a Packstation isn't a valid billing address for an invoice. Only a plain street address now; Packstation is only offered on the separate, optional "Abweichende Lieferadresse" section, which already had its own address/Packstation toggle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,24 +4,34 @@ import type { TaxBreakdownGroup } from "../lib/taxBreakdown";
|
||||
// The actual amount of VAT included in a total — not just a disclosure
|
||||
// that VAT is included (see cartTotals.ts's effectiveTaxRate() for the
|
||||
// "which %" shown next to each line item elsewhere). One line per rate
|
||||
// when a cart/order spans more than one; a single line otherwise.
|
||||
// when a cart/order spans more than one; a single line otherwise. Each
|
||||
// line is a flex row with a spacer (same "label, flex-1 spacer, value"
|
||||
// shape as every other Zwischensumme/Versand/Gesamtsumme row in the
|
||||
// sidebars this renders inside) so every € amount lands on the same
|
||||
// right-hand edge — a plain "X%: Y €" text line left the amount starting
|
||||
// wherever the rate's own digit count happened to end, visibly misaligned
|
||||
// as soon as two different rates (e.g. "7%" vs "19%") were both present.
|
||||
export function VatBreakdown({ groups }: { groups: TaxBreakdownGroup[] }) {
|
||||
if (groups.length === 0) return null;
|
||||
if (groups.length === 1) {
|
||||
const [g] = groups;
|
||||
return (
|
||||
<p className="text-label text-text-muted">
|
||||
enthält {g.rate}% MwSt.: {formatPrice(g.tax)}
|
||||
</p>
|
||||
<div className="flex items-center w-full">
|
||||
<span className="text-label text-text-muted">enthält {g.rate}% MwSt.</span>
|
||||
<span className="flex-1" />
|
||||
<span className="text-label text-text-muted">{formatPrice(g.tax)}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<div className="flex flex-col gap-0.5 w-full">
|
||||
<p className="text-label text-text-muted">enthält MwSt.:</p>
|
||||
{groups.map((g) => (
|
||||
<p key={g.rate} className="text-label text-text-muted pl-2">
|
||||
{g.rate}%: {formatPrice(g.tax)}
|
||||
</p>
|
||||
<div key={g.rate} className="flex items-center w-full pl-2">
|
||||
<span className="text-label text-text-muted">{g.rate}%</span>
|
||||
<span className="flex-1" />
|
||||
<span className="text-label text-text-muted">{formatPrice(g.tax)}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user