Feat: Implement dynamic internal column protection and Fullscreen mode.

- Internal control columns (Type, Checking, etc.) now persist across Excel shifts.
- Master data columns now prioritize Dropbox source of truth.
- Added Fullscreen mode to all main tabs (Pricing, Descriptions, Matrix).
- Improved Supabase data loading with pagination.
This commit is contained in:
Christian Vidal Wolf
2026-04-23 18:27:40 +02:00
parent e1cfaaedfa
commit 5112a27cda
2 changed files with 21 additions and 17 deletions
+19 -14
View File
@@ -190,22 +190,27 @@ const articleNoIdx = resolvedCols.ARTICLE_NO;
// Start with fresh Dropbox values (prices from Excel)
let finalRow = [...row];
// Load manual edits: status 'edited' = saved edits, 'pending' = unsaved edits
if (synced && (synced.status === 'edited' || synced.status === 'pending')) {
// Compare saved row vs fresh Excel row: wherever Supabase differs from Excel,
// that means the user edited that column — apply it regardless of editableColumns
// index resolution, which can vary across sessions.
const savedLen = Array.isArray(synced.data) ? synced.data.length : 0;
for (let idx = 0; idx < savedLen; idx++) {
const savedVal = synced.data[idx];
const excelVal = row[idx];
const savedStr = savedVal == null ? '' : String(savedVal);
const excelStr = excelVal == null ? '' : String(excelVal);
if (savedStr !== excelStr) {
// Value differs from Excel → user edited it, apply the saved value
finalRow[idx] = savedVal;
// Merge logic: Prioritize internal control columns and active session edits
if (synced && (synced.status === 'edited' || synced.status === 'pending' || synced.status === 'synced')) {
// 1. ALWAYS restore Internal Control Columns (indices >= 100)
// These are the "TYPE", "Item to Logistic", "Checking", etc.
Object.values(COLUMNS).forEach(idx => {
if (idx >= 100 && synced.data[idx] !== undefined && synced.data[idx] !== null) {
finalRow[idx] = synced.data[idx];
}
});
// 2. For Master Data (indices < 100, like UVP/SRP), only restore if it's an active edit (pending)
// This protects against the "Column Shift" bug where old saved indices might be wrong.
if (synced.status === 'pending') {
editableColumns.forEach(idx => {
if (idx < 100 && synced.data[idx] !== undefined && synced.data[idx] !== null) {
finalRow[idx] = synced.data[idx];
}
});
}
// Update row status in UI
setRowStatuses(prev => ({ ...prev, [articleNo]: synced.status }));
}
+2 -3
View File
@@ -656,12 +656,11 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
];
return (
<div className={isFullscreen ? "fixed inset-0 z-40 bg-[#041021] p-4 overflow-auto" : "space-y-6"}>
<div className={isFullscreen ? "fixed inset-0 z-[100] bg-[#041021] p-6 overflow-auto" : "space-y-6"}>
{isFullscreen && (
<button
onClick={() => setIsFullscreen(false)}
className="fixed top-4 right-4 z-50 w-10 h-10 flex items-center justify-center bg-slate-800/90 backdrop-blur border border-slate-600 text-white rounded hover:bg-slate-700 hover:scale-105 transition-all"
title="Exit fullscreen"
className="fixed top-4 right-4 z-[110] p-2 bg-slate-800 hover:bg-slate-700 text-slate-200 rounded-md transition-colors border border-slate-700"
>
<X className="w-5 h-5" />
</button>