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:
+6
-13
@@ -313,25 +313,18 @@ 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)
|
|
||||||
.map(s => {
|
|
||||||
const api = byId[s.id];
|
const api = byId[s.id];
|
||||||
if (!api) return s;
|
if (!api) return s;
|
||||||
return {
|
return {
|
||||||
...s,
|
...s,
|
||||||
demo: api.demoUrl || s.demo || null,
|
demo: api.demo || s.demo || null,
|
||||||
gitRepo: api.gitRepo || null,
|
gitRepo: api.repo || null,
|
||||||
name: api.name || s.name,
|
|
||||||
nameBn: api.nameBn || s.nameBn,
|
|
||||||
impact: {
|
|
||||||
primary: api.impactPrimary || s.impact.primary,
|
|
||||||
secondary: api.impactSecondary || s.impact.secondary,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user