Skip to content

Commit

Permalink
modify filter func
Browse files Browse the repository at this point in the history
  • Loading branch information
CoCo-Japan-pan committed Sep 3, 2024
1 parent 684c72e commit 0da6962
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions atcoder-problems-frontend/src/pages/ListPage/SmallTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useMergedProblemMap } from "../../api/APIClient";

interface Props {
submissions: Submission[];
setFilterFunc: (point: number) => void;
setFilterFunc: (from: number, to: number) => void;
}

export const getTotalCount = (
Expand Down Expand Up @@ -95,7 +95,7 @@ export const SmallTable: React.FC<Props> = ({ submissions, setFilterFunc }) => {
<th key={point}>
<a
href={window.location.hash}
onClick={(): void => setFilterFunc(point)}
onClick={(): void => setFilterFunc(point, point + 99)}
>
{`${point}-`}
</a>
Expand Down
9 changes: 5 additions & 4 deletions atcoder-problems-frontend/src/pages/ListPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ export const ListPage: React.FC<Props> = (props) => {
const submissions = useMultipleUserSubmissions(users).data ?? [];
const progressReset = useProgressResetList().data;

const setExactPointFilter = (point: number): void => {
const setPointFilter = (from: number, to: number): void => {
const params = new URLSearchParams(location.search);
params.set(FilterParams.FromPoint, point.toString());
params.set(FilterParams.ToPoint, point.toString());
params.set(FilterParams.FromPoint, from.toString());
params.set(FilterParams.ToPoint, to.toString());
history.push({ ...location, search: params.toString() });
};

const setDifficultyFilter = (from: number, to: number): void => {
const params = new URLSearchParams(location.search);
params.set(FilterParams.FromDifficulty, from.toString());
Expand All @@ -53,7 +54,7 @@ export const ListPage: React.FC<Props> = (props) => {
<Row>
<SmallTable
submissions={filteredSubmissions}
setFilterFunc={setExactPointFilter}
setFilterFunc={setPointFilter}
/>
</Row>

Expand Down

0 comments on commit 0da6962

Please sign in to comment.