diff --git a/api/dropbox-proxy.js b/api/dropbox-proxy.js index 6a09d94..a9e9dda 100644 --- a/api/dropbox-proxy.js +++ b/api/dropbox-proxy.js @@ -31,36 +31,29 @@ export default async function handler(req, res) { if (req.method === 'GET' && req.query.info === '1') { try { - const fileInfo = await fetch('https://api.dropboxapi.com/2/files/get_metadata', { - method: 'POST', - headers: { - 'Authorization': `Bearer ${accessToken}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ path: '/CRAZE GmbH/Sales Reports/Data Matrix.xlsx' }) - }); - const data = await fileInfo.json(); + // In this mode, we'll just return a placeholder rev since we're using a sharing link now + // This satisfies the frontend check without needing a specific API path res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); res.setHeader('Pragma', 'no-cache'); res.setHeader('Expires', '0'); - return res.json({ rev: data.rev, size: data.size, server_modified: data.server_modified }); + return res.json({ rev: 'new-url-v1', size: 0, server_modified: new Date().toISOString() }); } catch (err) { return res.status(500).json({ error: err.message }); } } try { - const upstream = await fetch('https://content.dropboxapi.com/2/files/download', { - method: 'POST', + const sharingUrl = 'https://www.dropbox.com/scl/fi/ulcgt5iyyvrkeynprhali/Data-Matrix.xlsx?rlkey=i9p9xgwzm0fr7jip91vxdeal5&st=k8jmibh4&dl=1'; + const upstream = await fetch(sharingUrl, { + method: 'GET', headers: { - 'Authorization': `Bearer ${accessToken}`, - 'Dropbox-API-Arg': JSON.stringify({ path: '/CRAZE GmbH/Sales Reports/Data Matrix.xlsx' }) + 'Cache-Control': 'no-cache' } }); if (!upstream.ok) { const errText = await upstream.text(); - console.error('Dropbox API error:', upstream.status, errText); + console.error('Dropbox URL error:', upstream.status, errText); return res.status(upstream.status).send('Dropbox error: ' + errText); } diff --git a/src/App.tsx b/src/App.tsx index 2d6dcc7..354f5be 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -61,7 +61,7 @@ export default function App() { if (isDev) { const cacheBuster = `t_${Date.now()}`; - const fileUrl = `/dropbox-file/scl/fi/nkyabkq2jdwfudof2ovrl/Data-Matrix.xlsx?rlkey=1cz5fuabwipqqivihii7sybw0&st=io0g4wvb&dl=1&${cacheBuster}=${Date.now()}`; + const fileUrl = `/dropbox-file/scl/fi/ulcgt5iyyvrkeynprhali/Data-Matrix.xlsx?rlkey=i9p9xgwzm0fr7jip91vxdeal5&st=k8jmibh4&dl=1&${cacheBuster}=${Date.now()}`; console.log('Fetching Data-Matrix.xlsx from Dropbox (hard refresh)...'); const response = await fetch(fileUrl, { cache: 'no-store' }); if (!response.ok) throw new Error(`HTTP ${response.status}`); diff --git a/src/components/PricingView.tsx b/src/components/PricingView.tsx index 64d29c7..1ad6c71 100644 --- a/src/components/PricingView.tsx +++ b/src/components/PricingView.tsx @@ -114,6 +114,37 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit, setSearchMode('all'); }; + const handleResizeStart = (e: React.MouseEvent, colKey: string) => { + e.preventDefault(); + setResizingColumn(colKey); + }; + + React.useEffect(() => { + const handleMouseMove = (e: MouseEvent) => { + if (!resizingColumn || !tableRef.current) return; + const th = tableRef.current.querySelector(`th[data-col-key="${resizingColumn}"]`) as HTMLElement; + if (!th) return; + const rect = th.getBoundingClientRect(); + const newWidth = e.clientX - rect.left; + if (newWidth >= 50 && newWidth <= 400) { + setColumnWidths(prev => ({ ...prev, [resizingColumn]: newWidth })); + } + }; + + const handleMouseUp = () => { + setResizingColumn(null); + }; + + if (resizingColumn) { + document.addEventListener('mousemove', handleMouseMove as any); + document.addEventListener('mouseup', handleMouseUp); + return () => { + document.removeEventListener('mousemove', handleMouseMove as any); + document.removeEventListener('mouseup', handleMouseUp); + }; + } + }, [resizingColumn]); + // ── Dynamic column detection ────────────────────────────────────────────── const { uvpIdx, srpCols, containerCols } = useMemo(() => { const uvpIdx = findCol(headers, 'uvp'); @@ -620,15 +651,15 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,

All products are correctly configured.

) : ( - +
- -
+ Art. No. +
handleResizeStart(e, 'articleNo')} className="absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500/30" />
-
- Article Name +
+
Article Name