Initial commit

This commit is contained in:
payacom
2026-07-08 21:01:18 +03:30
parent 78decbba05
commit d2d3398471
1210 changed files with 9645 additions and 2522 deletions

View File

@@ -0,0 +1,66 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.join(__dirname, "..");
const incoming = path.join(root, "public/images/icons/_incoming_settings");
const iconsDir = path.join(root, "public/images/icons");
function findSvg(folderKeyword, fileName) {
const dirs = fs.readdirSync(incoming, { withFileTypes: true });
const match = dirs.find((d) => d.isDirectory() && d.name.includes(folderKeyword));
if (!match) {
console.warn(`Folder not found for: ${folderKeyword}`);
return null;
}
const p = path.join(incoming, match.name, "vuesax", "bold", fileName);
return fs.existsSync(p) ? p : null;
}
function normalizeSvg(content, fill = "#292D32") {
return content
.replace(/#292D32/gi, fill)
.replace(/fill="#9A9A9A"/gi, `fill="${fill}"`)
.replace(/stroke="#9A9A9A"/gi, `stroke="${fill}"`);
}
function copyFrom(src, destName, fill) {
if (!src) return false;
const content = normalizeSvg(fs.readFileSync(src, "utf8"), fill);
fs.writeFileSync(path.join(iconsDir, destName), content, "utf8");
return true;
}
const jobs = [
["اشتراک", "share.svg", "share.svg"],
["seting", "setting.svg", "edit.svg"],
["درباره", "info-circle.svg", "contact.svg"],
["verify", "verify.svg", "verify.svg"],
["verify", "verify.svg", "verify2.svg"],
["verify", "verify.svg", "verify3.svg"],
["like", "heart.svg", "heart.svg"],
["like", "heart.svg", "red-heart.svg", "#EF4444"],
["درخواست", "document-normal.svg", "offer.svg"],
["عمکاری", "link-square.svg", "link-square.svg"],
["عمکاری", "link-square.svg", "celo-(celo).svg"],
["تاریک", "moon.svg", "moon.svg"],
["روشن", "sun.svg", "sun.svg"],
["احراز", "user-square.svg", "user-square.svg"],
["بیلبورد", "flash-circle.svg", "flash-circle.svg"],
["شبا", "user-tick.svg", "user-tick.svg"],
["تخصص", "instagram.svg", "instagram.svg"],
["کامنت", "message-text.svg", "message-text.svg"],
];
let n = 0;
for (const [folder, file, dest, fill] of jobs) {
const src = findSvg(folder, file);
if (copyFrom(src, dest, fill || "#292D32")) {
n++;
console.log(`OK ${dest}`);
}
}
fs.rmSync(incoming, { recursive: true, force: true });
console.log(`Applied ${n} icon files.`);

View File

@@ -0,0 +1,123 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.join(__dirname, "..");
const boldDir = path.join(root, "public/images/icons/vuesax/bold");
const iconsDir = path.join(root, "public/images/icons");
/** legacy filename -> vuesax bold filename (same folder) */
const LEGACY_MAP = {
"search-normal.svg": "search-normal.svg",
"candle.svg": "candle.svg",
"grid-3.svg": "grid-3.svg",
"sms.svg": "sms.svg",
"notification.svg": "notification.svg",
"send-msg.svg": "send-2.svg",
"select-img.svg": "gallery-add.svg",
"ruler&pen.svg": "ruler&pen.svg",
"weight.svg": "weight.svg",
"timer.svg": "timer.svg",
"location.svg": "location.svg",
"close-circle.svg": "close-circle.svg",
"gallery-add.svg": "gallery-add.svg",
"gallery-edit.svg": "gallery-edit.svg",
"medal-star.svg": "medal-star.svg",
"star1.svg": "star.svg",
"woman.svg": "woman.svg",
"man.svg": "man.svg",
"logout.svg": "logout.svg",
"copy.svg": "copy.svg",
"judge.svg": "judge.svg",
"danger.svg": "danger.svg",
"message-text.svg": "message-text.svg",
"share.svg": "share.svg",
"heart.svg": "heart.svg",
"sun.svg": "sun.svg",
"moon.svg": "moon.svg",
"edit.svg": "edit.svg",
"eye.svg": "eye.svg",
"add.svg": "add.svg",
"submit.svg": "tick-circle.svg",
"success.svg": "tick-circle.svg",
"failed.svg": "close-circle.svg",
"contact.svg": "call.svg",
"calendar.svg": "calendar.svg",
"arrow-down.svg": "arrow-down.svg",
"clock.svg": "clock.svg",
"verify.svg": "verify.svg",
"verify2.svg": "verify.svg",
"verify3.svg": "verify.svg",
"not-verify.svg": "info-circle.svg",
"academy.svg": "teacher.svg",
"services.svg": "box.svg",
"offer.svg": "ticket-star.svg",
"people.svg": "people.svg",
"phone.svg": "call.svg",
"mobile.svg": "mobile.svg",
"key.svg": "key.svg",
"flash-circle.svg": "flash.svg",
"shop-add.svg": "shop-add.svg",
"box.svg": "box.svg",
"wallet.svg": "wallet.svg",
"lifebuoy.svg": "lifebuoy.svg",
"teacher.svg": "teacher.svg",
"courthouse.svg": "building.svg",
"block-red.svg": "close-circle.svg",
"block-green.svg": "tick-circle.svg",
};
const CHAT_MAP = {
"timer.svg": "timer.svg",
"eye.svg": "eye.svg",
"attachment.svg": "link.svg",
"microphone-2.svg": "microphone-2.svg",
"send-2.svg": "send-2.svg",
"search-normal.svg": "search-normal.svg",
"trash.svg": "trash.svg",
"attachment-menu/camera.svg": "camera.svg",
"attachment-menu/gallery.svg": "gallery.svg",
"attachment-menu/video.svg": "video.svg",
"attachment-menu/file.svg": "folder-2.svg",
"attachment-menu/location.svg": "location.svg",
};
function normalizeSvg(content, fillOverride) {
let svg = content.replace(/#292D32/gi, fillOverride || "#292D32");
svg = svg.replace(/fill="#9A9A9A"/gi, `fill="${fillOverride || "#292D32"}"`);
svg = svg.replace(/stroke="#9A9A9A"/gi, `stroke="${fillOverride || "#292D32"}"`);
return svg;
}
function copyIcon(srcName, destPath, fillOverride) {
const srcPath = path.join(boldDir, srcName);
if (!fs.existsSync(srcPath)) {
console.warn(`SKIP missing: ${srcName} -> ${destPath}`);
return false;
}
const content = normalizeSvg(fs.readFileSync(srcPath, "utf8"), fillOverride);
fs.mkdirSync(path.dirname(destPath), { recursive: true });
fs.writeFileSync(destPath, content, "utf8");
return true;
}
let count = 0;
for (const [legacy, vuesax] of Object.entries(LEGACY_MAP)) {
const dest = path.join(iconsDir, legacy);
if (copyIcon(vuesax, dest)) count++;
}
// red heart variant
copyIcon("heart.svg", path.join(iconsDir, "red-heart.svg"), "#EF4444");
// auth password eye png replacements -> svg
copyIcon("eye.svg", path.join(iconsDir, "eye-open.svg"));
copyIcon("eye-slash.svg", path.join(iconsDir, "eye-slash.svg"));
for (const [rel, vuesax] of Object.entries(CHAT_MAP)) {
const dest = path.join(iconsDir, "chat", rel);
if (copyIcon(vuesax, dest)) count++;
}
console.log(`Synced ${count} icon files to legacy paths.`);