fix: mergeServices field name mismatch — demo/repo links not showing

Public API returns {id, demo, repo} but merge was reading
{serviceId, demoUrl, gitRepo} — so dashboard links never applied.
Homepage service cards will now show Demo/Repo from Control Center.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
khondokartowsif171
2026-05-26 05:38:07 +06:00
parent 090f68867e
commit 7a1a7a7c31
+12 -19
View File
@@ -313,27 +313,20 @@ const ProjectVisual = ({ id, tint, hover }) => {
return null; return null;
}; };
// Merge Dashboard API data (demo/git links, active state) into local static data // Merge Dashboard API data (demo/repo links) into local static data
// Public API returns: { id, name, demo, repo, position }
function mergeServices(local, apiData) { function mergeServices(local, apiData) {
const byId = {}; const byId = {};
apiData.forEach(s => { byId[s.serviceId] = s; }); apiData.forEach(s => { byId[s.id] = s; });
return local return local.map(s => {
.filter(s => !byId[s.id] || byId[s.id].isActive !== false) const api = byId[s.id];
.map(s => { if (!api) return s;
const api = byId[s.id]; return {
if (!api) return s; ...s,
return { demo: api.demo || s.demo || null,
...s, gitRepo: api.repo || null,
demo: api.demoUrl || s.demo || null, };
gitRepo: api.gitRepo || null, });
name: api.name || s.name,
nameBn: api.nameBn || s.nameBn,
impact: {
primary: api.impactPrimary || s.impact.primary,
secondary: api.impactSecondary || s.impact.secondary,
},
};
});
} }
const Projects = () => { const Projects = () => {