Skip to content

Commit

Permalink
add a admin panel in the stats results
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Sep 13, 2024
1 parent b9efb11 commit e77843c
Show file tree
Hide file tree
Showing 7 changed files with 427 additions and 11 deletions.
43 changes: 42 additions & 1 deletion src/api/GametoolsApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ServerPlayersReturn,
ServerSearch,
StatsGraph,
SusStats,
UserGames,
} from "./ReturnTypes";
import { battlebitApi } from "./battlebitApi";
Expand Down Expand Up @@ -110,6 +111,23 @@ interface ServerGraphInfo {
platform?: string;
}

interface managerPlayerInfo {
playerId: number;
}

interface managerPlayer {
id: number;
avatar: string;
name: string;
vban: { [Key: string]: { bannedUntil: string; reason: string } };
ingame: string[];
otherNames: {
updateTimestamp: string;
usedNames: string[];
};
bfban: bfbanPlayers;
}

export interface bfbanPlayer {
apiUrl: string;
names: { [name: string]: bfbanPlayers };
Expand All @@ -123,7 +141,7 @@ export interface bfeacPlayer {
}

export interface bfbanPlayers {
personaId: string;
personaId?: string;
url: string;
status: string;
hacker: boolean;
Expand Down Expand Up @@ -206,6 +224,21 @@ export class ApiProvider extends JsonClient {
});
}

async sus({
game,
playerId,
platform = "pc",
}: {
game: string;
playerId: number;
platform: string;
}): Promise<SusStats | undefined> {
return await this.getJsonMethod(`/${game}/sus/`, {
platform: platform,
playerid: playerId.toString(),
});
}

async statsarray({
game,
getter,
Expand Down Expand Up @@ -528,6 +561,14 @@ export class ApiProvider extends JsonClient {
return await this.getJsonMethod(`/bfglobal/totalstatusarray/`, {});
}

async managerCheckPlayer({
playerId,
}: managerPlayerInfo): Promise<managerPlayer> {
return await this.getJsonMethod("/manager/checkban", {
playerid: playerId.toString(),
});
}

async bfbanCheckPlayers({
getter,
usernames,
Expand Down
8 changes: 8 additions & 0 deletions src/api/ReturnTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export type PlatoonStats = {
servers: ServerList[];
};

export type SusStats = {
weapons: MainStatsWeapon & SusWeapon[];
};

export type MainStats = {
apiUrl: string;
accuracy: number;
Expand Down Expand Up @@ -183,6 +187,10 @@ export type MainStatsVehicle = {
vehicleName: string;
};

export type SusWeapon = {
susReason: string;
};

export type MainStatsWeapon = {
accuracy: number;
headshots: number;
Expand Down
23 changes: 23 additions & 0 deletions src/assets/scss/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ body {
@extend %font-shared;
}

th {
color: var(--color-text);
font-weight: bold;
font-size: 12px;
@extend %font-shared;
}

td {
color: var(--color-alt-text);
font-weight: 500;
font-size: 13px;
@extend %font-shared;
}

span {
color: var(--color-text);
}
Expand Down Expand Up @@ -203,10 +217,19 @@ body {
transition: 0.4s;
}

.darkSlider {
@extend .slider;
background-color: var(--color-m96-base);
}

input:checked + .slider {
background-color: #2196f3;
}

input:checked + .darkSlider {
background-color: var(--color-m96-alt-base);
}

input:focus + .slider {
box-shadow: 0 0 1px #2196f3;
}
Expand Down
Loading

0 comments on commit e77843c

Please sign in to comment.