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
+6 -13
View File
@@ -313,25 +313,18 @@ const ProjectVisual = ({ id, tint, hover }) => {
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) {
const byId = {};
apiData.forEach(s => { byId[s.serviceId] = s; });
return local
.filter(s => !byId[s.id] || byId[s.id].isActive !== false)
.map(s => {
apiData.forEach(s => { byId[s.id] = s; });
return local.map(s => {
const api = byId[s.id];
if (!api) return s;
return {
...s,
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,
},
demo: api.demo || s.demo || null,
gitRepo: api.repo || null,
};
});
}