update ui and other frontend updates

This commit is contained in:
JCEEE
2026-07-29 09:41:52 +01:00
parent 04b83925e0
commit 57ef30d3a7
79 changed files with 7323 additions and 429 deletions
+23
View File
@@ -0,0 +1,23 @@
import { pbAdmin } from '$lib/server/pb-admin';
export async function load() {
const fams = await pbAdmin.getList('fams');
const famsWithStats = await Promise.all(fams.map(async (fam: any) => {
const [members, rewards] = await Promise.all([
pbAdmin.getList('members', `famId = '${fam.id}'`),
pbAdmin.getList('rewards', `famId = '${fam.id}'`),
]);
return {
id: fam.id, name: fam.name, slug: fam.slug, inviteCode: fam.inviteCode,
memberCount: members.length,
claimedRewards: (rewards as any[]).filter((r: any) => r.claimed).length,
totalRewards: rewards.length,
};
}));
const totalFams = fams.length;
const totalMembers = famsWithStats.reduce((s: number, f: any) => s + f.memberCount, 0);
const totalRewards = famsWithStats.reduce((s: number, f: any) => s + f.totalRewards, 0);
return { fams: famsWithStats, totalFams, totalMembers, totalRewards };
}