1
- import { Col , Row , Button , ButtonGroup } from "reactstrap" ;
2
- import React , { useState } from "react" ;
1
+ import { Col , Row } from "reactstrap" ;
2
+ import React from "react" ;
3
3
import {
4
4
useContestToProblems ,
5
5
useUserSubmission ,
6
- useContestMap ,
7
6
} from "../../../api/APIClient" ;
8
7
import Problem from "../../../interfaces/Problem" ;
9
8
import Submission from "../../../interfaces/Submission" ;
@@ -13,7 +12,6 @@ import {
13
12
isAccepted ,
14
13
isValidResult ,
15
14
} from "../../../utils" ;
16
- import { isRatedContest } from "../../../utils/ContestClassifier" ;
17
15
import { SmallPieChart } from "./SmallPieChart" ;
18
16
19
17
enum SubmissionStatus {
@@ -145,26 +143,18 @@ export const PieChartBlock = (props: Props) => {
145
143
) ;
146
144
const contestToProblems =
147
145
useContestToProblems ( ) ?? new Map < ContestId , Problem [ ] > ( ) ;
148
- const [ onlyRated , setOnlyRated ] = useState ( true ) ;
149
- const contestMap = useContestMap ( ) ;
150
146
151
147
const abcSolved = solvedCountForPieChart (
152
- Array . from ( contestToProblems )
153
- . filter ( ( [ contestId ] ) => contestId . startsWith ( "abc" ) )
154
- . filter (
155
- ( [ contestId ] ) =>
156
- isRatedContest ( contestMap . get ( contestId ) , 2 ) || ! onlyRated
157
- ) ,
148
+ Array . from ( contestToProblems ) . filter ( ( [ contestId ] ) =>
149
+ contestId . startsWith ( "abc" )
150
+ ) ,
158
151
submissionsMap ,
159
152
props . userId
160
153
) ;
161
154
const arcSolved = solvedCountForPieChart (
162
- Array . from ( contestToProblems )
163
- . filter ( ( [ contestId ] ) => contestId . startsWith ( "arc" ) )
164
- . filter (
165
- ( [ contestId ] ) =>
166
- isRatedContest ( contestMap . get ( contestId ) , 2 ) || ! onlyRated
167
- ) ,
155
+ Array . from ( contestToProblems ) . filter ( ( [ contestId ] ) =>
156
+ contestId . startsWith ( "arc" )
157
+ ) ,
168
158
submissionsMap ,
169
159
props . userId
170
160
) ;
@@ -177,50 +167,23 @@ export const PieChartBlock = (props: Props) => {
177
167
) ;
178
168
return (
179
169
< >
180
- < PieCharts
181
- problems = { abcSolved }
182
- title = "AtCoder Beginner Contest"
183
- setOnlyRated = { setOnlyRated }
184
- onlyRated = { onlyRated }
185
- />
186
- < PieCharts
187
- problems = { arcSolved }
188
- title = "AtCoder Regular Contest"
189
- setOnlyRated = { setOnlyRated }
190
- onlyRated = { onlyRated }
191
- />
192
- < PieCharts
193
- problems = { agcSolved }
194
- title = "AtCoder Grand Contest"
195
- setOnlyRated = { setOnlyRated }
196
- onlyRated = { onlyRated }
197
- />
170
+ < PieCharts problems = { abcSolved } title = "AtCoder Beginner Contest" />
171
+ < PieCharts problems = { arcSolved } title = "AtCoder Regular Contest" />
172
+ < PieCharts problems = { agcSolved } title = "AtCoder Grand Contest" />
198
173
</ >
199
174
) ;
200
175
} ;
201
176
202
177
interface PieChartsProps {
203
178
problems : { total : number ; solved : number ; rejected : number } [ ] ;
204
179
title : string ;
205
- setOnlyRated : ( onlyRated : boolean ) => void ;
206
- onlyRated : boolean ;
207
180
}
208
181
209
- const PieCharts : React . FC < PieChartsProps > = ( {
210
- problems,
211
- title,
212
- setOnlyRated,
213
- onlyRated,
214
- } ) => (
182
+ const PieCharts : React . FC < PieChartsProps > = ( { problems, title } ) => (
215
183
< div >
216
184
< Row className = "my-2 border-bottom" >
217
185
< h1 > { title } </ h1 >
218
186
</ Row >
219
- < ButtonGroup className = "mb-2" >
220
- < Button onClick = { ( ) : void => setOnlyRated ( ! onlyRated ) } >
221
- { onlyRated ? "Only Rated Contests" : "All Contests" }
222
- </ Button >
223
- </ ButtonGroup >
224
187
< Row className = "my-3" >
225
188
{ problems . map ( ( { solved, rejected, total } , i ) => {
226
189
const key = i <= 6 ? "ABCDEFG" . charAt ( i ) : "H/Ex" ;
0 commit comments