From 6f03a133d5f9404b5361fd294a8818cb07bba6fe Mon Sep 17 00:00:00 2001 From: Sai-karthik Date: Mon, 8 Jun 2026 19:35:20 +0000 Subject: [PATCH] PRM-52 restore six home modules --- src/home/home-feed.ts | 21 +++++++++++---------- src/home/types.ts | 4 ++-- src/routes/home.ts | 20 ++++++++++++-------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/home/home-feed.ts b/src/home/home-feed.ts index 18388ec..a0ac396 100644 --- a/src/home/home-feed.ts +++ b/src/home/home-feed.ts @@ -180,7 +180,7 @@ function buildDayOneSeeds(): SeedNotification[] { } function buildDynamicSeeds(ctx: HomeContext): SeedNotification[] { - const seeds = buildDayOneSeeds().filter((seed) => seed.moduleId === "pathways" || seed.moduleId === "rewards"); + const seeds = buildDayOneSeeds().filter((seed) => seed.moduleId === "pathways" || seed.moduleId === "social" || seed.moduleId === "rewards"); const profile = profileFromPreferences(ctx.preferences); const qscore = ctx.qscore?.score ?? Math.round(ctx.qscoreSignals.reduce((sum, s) => sum + s.score, 0) / Math.max(ctx.qscoreSignals.length, 1)); const ats = latestScore(ctx.qscoreSignals, "resume.ats_compatibility"); @@ -289,13 +289,13 @@ function buildDynamicSeeds(ctx: HomeContext): SeedNotification[] { pushSeed(seeds, { moduleId: "social", - title: "Turn proof into LinkedIn updates", - subtitle: ctx.artifacts.length ? `${ctx.artifacts.length} artifact${ctx.artifacts.length === 1 ? "" : "s"} can feed headline, featured, or post ideas.` : `Connect LinkedIn and use ${profile.targetRole} proof to improve your profile.`, - tag: ctx.artifacts.length ? "Proof" : "Setup", - urgency: ctx.artifacts.length ? "today" : "soon", + title: "Social branding is coming soon", + subtitle: "Mission proof and resume artifacts will become profile and LinkedIn nudges here.", + tag: "Soon", + urgency: "calm", href: SERVICE_HREFS.social, source: "social", - priority: 70, + priority: 38, }); if (resumeAnalysis || resumeSession || ats !== undefined) { @@ -509,9 +509,9 @@ function moduleCount(moduleId: HomeModuleId, notifications: HomeNotification[], const active = ctx.sessions.filter((s) => s.status === "active" || s.status === "configured" || s.status === "processing").length; return active ? `${active} active` : String(notifications.length); } - if (moduleId === "pathways") return mode === "day1" ? "Soon" : "Locked"; - if (moduleId === "rewards") return mode === "day1" ? "0" : "Demo"; - if (moduleId === "social") return mode === "day1" ? "Setup" : `${notifications.length} updates`; + if (moduleId === "pathways") return "Soon"; + if (moduleId === "rewards") return "Soon"; + if (moduleId === "social") return "Soon"; return String(notifications.length); } @@ -566,8 +566,9 @@ export async function getHomeFeed(userId: string, opts: { refresh?: boolean; use const newest = persisted[0]?.createdAt?.getTime() ?? 0; const hasDemo = persisted.some((row) => row.generatedBy === "demo"); const fresh = newest > Date.now() - FRESH_MS; + const hasModuleCoverage = MODULE_IDS.every((moduleId) => persisted.some((row) => row.moduleId === moduleId)); - if (persisted.length && (hasDemo || (!opts.refresh && fresh))) { + if (persisted.length && hasModuleCoverage && (hasDemo || (!opts.refresh && fresh))) { const mode = hasDemo ? "demo" : hasAnyRealActivity(ctx) ? "dynamic" : "day1"; return { generatedAt: new Date().toISOString(), diff --git a/src/home/types.ts b/src/home/types.ts index f8cae38..b0caad8 100644 --- a/src/home/types.ts +++ b/src/home/types.ts @@ -44,11 +44,11 @@ export const MODULE_META: Record null) as Record | null; - const preferences = userProfile?.preferences; - return { - userProfile: userProfile ?? undefined, - preferences: preferences && typeof preferences === "object" && !Array.isArray(preferences) ? preferences as Record : {}, - }; + try { + const res = await fetch(target, { method: "GET", headers }); + if (!res.ok) return {}; + const userProfile = await res.json().catch(() => null) as Record | null; + const preferences = userProfile?.preferences; + return { + userProfile: userProfile ?? undefined, + preferences: preferences && typeof preferences === "object" && !Array.isArray(preferences) ? preferences as Record : {}, + }; + } catch { + return {}; + } } export function homeRoutes() {