feat(dashboard): expose trust reputation + reactions leaderboard

- GET /api/dashboard/reactions: top reacted messages (net add-remove),
  joined with message content, channel name, top 3 emoji breakdown
- Users tab: colored trust tier badge (Trusted/Netral/At Risk/Kritis)
  in list rows + detail panel (was plain number badge)
- Dashboard: new Reactions sub-tab with leaderboard
  (rank, emoji cluster, message, author, channel, count)
This commit is contained in:
asepharyana
2026-08-05 10:20:12 +07:00
parent 2f51f94610
commit a309570d29
10 changed files with 235 additions and 2 deletions
@@ -5,6 +5,7 @@ import type {
DashboardUserDetail,
PaginatedChannels,
PaginatedUsers,
TopReactedMessage,
} from "@/lib/types";
import { api } from "./client";
@@ -40,4 +41,7 @@ export const dashboardApi = {
getChannelDetail: (channelId: string) =>
api.get<DashboardChannelDetail>(`/api/dashboard/channels/${channelId}`),
getTopReactions: (limit = 20) =>
api.get<TopReactedMessage[]>(`/api/dashboard/reactions?limit=${limit}`),
};
@@ -100,3 +100,19 @@ export interface PaginatedChannels {
data: DashboardChannel[];
nextCursor: string | null;
}
export interface TopReactedEmoji {
emoji: string;
count: number;
}
export interface TopReactedMessage {
message_id: string;
content: string;
username: string | null;
channel_id: string;
channel_name: string | null;
created_at: number | null;
reaction_count: number;
top_emojis: TopReactedEmoji[];
}