Skip to content

Commit 411ba50

Browse files
committed
feat: enhance profile sharing and versioning features
- Introduced ProfileShareSection and ProfileVersionSelector components for improved user experience in sharing profiles. - Updated user profile schema to include narrative and LLM model information. - Enhanced admin job management to track profile updates and personas. - Added share functionality for profiles, including metrics and insights display. - Documented LLM narrative workflow and share experience improvements for better clarity and usability.
1 parent 7ec206f commit 411ba50

14 files changed

Lines changed: 2405 additions & 673 deletions

File tree

apps/web/src/app/admin/actions.ts

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ export async function getAllJobs(
521521
commit_count: number | null;
522522
created_at: string;
523523
completed_at: string | null;
524+
profile_updated: boolean;
525+
profile_persona: string | null;
524526
}>;
525527
total: number;
526528
}> {
@@ -576,27 +578,49 @@ export async function getAllJobs(
576578
// Get user and repo names
577579
const userIds = [...new Set((jobs ?? []).map((j) => j.user_id))];
578580
const repoIds = [...new Set((jobs ?? []).map((j) => j.repo_id).filter(Boolean))];
581+
const jobIds = (jobs ?? []).map((j) => j.id);
579582

580-
const [{ data: users }, { data: repos }] = await Promise.all([
583+
const [{ data: users }, { data: repos }, { data: profileHistory }] = await Promise.all([
581584
adminSupabase.from("users").select("id, github_username").in("id", userIds),
582585
adminSupabase.from("repos").select("id, full_name").in("id", repoIds),
586+
// Get profile history entries triggered by these jobs
587+
adminSupabase
588+
.from("user_profile_history")
589+
.select("trigger_job_id, profile_snapshot")
590+
.in("trigger_job_id", jobIds),
583591
]);
584592

585593
const usernameById = new Map((users ?? []).map((u) => [u.id, u.github_username]));
586594
const repoNameById = new Map((repos ?? []).map((r) => [r.id, r.full_name]));
587595

596+
// Map job ID to profile update info
597+
const profileUpdateByJobId = new Map<string, { persona: string | null }>();
598+
for (const ph of profileHistory ?? []) {
599+
if (ph.trigger_job_id) {
600+
const snapshot = ph.profile_snapshot as { persona?: { name?: string } } | null;
601+
profileUpdateByJobId.set(ph.trigger_job_id, {
602+
persona: snapshot?.persona?.name ?? null,
603+
});
604+
}
605+
}
606+
588607
return {
589608
success: true,
590-
jobs: (jobs ?? []).map((j) => ({
591-
id: j.id,
592-
user_id: j.user_id,
593-
username: usernameById.get(j.user_id) ?? null,
594-
repo_name: repoNameById.get(j.repo_id ?? "") ?? null,
595-
status: j.status,
596-
commit_count: j.commit_count,
597-
created_at: j.created_at,
598-
completed_at: j.completed_at,
599-
})),
609+
jobs: (jobs ?? []).map((j) => {
610+
const profileUpdate = profileUpdateByJobId.get(j.id);
611+
return {
612+
id: j.id,
613+
user_id: j.user_id,
614+
username: usernameById.get(j.user_id) ?? null,
615+
repo_name: repoNameById.get(j.repo_id ?? "") ?? null,
616+
status: j.status,
617+
commit_count: j.commit_count,
618+
created_at: j.created_at,
619+
completed_at: j.completed_at,
620+
profile_updated: Boolean(profileUpdate),
621+
profile_persona: profileUpdate?.persona ?? null,
622+
};
623+
}),
600624
total: totalCount ?? 0,
601625
};
602626
}

apps/web/src/app/admin/jobs/page.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default async function AdminJobsPage({
8888
<th className="px-4 py-3">Repo</th>
8989
<th className="px-4 py-3">Status</th>
9090
<th className="px-4 py-3">Commits</th>
91+
<th className="px-4 py-3">Profile</th>
9192
<th className="px-4 py-3">Created</th>
9293
<th className="px-4 py-3">Completed</th>
9394
</tr>
@@ -112,6 +113,20 @@ export default async function AdminJobsPage({
112113
<td className="px-4 py-3 text-sm text-zinc-600">
113114
{job.commit_count?.toLocaleString() ?? "-"}
114115
</td>
116+
<td className="px-4 py-3">
117+
{job.profile_updated ? (
118+
<span className="inline-flex items-center gap-1 rounded-full bg-fuchsia-100 px-2 py-1 text-xs font-medium text-fuchsia-700">
119+
<span className="text-fuchsia-500"></span>
120+
{job.profile_persona ? (
121+
<span title={job.profile_persona}>Updated</span>
122+
) : (
123+
"Updated"
124+
)}
125+
</span>
126+
) : (
127+
<span className="text-xs text-zinc-400"></span>
128+
)}
129+
</td>
115130
<td className="px-4 py-3 text-sm text-zinc-600">
116131
{new Date(job.created_at).toLocaleString()}
117132
</td>

0 commit comments

Comments
 (0)