30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
const fs = require('fs');
|
|
let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8');
|
|
|
|
const regex = /<div className="flex justify-between">\s*<div className="flex gap-2">\s*<DropdownMenu>[\s\S]*?<Button variant="outline" onClick=\{\(\) => setOtrosDialog\(true\)\}><Eye className="h-4 w-4 mr-2" \/>Otros<\/Button>\s*<Button variant="outline" onClick=\{\(\) => \{ setImportFecha\(getLocalToday\(\)\); setImportHora\(new Date\(\)\.toTimeString\(\)\.slice\(0, 5\)\); setImportTexto\(''\); setImportResultados\(\[\]\); setImportObservaciones\(''\); setImportDialog\(true\); \}\}>\s*<FileText className="h-4 w-4 mr-2" \/>Importar\s*<\/Button>\s*<\/div>\s*<\/div>/g;
|
|
|
|
const match = code.match(regex);
|
|
if (match) {
|
|
const content = match[0].replace('<div className="flex justify-between">\n <div className="flex gap-2">', '').replace('</div>\n </div>', '').trim();
|
|
|
|
const repl = `
|
|
{portalNode ? createPortal(
|
|
<>
|
|
${content}
|
|
</>,
|
|
portalNode
|
|
) : (
|
|
<div className="flex justify-between mb-4">
|
|
<div className="flex gap-2">
|
|
${content}
|
|
</div>
|
|
</div>
|
|
)}
|
|
`.trim();
|
|
|
|
code = code.replace(regex, repl);
|
|
fs.writeFileSync('src/sections/HistoriaClinica.tsx', code);
|
|
} else {
|
|
console.log("NOT FOUND");
|
|
}
|