Commit Graph
349 Commits
Author SHA1 Message Date
Christian Vidal Wolf f15c9fa853 fix: pad rows to match extendedHeaders length so internal cols are readable 2026-04-23 19:17:03 +02:00
Christian Vidal Wolf 7ef9f62497 debug: add diagnostic logs to trace history merge for 59272EN 2026-04-23 19:14:10 +02:00
Christian Vidal Wolf c1e3960a20 fix: merge history data into rows when products table is empty 2026-04-23 19:07:38 +02:00
Christian Vidal Wolf ee94926d04 fix: HistoryEntry.id type changed from number to string (Supabase returns UUID) 2026-04-23 18:58:52 +02:00
Christian Vidal Wolf be2adbfe68 debug: add detailed logging to trace history loading 2026-04-23 18:51:07 +02:00
Christian Vidal Wolf 0eeeeb480c fix: always load history on mount and reload on data change 2026-04-23 18:47:32 +02:00
Christian Vidal Wolf 7b71aa484e fix: reload history when data refreshes from Dropbox 2026-04-23 18:43:18 +02:00
Christian Vidal Wolf e0508d50d6 fix: restore internal control columns and protect them from Dropbox sync overrides 2026-04-23 18:36:35 +02:00
Christian Vidal Wolf 5112a27cda 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.
2026-04-23 18:27:40 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 e1cfaaedfa fix: paginate getAllSyncedRows to fetch all products beyond the 1000 row Supabase cap
With 1005+ products, the old query returned only the top 1000 by updated_at.
Items edited long ago (like 51016DE) were silently missing from syncedData,
so the merge never applied their saved edits. Now paginate by product_id
until we exhaust the table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:56:54 +02:00
Christian Vidal Wolf be7009353a temp: diagnostic log v2 for 51016DE 2026-04-23 16:54:31 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 596b779e01 fix: guard against undefined headers in MissingDataView and MatrixView
Extended headers array can have empty strings that get passed as header
values; guard all .toLowerCase().includes() calls with (h || '').

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:51:16 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 0165793b3e fix: fill sparse holes in extendedHeaders to prevent undefined.includes() crash
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:47:39 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 96c56947c0 fix: extend headers with virtual columns so saved edits at indices >Excel length render
When the Excel shrinks (fewer columns than when an edit was saved), the
saved value exists in Supabase at e.g. index 103 but headers only covers
0-76, so the column never renders. Now we pad headers up to the hardcoded
virtual column indices (PRODUCT_TYPE=103, etc.) so the merge value is
visible in the UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:44:42 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 59e4bdeb92 fix: protect products with history from being overwritten by Dropbox sync
Products that have entries in products_history were edited at some point.
If their status was accidentally reset to 'excel', the sync would overwrite
their data. Now also check products_history to build the protected set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:38:23 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 80f86cb83e fix: remove temp diag log
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:35:20 +02:00
Christian Vidal Wolf c3dda5d919 temp: add diag log for 51016DE Supabase data 2026-04-23 16:31:30 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 ebef518f11 fix: apply Supabase edits by diff vs Excel, not by editable column index
Instead of relying on resolvedCols.PRODUCT_TYPE (which can resolve to the
wrong index if the column header doesn't match the pattern), compare the
saved Supabase row against the fresh Excel row: any index where they differ
is a user edit and gets applied. This fixes TYPE / 'Surprise Bath bomb'
not appearing after reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:29:46 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 63242d8852 fix: resolve TYPE column with pattern ['type'] instead of ['product','type']
The column header in the Excel is 'TYPE', not 'Product Type', so the
old pattern never matched. resolveColumnIndices fell back to the hardcoded
index 103, causing the PRODUCT_TYPE editable column index to be wrong on
reload and edited values (e.g. 'Surprise Bath bomb') to never be applied.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:26:04 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 f3ed3cf147 fix: preserve edited changes after export and on Dropbox reload
resetAllPendingRows was setting status to 'synced' instead of 'edited',
causing the merge logic on reload to skip those rows. Also keep 'edited'
and 'saved' statuses locally after export instead of clearing all.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:22:35 +02:00
Christian Vidal Wolf 7de903a184 fix: load saved edits (status edited/pending) from Supabase 2026-04-23 16:16:20 +02:00
Christian Vidal Wolf 56fc7d34c3 fix: load fresh Excel values, only preserve pending edits 2026-04-23 16:14:18 +02:00
Christian Vidal Wolf 6bcf697165 fix: always use fresh Dropbox Excel values on load 2026-04-23 16:12:09 +02:00
Christian Vidal Wolf 605b93c445 fix: sync preserves manually edited items (status edited/pending) 2026-04-23 16:10:01 +02:00
Christian Vidal Wolf c2b229e899 fix: only preserve Supabase if value is different from Dropbox 2026-04-23 16:07:16 +02:00
Christian Vidal Wolf ba5bea44c0 fix: increase synced rows limit to 1000 2026-04-23 16:02:59 +02:00
Christian Vidal Wolf d98665fde0 fix: preserve app edits from Supabase (shows in Change History) 2026-04-23 16:00:21 +02:00
Christian Vidal Wolf 5ad1bff842 fix: use Dropbox values unless there's pending edit 2026-04-23 15:57:33 +02:00
Christian Vidal Wolf dbaf0e76fe Fix: Implement dynamic column re-alignment for data merging.
- Automatically detects if saved data uses the old Excel structure.
- Shifts indices dynamically to ensure UVP and SRP values match current columns.
- Fixes the 2.41 UVP and 4.95 SRP Int discrepancy.
2026-04-23 15:55:13 +02:00
Christian Vidal Wolf ce343a1b1f Fix: Debug API env check. 2026-04-23 15:51:40 +02:00
Christian Vidal Wolf 1b28399b76 Fix: Final attempt at migration script fix.
- Removed 'new' keyword before error object.
- Reverted to sequential processing to ensure stability.
- Improved error reporting.
2026-04-23 15:46:54 +02:00
Christian Vidal Wolf 31b2451835 Fix: Improve migration script for database re-alignment.
- Added robust error handling.
- Optimized database updates with Promise.all.
- Broadened status check to ensure all affected rows are captured.
2026-04-23 15:46:10 +02:00
Christian Vidal Wolf 54dfc24239 Fix: Re-align database indices after column insertion in Excel.
- Created a migration API route to shift data indices >= 12.
- Resolved discrepancy where UVP was showing LP Onl values due to column shift.
2026-04-23 15:43:40 +02:00
Christian Vidal Wolf 68d8d67f95 UI: Change status of restored rows from 'pending' to 'synced' to remove distracting yellow highlights. Now previously saved work appears with a normal background while still being correctly loaded from the database. 2026-04-23 15:09:00 +02:00
Christian Vidal Wolf 397023b00d Fix: Restore missing user edits by refining the data merge logic.
- Migrated 126 manual edits to 'edited' status.
- Updated App.tsx to merge rows with 'edited' or 'synced' status.
- Protected manual edits from being overwritten by automated Dropbox syncs.
2026-04-23 15:04:43 +02:00
Christian Vidal Wolf 360baa7f10 feat: increase history limit to 500 entries 2026-04-23 15:00:08 +02:00
Christian Vidal Wolf b14cfe00f0 feat: fullscreen mode for all tabs + fix Dropbox/Supabase sync priority 2026-04-23 14:53:43 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 e7a3a4619d UI: Add multi-select filter dropdown to Type column in Pricing view
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:31:39 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 f545776e15 UI: Add 'Check Anna' column to Pricing Units view
Mirrors Check Ying with its own checkbox and note editor (pink theme).
Stored in virtual columns ANNA_CHECK (105) and ANNA_NOTE (106).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:02:14 +02:00
Christian Vidal Wolf aca37c4a99 Feature: Add ITEM TO LOGISTIC column to Pricing Units tab.
- Integrated new column after TYPE.
- Enabled inline editing with auto-save.
- Added field to the full row EditPanel.
- Configured dynamic column detection in types.ts.
2026-04-23 12:58:51 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 617eb00edb UI: Rename 'Check' column to 'Check Ying' in Pricing view
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 12:58:11 +02:00
Christian Vidal Wolf 1c3da9024c Fix: Update Dropbox sharing link to the new version provided by the user. Restores auto-load functionality in both dev and production. 2026-04-23 12:50:40 +02:00
Christian Vidal Wolf f6ef573f3a Auth: Implement automatic session refresh logic to prevent 'JWT expired' errors. The app now handles token renewal in the background, allowing users to save changes without interruption. 2026-04-23 12:37:04 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 e0484354b9 Security: Add HTTP security headers via vercel.json
Adds HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy,
and Permissions-Policy to all responses. CSP allowlist includes only
Supabase and Dropbox as external connect targets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 10:04:33 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 2e4ab35f37 Security: Restrict API endpoints to allowed origin (CORS)
Both Vercel serverless functions now enforce CORS, returning 403 for
requests from any origin other than craze-data-check.vercel.app.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 10:02:47 +02:00
Christian Vidal WolfandClaude Sonnet 4.6 dec24f52f4 Security: Enable RLS support by passing user JWT in Supabase requests
Replaced hardcoded anon key as Bearer token with authHeaders() helper
that uses the authenticated user's access_token when available, enabling
Row Level Security policies to identify the calling user correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:59:46 +02:00
Christian Vidal Wolf 7a32605189 Fix: Import missing 'cn' and 'X' in App.tsx. Resolves blank screen runtime error. 2026-04-22 20:40:32 +02:00
Christian Vidal Wolf b5ea911e43 UI: Implement Maximize mode for tables. Added a 'MAXIMIZE' button to TopBar and an 'X' close button in fullscreen mode. Hides sidebar and header to provide maximum screen space for data tables. 2026-04-22 20:38:06 +02:00
Christian Vidal Wolf bf98e4e4ba UI: Add resizable columns to Matrix View. Users can now adjust column widths by dragging, improving data visibility in the All Data view. 2026-04-22 17:09:46 +02:00
Christian Vidal Wolf f01b720c05 UI: Enable 'Enter' key to apply filters in ColumnFilterPopover. Improved search usability by allowing quick selection and application of filters from the keyboard. 2026-04-22 17:06:35 +02:00