From 129584d7389a9eae94b2091b70ebf42e58c550a6 Mon Sep 17 00:00:00 2001 From: Deploy Date: Tue, 25 Aug 2026 22:29:12 +0200 Subject: [PATCH] fix(pos): hide selfpay controls and normalize trend labels --- project/VERSION | 2 +- project/apps/admin/package-lock.json | 4 +- project/apps/admin/package.json | 2 +- .../src/components/reporting/TrendChart.tsx | 38 +++++++++++-------- project/apps/pos/package-lock.json | 4 +- project/apps/pos/package.json | 2 +- project/apps/pos/src/app/(terminal)/page.tsx | 37 +++++++++--------- project/frontend/package-lock.json | 4 +- project/frontend/package.json | 2 +- project/package-lock.json | 4 +- project/package.json | 2 +- project/storefront/package-lock.json | 4 +- project/storefront/package.json | 2 +- 13 files changed, 59 insertions(+), 48 deletions(-) diff --git a/project/VERSION b/project/VERSION index ee1372d..7179039 100644 --- a/project/VERSION +++ b/project/VERSION @@ -1 +1 @@ -0.2.2 +0.2.3 diff --git a/project/apps/admin/package-lock.json b/project/apps/admin/package-lock.json index 60c200e..696a288 100644 --- a/project/apps/admin/package-lock.json +++ b/project/apps/admin/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mercadodevida/admin", - "version": "0.2.2", + "version": "0.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mercadodevida/admin", - "version": "0.2.2", + "version": "0.2.3", "dependencies": { "@lexical/history": "^0.49.0", "@lexical/html": "^0.49.0", diff --git a/project/apps/admin/package.json b/project/apps/admin/package.json index d025a8a..4a616ba 100644 --- a/project/apps/admin/package.json +++ b/project/apps/admin/package.json @@ -1,6 +1,6 @@ { "name": "@mercadodevida/admin", - "version": "0.2.2", + "version": "0.2.3", "private": true, "scripts": { "dev": "next dev --port 3001", diff --git a/project/apps/admin/src/components/reporting/TrendChart.tsx b/project/apps/admin/src/components/reporting/TrendChart.tsx index 69f62ed..2a58fd2 100644 --- a/project/apps/admin/src/components/reporting/TrendChart.tsx +++ b/project/apps/admin/src/components/reporting/TrendChart.tsx @@ -16,28 +16,36 @@ interface TrendChartProps { export function TrendChart({ data, maxValue, height = 120 }: TrendChartProps) { if (data.length === 0) return null; - const width = 100; // percentage-based SVG - const barWidth = Math.min(3, (width * 0.9) / data.length); - const gap = Math.max(0.2, (width - barWidth * data.length) / (data.length + 1)); - const chartHeight = height - 34; // leave room for labels + const chartWidth = Math.max(420, data.length * 26); + const padding = { top: 12, right: 14, bottom: 28, left: 14 }; + const plotWidth = chartWidth - padding.left - padding.right; + const chartHeight = Math.max(60, height - padding.top - padding.bottom); + const barWidth = Math.min(16, Math.max(7, (plotWidth / data.length) * 0.62)); + const gap = Math.max(4, (plotWidth - barWidth * data.length) / Math.max(data.length + 1, 1)); return (
{/* Y-axis baseline */} - + {data.map((point, i) => { const barH = maxValue > 0 ? (point.value / maxValue) * chartHeight : 0; - const x = gap + i * (barWidth + gap); - const y = chartHeight - barH; + const x = padding.left + gap + i * (barWidth + gap); + const y = padding.top + chartHeight - barH; return ( @@ -48,16 +56,16 @@ export function TrendChart({ data, maxValue, height = 120 }: TrendChartProps) { width={barWidth} height={barH} fill="#2D6A4F" - rx="1" + rx="3" className="transition-all duration-200 hover:fill-[#245a42]" /> - {/* Label (show every ~7 bars or if narrow) */} {data.length <= 31 && ( {point.label.slice(5, 10)} diff --git a/project/apps/pos/package-lock.json b/project/apps/pos/package-lock.json index 67c436f..0b75370 100644 --- a/project/apps/pos/package-lock.json +++ b/project/apps/pos/package-lock.json @@ -1,12 +1,12 @@ { "name": "mercadodevida-pos", - "version": "0.2.2", + "version": "0.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mercadodevida-pos", - "version": "0.2.2", + "version": "0.2.3", "dependencies": { "next": "^16.3.1", "react": "^19.2.8", diff --git a/project/apps/pos/package.json b/project/apps/pos/package.json index 0364b48..247c559 100644 --- a/project/apps/pos/package.json +++ b/project/apps/pos/package.json @@ -1,6 +1,6 @@ { "name": "mercadodevida-pos", - "version": "0.2.2", + "version": "0.2.3", "private": true, "scripts": { "dev": "next dev --port 3002", diff --git a/project/apps/pos/src/app/(terminal)/page.tsx b/project/apps/pos/src/app/(terminal)/page.tsx index 4c707d6..1621d3d 100644 --- a/project/apps/pos/src/app/(terminal)/page.tsx +++ b/project/apps/pos/src/app/(terminal)/page.tsx @@ -65,7 +65,7 @@ interface Config { terminal: { id: string; name: string; - settings?: { lineDiscountsEnabled?: boolean } & Record; + settings?: { lineDiscountsEnabled?: boolean; selfpayMode?: boolean } & Record; }; store: { id: string; name: string }; paymentMethods: PaymentMethod[]; @@ -439,7 +439,8 @@ export default function RegisterPage() { }, [cart]); const paidCents = payments.reduce((sum, payment) => sum + payment.amountCents, 0); const remainingCents = Math.max(0, totals.total - paidCents); - const lineDiscountsEnabled = config?.terminal.settings?.lineDiscountsEnabled !== false; + const isSelfpayMode = config?.terminal.settings?.selfpayMode === true; + const lineDiscountsEnabled = !isSelfpayMode && config?.terminal.settings?.lineDiscountsEnabled !== false; const applyDiscount = (lineId: string, discountCents: number) => { setCart((current) => @@ -921,7 +922,7 @@ export default function RegisterPage() { return (
- {showSidebar && ( + {!isSelfpayMode && showSidebar && ( - {showDiscountPanel && selectedItem && ( + {!isSelfpayMode && showDiscountPanel && selectedItem && (