implement trollboard UI (#1301)

* implement trollboard UI

* remove unneeded code

* add link to user

* user link in leaderboard
This commit is contained in:
notmd
2023-02-08 13:49:00 +09:00
committed by GitHub
parent 59dbfea48f
commit a46e4a2bb1
13 changed files with 389 additions and 85 deletions
+7
View File
@@ -1,6 +1,7 @@
import type { EmojiOp, Message } from "src/types/Conversation";
import { LeaderboardReply, LeaderboardTimeFrame } from "src/types/Leaderboard";
import type { AvailableTasks } from "src/types/Task";
import { FetchTrollBoardResponse, TrollboardTimeFrame } from "src/types/Trollboard";
import type { BackendUser, BackendUserCore, FetchUsersParams, FetchUsersResponse } from "src/types/Users";
export class OasstError {
@@ -350,4 +351,10 @@ export class OasstApiClient {
fetch_frontend_user(user: BackendUserCore) {
return this.get<BackendUser>(`/api/v1/frontend_users/${user.auth_method}/${user.id}`);
}
fetch_trollboard(time_frame: TrollboardTimeFrame, { limit }: { limit?: number }) {
return this.get<FetchTrollBoardResponse>(`/api/v1/trollboards/${time_frame}`, {
max_count: limit,
});
}
}