Add full PWA support (icons, manifest, service worker, pwa lib and bridge) and introduce install/offline UI. Generate app icons via a new scripts/generate-icons.js and include multiple icon sizes in public/icons; update manifest and layout head meta/preconnect. Revamp global styles (globals.css) with new utilities, animations, spacing for bottom nav, card shadows, skeletons and accessibility tweaks. Polish major screens (login, collections, map, settings) with improved headers, loading states, touch/press feedback, and layout adjustments; add new components (InstallPrompt, OfflineIndicator, PWABridge) and update various components to match new visual/UX patterns. Update Dockerfile to generate icons and use Next.js static export output (/out) for nginx, and bump package setup to support icon generation.
52 lines
No EOL
1.5 KiB
JavaScript
52 lines
No EOL
1.5 KiB
JavaScript
const sharp = require('sharp');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const svgPath = path.join(__dirname, '../public/icons/icon.svg');
|
|
const outDir = path.join(__dirname, '../public/icons');
|
|
|
|
async function generateIcons() {
|
|
const svgBuffer = fs.readFileSync(svgPath);
|
|
|
|
const sizes = [
|
|
{ name: 'icon-72.png', size: 72 },
|
|
{ name: 'icon-96.png', size: 96 },
|
|
{ name: 'icon-128.png', size: 128 },
|
|
{ name: 'icon-144.png', size: 144 },
|
|
{ name: 'icon-152.png', size: 152 },
|
|
{ name: 'icon-192.png', size: 192 },
|
|
{ name: 'icon-384.png', size: 384 },
|
|
{ name: 'icon-512.png', size: 512 },
|
|
{ name: 'icon-maskable-192.png', size: 192 },
|
|
{ name: 'icon-maskable-512.png', size: 512 },
|
|
];
|
|
|
|
for (const { name, size } of sizes) {
|
|
const isMaskable = name.includes('maskable');
|
|
const padding = isMaskable ? Math.round(size * 0.1) : 0;
|
|
const innerSize = size - padding * 2;
|
|
|
|
await sharp(svgBuffer)
|
|
.resize(innerSize, innerSize)
|
|
.extend({
|
|
top: padding,
|
|
bottom: padding,
|
|
left: padding,
|
|
right: padding,
|
|
background: { r: 234, g: 88, b: 12, alpha: 1 },
|
|
})
|
|
.png()
|
|
.toFile(path.join(outDir, name));
|
|
|
|
console.log(`Generated ${name} (${size}x${size})`);
|
|
}
|
|
|
|
// Apple touch icon (180x180)
|
|
await sharp(svgBuffer)
|
|
.resize(180, 180)
|
|
.png()
|
|
.toFile(path.join(outDir, 'apple-touch-icon.png'));
|
|
console.log('Generated apple-touch-icon.png (180x180)');
|
|
}
|
|
|
|
generateIcons().catch(console.error); |