generated from nhcarrigan/template
feat: implement comprehensive leaderboard feature
Implements issue #55 with multiple leaderboard categories: - Top Suggestions (by count and acceptance rate) - Top Likes (by total likes given) - Top Comments (by total comments posted) - Overall Leaders (weighted by achievement points and engagement diversity) Features: - Tabbed UI with reactive state management - Medal indicators for top 3 positions - User avatars and badges display - Current user highlighting - Privacy controls via profilePublic setting - Configurable result limits (max 100) - Detailed statistics per category Backend: - Created LeaderboardService with aggregation logic - Filters for public profiles and non-banned users - Efficient sorting algorithms for each category - Parallel data fetching for all leaderboards Frontend: - Standalone Angular component with signals - Responsive card-based layout - Integration with existing user profile system - Navigation link in header dropdown Technical notes: - Uses Fastify AutoLoad with FastifyPluginAsync pattern - Shared types across monorepo for type safety - Leverages existing achievement system data
This commit is contained in:
@@ -12,6 +12,7 @@ export * from "./lib/book.types";
|
||||
export type * from "./lib/comment.types";
|
||||
export type * from "./lib/common.types";
|
||||
export * from "./lib/game.types";
|
||||
export type * from "./lib/leaderboard.types";
|
||||
export type * from "./lib/like.types";
|
||||
export * from "./lib/manga.types";
|
||||
export * from "./lib/music.types";
|
||||
|
||||
@@ -34,9 +34,9 @@ interface User {
|
||||
isAdmin: boolean;
|
||||
isBanned: boolean;
|
||||
inDiscord: boolean;
|
||||
isVip: boolean;
|
||||
isMod: boolean;
|
||||
isStaff: boolean;
|
||||
isVip: boolean;
|
||||
isMod: boolean;
|
||||
isStaff: boolean;
|
||||
}
|
||||
|
||||
interface JwtPayload {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @copyright NHCarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
interface LeaderboardUser {
|
||||
id: string;
|
||||
username: string;
|
||||
slug: string | null;
|
||||
avatar: string | null;
|
||||
primaryBadge: string | null;
|
||||
isVip: boolean;
|
||||
isMod: boolean;
|
||||
isStaff: boolean;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
interface SuggestionsLeaderboard extends LeaderboardUser {
|
||||
totalSuggestions: number;
|
||||
acceptedSuggestions: number;
|
||||
acceptanceRate: number;
|
||||
}
|
||||
|
||||
interface LikesLeaderboard extends LeaderboardUser {
|
||||
totalLikes: number;
|
||||
}
|
||||
|
||||
interface CommentsLeaderboard extends LeaderboardUser {
|
||||
totalComments: number;
|
||||
}
|
||||
|
||||
interface OverallLeaderboard extends LeaderboardUser {
|
||||
totalSuggestions: number;
|
||||
totalLikes: number;
|
||||
totalComments: number;
|
||||
achievementCount: number;
|
||||
achievementPoints: number;
|
||||
currentStreak: number;
|
||||
diversityScore: number;
|
||||
}
|
||||
|
||||
interface LeaderboardResponse {
|
||||
topSuggestions: SuggestionsLeaderboard[];
|
||||
topLikes: LikesLeaderboard[];
|
||||
topComments: CommentsLeaderboard[];
|
||||
topOverall: OverallLeaderboard[];
|
||||
}
|
||||
|
||||
export {
|
||||
type LeaderboardUser,
|
||||
type SuggestionsLeaderboard,
|
||||
type LikesLeaderboard,
|
||||
type CommentsLeaderboard,
|
||||
type OverallLeaderboard,
|
||||
type LeaderboardResponse,
|
||||
};
|
||||
Reference in New Issue
Block a user