Skip to content

Commit f7367c7

Browse files
elegantShock2258bhoopesh369shubham-1806
authored
feat: stats (#4)
Co-authored-by: Bhoopesh <bhoopesh459@gmail.com> Co-authored-by: shubham-1806 <shub.agarwal2003@gmail.com>
1 parent 568dcf0 commit f7367c7

File tree

20 files changed

+1100
-11
lines changed

20 files changed

+1100
-11
lines changed

docs/spec/CodeCharacter-API.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,8 +1570,44 @@ paths:
15701570
description: Size of the page
15711571
parameters: []
15721572

1573+
'/stats/':
1574+
get:
1575+
summary: Get all General Stats for current user and top user
1576+
tags:
1577+
- stats
1578+
responses:
1579+
'200':
1580+
description: OK
1581+
content:
1582+
application/json:
1583+
schema:
1584+
type: array
1585+
items:
1586+
$ref: '#/components/schemas/UserMatchStats'
1587+
operationId: getStats
1588+
description: Gets all statistics for the current user
1589+
parameters: []
1590+
15731591
components:
15741592
schemas:
1593+
UserMatchStats:
1594+
title: UserMatchStats
1595+
type: object
1596+
description: User Match Stats model
1597+
properties:
1598+
avgAtk:
1599+
type: number
1600+
default: 0
1601+
dc_wins:
1602+
type: number
1603+
default: 0
1604+
coins:
1605+
type: number
1606+
default: 0
1607+
required:
1608+
- avgAtk
1609+
- dc_wins
1610+
- coins
15751611
PasswordLoginRequest:
15761612
title: PasswordLoginRequest
15771613
type: object
@@ -2554,3 +2590,4 @@ tags:
25542590
- name: match
25552591
- name: notification
25562592
- name: user
2593+
- name: stats

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"react-router-dom": "^6.6.1",
6363
"react-split-pane": "^0.1.92",
6464
"react-vertical-timeline-component": "^3.6.0",
65+
"recharts": "^2.10.3",
6566
"redux": "^4.2.0",
6667
"redux-persist": "^6.0.0",
6768
"vscode-ws-jsonrpc": "^2.0.2",

packages/client/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ src/apis/MapApi.ts
99
src/apis/MatchApi.ts
1010
src/apis/NotificationApi.ts
1111
src/apis/PvpGameApi.ts
12+
src/apis/StatsApi.ts
1213
src/apis/UserApi.ts
1314
src/apis/index.ts
1415
src/index.ts

packages/client/src/apis/StatsApi.ts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* CodeCharacter API
5+
* Specification of the CodeCharacter API
6+
*
7+
* The version of the OpenAPI document: 2023.0.1
8+
* Contact: delta@nitt.edu
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
import * as runtime from '../runtime';
16+
import type { UserMatchStats } from '../models';
17+
18+
/**
19+
* StatsApi - interface
20+
*
21+
* @export
22+
* @interface StatsApiInterface
23+
*/
24+
export interface StatsApiInterface {
25+
/**
26+
* Gets all statistics for the current user
27+
* @summary Get all General Stats for current user and top user
28+
* @param {*} [options] Override http request option.
29+
* @throws {RequiredError}
30+
* @memberof StatsApiInterface
31+
*/
32+
getStatsRaw(
33+
initOverrides?: RequestInit | runtime.InitOverrideFunction,
34+
): Promise<runtime.ApiResponse<Array<UserMatchStats>>>;
35+
36+
/**
37+
* Gets all statistics for the current user
38+
* Get all General Stats for current user and top user
39+
*/
40+
getStats(
41+
initOverrides?: RequestInit | runtime.InitOverrideFunction,
42+
): Promise<Array<UserMatchStats>>;
43+
}
44+
45+
/**
46+
*
47+
*/
48+
export class StatsApi extends runtime.BaseAPI implements StatsApiInterface {
49+
/**
50+
* Gets all statistics for the current user
51+
* Get all General Stats for current user and top user
52+
*/
53+
async getStatsRaw(
54+
initOverrides?: RequestInit | runtime.InitOverrideFunction,
55+
): Promise<runtime.ApiResponse<Array<UserMatchStats>>> {
56+
const queryParameters: any = {};
57+
58+
const headerParameters: runtime.HTTPHeaders = {};
59+
60+
if (this.configuration && this.configuration.accessToken) {
61+
const token = this.configuration.accessToken;
62+
const tokenString = await token('http-bearer', []);
63+
64+
if (tokenString) {
65+
headerParameters['Authorization'] = `Bearer ${tokenString}`;
66+
}
67+
}
68+
const response = await this.request(
69+
{
70+
path: `/stats/`,
71+
method: 'GET',
72+
headers: headerParameters,
73+
query: queryParameters,
74+
},
75+
initOverrides,
76+
);
77+
78+
return new runtime.JSONApiResponse(response);
79+
}
80+
81+
/**
82+
* Gets all statistics for the current user
83+
* Get all General Stats for current user and top user
84+
*/
85+
async getStats(
86+
initOverrides?: RequestInit | runtime.InitOverrideFunction,
87+
): Promise<Array<UserMatchStats>> {
88+
const response = await this.getStatsRaw(initOverrides);
89+
return await response.value();
90+
}
91+
}

packages/client/src/apis/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export * from './MapApi';
1010
export * from './MatchApi';
1111
export * from './NotificationApi';
1212
export * from './PvpGameApi';
13+
export * from './StatsApi';
1314
export * from './UserApi';

packages/client/src/models/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,31 @@ export interface UpdatePasswordRequest {
12381238
*/
12391239
passwordConfirmation: string;
12401240
}
1241+
/**
1242+
* User Match Stats model
1243+
* @export
1244+
* @interface UserMatchStats
1245+
*/
1246+
export interface UserMatchStats {
1247+
/**
1248+
*
1249+
* @type {number}
1250+
* @memberof UserMatchStats
1251+
*/
1252+
avgAtk: number;
1253+
/**
1254+
*
1255+
* @type {number}
1256+
* @memberof UserMatchStats
1257+
*/
1258+
dcWins: number;
1259+
/**
1260+
*
1261+
* @type {number}
1262+
* @memberof UserMatchStats
1263+
*/
1264+
coins: number;
1265+
}
12411266
/**
12421267
* User stats model
12431268
* @export

src/AllRoutes.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const IncompleteProfile = lazy(
3131
import('./components/Auth/Auth/Login/IncompleteProfile/incompeleteProfile'),
3232
);
3333
const Profile = lazy(() => import('./components/Profile/Profile'));
34-
34+
const Statistics = lazy(() => import('./pages/Statistics/Statistics'));
3535
export default function AllRoutes(): JSX.Element {
3636
const dispatch = useAppDispatch();
3737
const logIn = useAppSelector(isloggedIn);
@@ -46,6 +46,7 @@ export default function AllRoutes(): JSX.Element {
4646
<Routes>
4747
<Route path="/" element={<Home />} />
4848
<Route path="/dashboard" element={<Dashboard />} />
49+
<Route path="/statistics" element={<Statistics />} />
4950
<Route path="/mapdesigner" element={<MapDesignerPage />} />
5051
<Route path="/history" element={<CommitHistoryPage />} />
5152
<Route path="/leaderboard" element={<LeaderBoardPage />} />

src/assets/statistics.svg

Lines changed: 22 additions & 0 deletions
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.title {
2+
border: 1px solid #ffffff50 !important;
3+
border-radius: 10px;
4+
background: #ffffff05 !important;
5+
font-size: 1rem;
6+
box-shadow: none !important;
7+
font-family: monospace !important;
8+
align-self: end;
9+
}
10+
11+
.footer {
12+
background-color: #10101080 !important;
13+
backdrop-filter: blur(30px);
14+
color: white;
15+
font-size: 3rem;
16+
text-align: center;
17+
border: 1px solid #ffffff50 !important;
18+
font-family: monospace !important;
19+
}
20+
21+
.button:hover {
22+
background-color: transparent !important;
23+
color: #ffffffa0;
24+
}
25+
26+
.button {
27+
color: white;
28+
text-align: center;
29+
font-size: 1rem;
30+
}

0 commit comments

Comments
 (0)