* feat: add referral user count * feat: add referrals leaderboard * fix: update UI * Update referral design * Update invite friends UI * Add leaderboard page * Update leaderboard page --------- Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>
39 lines
896 B
TypeScript
39 lines
896 B
TypeScript
import { type APIContext } from 'astro';
|
|
import { api } from './api.ts';
|
|
|
|
export type LeaderboardUserDetails = {
|
|
id: string;
|
|
name: string;
|
|
avatar?: string;
|
|
count: number;
|
|
};
|
|
|
|
export type ListLeaderboardStatsResponse = {
|
|
streaks: {
|
|
active: LeaderboardUserDetails[];
|
|
lifetime: LeaderboardUserDetails[];
|
|
};
|
|
projectSubmissions: {
|
|
currentMonth: LeaderboardUserDetails[];
|
|
lifetime: LeaderboardUserDetails[];
|
|
};
|
|
githubContributors: {
|
|
currentMonth: LeaderboardUserDetails[];
|
|
};
|
|
referrals: {
|
|
currentMonth: LeaderboardUserDetails[];
|
|
lifetime: LeaderboardUserDetails[];
|
|
};
|
|
};
|
|
|
|
export function leaderboardApi(context: APIContext) {
|
|
return {
|
|
listLeaderboardStats: async function () {
|
|
return api(context).get<ListLeaderboardStatsResponse>(
|
|
`${import.meta.env.PUBLIC_API_URL}/v1-list-leaderboard-stats`,
|
|
{},
|
|
);
|
|
},
|
|
};
|
|
}
|