Files
Momento/memento-note/scripts/add-expand-btn.js

38 lines
1.4 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, '..', 'components', 'notes-tabs-view.tsx');
let lines = fs.readFileSync(filePath, 'utf8').split('\r\n');
// Line 977 (index 976) closes the scrollable div
// Line 978 (index 977) closes the left panel div
// We need to:
// 1. After the scrollable </div> (index 976), add )} to close {listOpen && (...
// 2. Add expand button JSX
// 3. Then close left panel div
const expandButton = [
' )}',
' {/* Expand button shown in collapsed state */}',
' {!listOpen && (',
' <div className="flex flex-col items-center pt-3">',
' <Button',
' variant="ghost"',
' size="sm"',
' className="h-7 w-7 p-0 text-muted-foreground/70 hover:bg-primary/8 hover:text-primary"',
' onClick={() => setListOpen(true)}',
' title="Afficher la liste"',
' >',
' <PanelLeftOpen className="h-3.5 w-3.5" />',
' </Button>',
' </div>',
' )}',
];
// Insert after index 976 (which is ' </div>' - the scrollable div close)
// and remove the original ' </div>' at index 977 (left panel close)
// then re-add left panel close
lines.splice(977, 1, ...expandButton, ' </div>');
fs.writeFileSync(filePath, lines.join('\r\n'));
console.log('Done, total lines:', lines.length);