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" ;
33import {
44 useContestToProblems ,
55 useUserSubmission ,
6- useContestMap ,
76} from "../../../api/APIClient" ;
87import Problem from "../../../interfaces/Problem" ;
98import Submission from "../../../interfaces/Submission" ;
@@ -13,7 +12,6 @@ import {
1312 isAccepted ,
1413 isValidResult ,
1514} from "../../../utils" ;
16- import { isRatedContest } from "../../../utils/ContestClassifier" ;
1715import { SmallPieChart } from "./SmallPieChart" ;
1816
1917enum SubmissionStatus {
@@ -145,26 +143,18 @@ export const PieChartBlock = (props: Props) => {
145143 ) ;
146144 const contestToProblems =
147145 useContestToProblems ( ) ?? new Map < ContestId , Problem [ ] > ( ) ;
148- const [ onlyRated , setOnlyRated ] = useState ( true ) ;
149- const contestMap = useContestMap ( ) ;
150146
151147 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+ ) ,
158151 submissionsMap ,
159152 props . userId
160153 ) ;
161154 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+ ) ,
168158 submissionsMap ,
169159 props . userId
170160 ) ;
@@ -177,50 +167,23 @@ export const PieChartBlock = (props: Props) => {
177167 ) ;
178168 return (
179169 < >
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" />
198173 </ >
199174 ) ;
200175} ;
201176
202177interface PieChartsProps {
203178 problems : { total : number ; solved : number ; rejected : number } [ ] ;
204179 title : string ;
205- setOnlyRated : ( onlyRated : boolean ) => void ;
206- onlyRated : boolean ;
207180}
208181
209- const PieCharts : React . FC < PieChartsProps > = ( {
210- problems,
211- title,
212- setOnlyRated,
213- onlyRated,
214- } ) => (
182+ const PieCharts : React . FC < PieChartsProps > = ( { problems, title } ) => (
215183 < div >
216184 < Row className = "my-2 border-bottom" >
217185 < h1 > { title } </ h1 >
218186 </ Row >
219- < ButtonGroup className = "mb-2" >
220- < Button onClick = { ( ) : void => setOnlyRated ( ! onlyRated ) } >
221- { onlyRated ? "Only Rated Contests" : "All Contests" }
222- </ Button >
223- </ ButtonGroup >
224187 < Row className = "my-3" >
225188 { problems . map ( ( { solved, rejected, total } , i ) => {
226189 const key = i <= 6 ? "ABCDEFG" . charAt ( i ) : "H/Ex" ;
0 commit comments