- Fix silent redirect-to-home for unauthenticated users on protected routes; now redirects to login with a return path - Restyle OrderCard, SearchInput, Filters, DropDown, and product card image sizing/centering to match the app's LESS-token design language - Fix ant-design Slider handle placement/drag under RTL and seed a valid default range so handles actually render - Fix chip-row edge padding and top spacing across Orders/Cart/Search lists - Add pull-to-refresh to the dashboard and fix its header/padding to match the fixed PageBar pattern - Remove the floating WhatsApp button from index.html
60 lines
2.7 KiB
JavaScript
60 lines
2.7 KiB
JavaScript
// Generates distinct SVG placeholder images per product category, so the 200
|
|
// mock products render varied artwork instead of one shared no-items.png icon.
|
|
// Not photography — an honest stand-in, styled to the app's own gold/cream
|
|
// palette, with a distinct glyph + background tint per category so the grid
|
|
// reads as varied rather than one repeated tile.
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const OUT_DIR = path.join(__dirname, '../../user-app/public/img/products');
|
|
fs.mkdirSync(OUT_DIR, { recursive: true });
|
|
|
|
// category slug -> [glyph path (viewBox 0 0 64 64), accent color]
|
|
const GLYPHS = {
|
|
rings: {
|
|
accent: '#B08D57',
|
|
path: '<circle cx="32" cy="40" r="14" fill="none" stroke="currentColor" stroke-width="4"/><circle cx="32" cy="20" r="6" fill="currentColor"/>',
|
|
},
|
|
bracelets: {
|
|
accent: '#8D6A46',
|
|
path: '<ellipse cx="32" cy="32" rx="22" ry="14" fill="none" stroke="currentColor" stroke-width="4"/><ellipse cx="32" cy="32" rx="14" ry="8" fill="none" stroke="currentColor" stroke-width="2" opacity="0.5"/>',
|
|
},
|
|
necklaces: {
|
|
accent: '#C9A24B',
|
|
path: '<path d="M14 14 C14 34 24 44 32 44 C40 44 50 34 50 14" fill="none" stroke="currentColor" stroke-width="3"/><path d="M32 44 L32 52 L26 58 L38 58 Z" fill="currentColor"/>',
|
|
},
|
|
earrings: {
|
|
accent: '#A67C52',
|
|
path: '<circle cx="32" cy="16" r="5" fill="currentColor"/><path d="M32 21 L32 34" stroke="currentColor" stroke-width="3"/><circle cx="32" cy="42" r="10" fill="none" stroke="currentColor" stroke-width="3"/>',
|
|
},
|
|
coins: {
|
|
accent: '#D4AF37',
|
|
path: '<circle cx="32" cy="32" r="22" fill="none" stroke="currentColor" stroke-width="4"/><circle cx="32" cy="32" r="14" fill="none" stroke="currentColor" stroke-width="2" opacity="0.6"/><text x="32" y="38" font-size="14" text-anchor="middle" fill="currentColor" font-family="sans-serif">Au</text>',
|
|
},
|
|
};
|
|
|
|
// A handful of warm background tints so 200 tiles don't look identical even
|
|
// within one category.
|
|
const BG_TINTS = ['#F6F3EF', '#F3EADC', '#FAF5EC', '#F0E6D6', '#F8F1E6', '#EFE4D3'];
|
|
|
|
function svgFor(categorySlug, variantIndex) {
|
|
const g = GLYPHS[categorySlug] || GLYPHS.rings;
|
|
const bg = BG_TINTS[variantIndex % BG_TINTS.length];
|
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="480" height="480">
|
|
<rect width="64" height="64" fill="${bg}"/>
|
|
<g transform="translate(0,0)" color="${g.accent}" opacity="0.92">
|
|
${g.path}
|
|
</g>
|
|
</svg>`;
|
|
}
|
|
|
|
let written = 0;
|
|
for (const slug of Object.keys(GLYPHS)) {
|
|
for (let i = 0; i < 6; i++) {
|
|
const file = path.join(OUT_DIR, `${slug}-${i}.svg`);
|
|
fs.writeFileSync(file, svgFor(slug, i));
|
|
written++;
|
|
}
|
|
}
|
|
console.log(`wrote ${written} placeholder SVGs to ${OUT_DIR}`);
|