feat: Add new SVG icons and update links data to reference them via file paths.
This commit is contained in:
@@ -10,7 +10,32 @@ async function loadLinks() {
|
||||
|
||||
const groups = await response.json();
|
||||
|
||||
container.innerHTML = groups.map(group => `
|
||||
// Helper function to fetch SVG content
|
||||
const fetchSvg = async (path) => {
|
||||
if (!path) return '';
|
||||
try {
|
||||
const res = await fetch(path);
|
||||
if (!res.ok) return '';
|
||||
return await res.text();
|
||||
} catch (e) {
|
||||
console.error(`Failed to load SVG: ${path}`, e);
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
// Process groups and fetch SVGs in parallel
|
||||
const groupsWithSvgs = await Promise.all(groups.map(async (group) => {
|
||||
const groupIconSvg = await fetchSvg(group.iconPath);
|
||||
|
||||
const linksWithSvgs = await Promise.all(group.links.map(async (link) => {
|
||||
const linkIconSvg = link.iconPath ? await fetchSvg(link.iconPath) : '';
|
||||
return { ...link, iconSvg: linkIconSvg };
|
||||
}));
|
||||
|
||||
return { ...group, iconSvg: groupIconSvg, links: linksWithSvgs };
|
||||
}));
|
||||
|
||||
container.innerHTML = groupsWithSvgs.map(group => `
|
||||
<!-- ${group.title} Card -->
|
||||
<div class="card-hover bg-white rounded-2xl shadow-lg p-6 border border-gray-100">
|
||||
<div class="flex items-center space-x-3 mb-6">
|
||||
|
||||
Reference in New Issue
Block a user