PRM-52 restore six home modules

This commit is contained in:
Sai-karthik
2026-06-08 19:35:20 +00:00
parent 9fd478c095
commit 6f03a133d5
3 changed files with 25 additions and 20 deletions

View File

@@ -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(),

View File

@@ -44,11 +44,11 @@ export const MODULE_META: Record<HomeModuleId, Omit<HomeModule, "count" | "notif
missions: { id: "missions", label: "Missions", href: "/missions", accent: "orange" },
social: { id: "social", label: "Social Branding", href: "/social", accent: "blue" },
pathways: { id: "pathways", label: "Pathways", href: "/pathways", accent: "teal" },
productivity: { id: "productivity", label: "Interview · Roleplay · Resume", href: "/agents", accent: "orange" },
productivity: { id: "productivity", label: "Productivity", href: "/agents", accent: "orange" },
rewards: { id: "rewards", label: "Rewards", href: "/rewards", accent: "amber" },
};
export const MODULE_IDS: HomeModuleId[] = ["suggestions", "missions", "productivity"];
export const MODULE_IDS: HomeModuleId[] = ["suggestions", "missions", "pathways", "productivity", "social", "rewards"];
export const ALLOWED_NOTIFICATION_HREFS = new Set([
"/suggestions",

View File

@@ -13,6 +13,7 @@ async function getUserServiceProfile(req: Request): Promise<{ userProfile?: Reco
const headers = new Headers(req.headers);
headers.delete("host");
headers.delete("cookie");
try {
const res = await fetch(target, { method: "GET", headers });
if (!res.ok) return {};
const userProfile = await res.json().catch(() => null) as Record<string, unknown> | null;
@@ -21,6 +22,9 @@ async function getUserServiceProfile(req: Request): Promise<{ userProfile?: Reco
userProfile: userProfile ?? undefined,
preferences: preferences && typeof preferences === "object" && !Array.isArray(preferences) ? preferences as Record<string, unknown> : {},
};
} catch {
return {};
}
}
export function homeRoutes() {