feat: Add major features - Mejoras 5-10
- Mejora 5: Órdenes de Compra integration in obra detail - Mejora 6: Portal de Cliente with JWT auth for clients - Mejora 7: Diagrama de Gantt for project visualization - Mejora 8: Push Notifications with service worker - Mejora 9: Activity Log system with templates - Mejora 10: PWA support with offline capabilities New features include: - Fotos gallery with upload/delete - Bitácora de obra with daily logs - PDF export for reports, gastos, presupuestos - Control de asistencia for employees - Client portal with granular permissions - Gantt chart with task visualization - Push notification system - Activity timeline component - PWA manifest, icons, and install prompt Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
56
scripts/generate-icons.js
Normal file
56
scripts/generate-icons.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Read the SVG file
|
||||
const svgPath = path.join(__dirname, '../public/icons/icon.svg');
|
||||
const svgContent = fs.readFileSync(svgPath, 'utf8');
|
||||
|
||||
// Icon sizes for PWA
|
||||
const sizes = [72, 96, 128, 144, 152, 192, 384, 512];
|
||||
|
||||
// Try to use sharp if available, otherwise create placeholder files
|
||||
async function generateIcons() {
|
||||
try {
|
||||
const sharp = require('sharp');
|
||||
|
||||
for (const size of sizes) {
|
||||
const outputPath = path.join(__dirname, `../public/icons/icon-${size}x${size}.png`);
|
||||
|
||||
await sharp(Buffer.from(svgContent))
|
||||
.resize(size, size)
|
||||
.png()
|
||||
.toFile(outputPath);
|
||||
|
||||
console.log(`Generated: icon-${size}x${size}.png`);
|
||||
}
|
||||
|
||||
// Generate favicon
|
||||
await sharp(Buffer.from(svgContent))
|
||||
.resize(32, 32)
|
||||
.png()
|
||||
.toFile(path.join(__dirname, '../public/favicon.png'));
|
||||
|
||||
console.log('Generated: favicon.png');
|
||||
|
||||
// Generate apple-touch-icon
|
||||
await sharp(Buffer.from(svgContent))
|
||||
.resize(180, 180)
|
||||
.png()
|
||||
.toFile(path.join(__dirname, '../public/apple-touch-icon.png'));
|
||||
|
||||
console.log('Generated: apple-touch-icon.png');
|
||||
|
||||
console.log('\nAll icons generated successfully!');
|
||||
} catch (error) {
|
||||
if (error.code === 'MODULE_NOT_FOUND') {
|
||||
console.log('Sharp not found. Installing...');
|
||||
const { execSync } = require('child_process');
|
||||
execSync('npm install sharp --save-dev', { stdio: 'inherit' });
|
||||
console.log('Sharp installed. Please run this script again.');
|
||||
} else {
|
||||
console.error('Error generating icons:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generateIcons();
|
||||
Reference in New Issue
Block a user