diff --git a/components/timeshift-spreadsheet.tsx b/components/timeshift-spreadsheet.tsx index e5fb797..813940c 100644 --- a/components/timeshift-spreadsheet.tsx +++ b/components/timeshift-spreadsheet.tsx @@ -411,28 +411,76 @@ export function TimeshiftSpreadsheet({ teamId, teamName }: TimeshiftSpreadsheetP const rows = table.querySelectorAll('tr') if (rows[0]) { const cells = rows[0].querySelectorAll('td') - const targetCell = cells[x + 1] as HTMLElement // +1 because first cell is row number - console.log("Target cell found:", !!targetCell, "Target cell:", targetCell) + let targetCell = cells[x + 1] as HTMLElement // +1 because first cell is row number + console.log("Initial target cell found:", !!targetCell, "Cell display:", targetCell?.style.display, "Target cell:", targetCell) + + // Handle both hidden and visible cells + if (targetCell) { + if (targetCell.style.display === 'none') { + console.log("🔍 Target cell is hidden, finding visible merged cell...") + const targetX = parseInt(String(x)) + + // For merged cells, find the visible cell that represents this position + let foundCell = null + + // Look for visible cells around this position + for (let i = 1; i < cells.length; i++) { + const cell = cells[i] as HTMLElement + if (cell && cell.style.display !== 'none') { + const cellX = parseInt(cell.getAttribute('data-x') || '0') + const cellSpan = cell.colSpan || 1 + + // Check if this visible cell covers our target position + if (cellX <= targetX && targetX < cellX + cellSpan) { + foundCell = cell + console.log("🎯 Found covering visible cell:", foundCell, "covers position", targetX) + break + } + } + } + + if (foundCell) { + targetCell = foundCell + } else { + console.warn("❌ Could not find visible cell for hidden position") + return // Skip if we can't find a visible cell + } + } else { + console.log("✅ Target cell is visible, using directly") + } + } if (targetCell) { const displayValue = value !== undefined && value !== null ? String(value).trim() : '' console.log("Processing value:", displayValue) + console.log("Target cell before rotation:", targetCell.outerHTML) if (displayValue) { - // Apply rotation with improved styling - targetCell.innerHTML = `
${displayValue}
` + // Force clear any existing content first + targetCell.innerHTML = '' + + // Apply rotation with improved styling - using important to override jspreadsheet styles + const rotatedDiv = document.createElement('div') + rotatedDiv.style.cssText = ` + transform: rotate(-90deg) !important; + font-size: 12px !important; + height: 80px !important; + width: 20px !important; + display: flex !important; + align-items: center !important; + justify-content: center !important; + white-space: nowrap !important; + margin: 0 auto !important; + transform-origin: center center !important; + position: relative !important; + color: #000 !important; + background: transparent !important; + ` + rotatedDiv.textContent = displayValue + targetCell.appendChild(rotatedDiv) + console.log("✅ Rotation applied successfully to cell with value:", displayValue) + console.log("Target cell after rotation:", targetCell.outerHTML) } else { // Clear cell content but maintain structure targetCell.innerHTML = '' diff --git a/logs/auto-commit.log b/logs/auto-commit.log index 70f63ed..7180e58 100644 --- a/logs/auto-commit.log +++ b/logs/auto-commit.log @@ -161,3 +161,5 @@ 2025-07-30 10:07:58 +02:00: 📝 File changed: app/layout.tsx (change) 2025-07-30 10:07:58 +02:00: 📝 File changed: app/layout.tsx (change) 2025-07-30 10:08:28 +02:00: 🔄 Performing auto-commit... +2025-07-30 10:08:37 +02:00: ✅ Auto-commit successful +2025-07-30 10:24:37 +02:00: 🔖 Creating restore point... diff --git a/logs/auto-commit.out.log b/logs/auto-commit.out.log index be1c1f3..11274f7 100644 --- a/logs/auto-commit.out.log +++ b/logs/auto-commit.out.log @@ -157,3 +157,5 @@ 2025-07-30 10:07:58 +02:00: 📝 File changed: app/layout.tsx (change) 2025-07-30 10:07:58 +02:00: 📝 File changed: app/layout.tsx (change) 2025-07-30 10:08:28 +02:00: 🔄 Performing auto-commit... +2025-07-30 10:08:37 +02:00: ✅ Auto-commit successful +2025-07-30 10:24:37 +02:00: 🔖 Creating restore point...