Skip to content

Commit 80e88b9

Browse files
committed
フォーマット
1 parent 86d4ed0 commit 80e88b9

File tree

21 files changed

+134
-154
lines changed

21 files changed

+134
-154
lines changed

atcoder-problems-frontend/src/components/ListPaginationPanel.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ export const ListPaginationPanel: React.FC<ListPaginationPanelProps> = (
7171
<UncontrolledDropdown className="react-bs-table-sizePerPage-dropdown">
7272
<DropdownToggle caret>{props.sizePerPage}</DropdownToggle>
7373
<DropdownMenu>
74-
{(props.sizePerPageList as Array<{
75-
text: string;
76-
value: number;
77-
}>).map((p) => (
74+
{(
75+
props.sizePerPageList as Array<{
76+
text: string;
77+
value: number;
78+
}>
79+
).map((p) => (
7880
<DropdownItem
7981
key={p.text}
8082
onClick={(): void => props.changeSizePerPage(p.value)}

atcoder-problems-frontend/src/components/ProblemSetGenerator.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,8 @@ export const ProblemSetGenerator: React.FC<Props> = (props) => {
333333
classifyContest(contest)
334334
);
335335
});
336-
candidateContests = candidateContests.concat(
337-
filteredContests
338-
);
336+
candidateContests =
337+
candidateContests.concat(filteredContests);
339338
}
340339
});
341340
candidateProblems = candidateProblems.filter((p) => {

atcoder-problems-frontend/src/pages/Internal/ProblemList/SingleProblemList.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,9 @@ export const SingleProblemList = (props: Props) => {
124124
item={item}
125125
problem={problem}
126126
saveText={async (memo: string) =>
127-
await updateProblemItem(
128-
item.problem_id,
129-
memo,
130-
listId
131-
).then(() => problemListFetch.mutate())
127+
await updateProblemItem(item.problem_id, memo, listId).then(
128+
() => problemListFetch.mutate()
129+
)
132130
}
133131
deleteItem={async () =>
134132
await deleteProblemItem(item.problem_id, listId).then(() =>

atcoder-problems-frontend/src/pages/Internal/VirtualContest/ContestConfig.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ export const ContestConfig: React.FC<Props> = (props) => {
5454
const [penaltySecond, setPenaltySecond] = useState(
5555
props.initialPenaltySecond
5656
);
57-
const [
58-
expectedParticipantUserIdsText,
59-
setExpectedParticipantUserIdsText,
60-
] = useState("");
57+
const [expectedParticipantUserIdsText, setExpectedParticipantUserIdsText] =
58+
useState("");
6159
const [
6260
expectedParticipantsInputErrorMessage,
6361
setExpectedParticipantsInputErrorMessage,

atcoder-problems-frontend/src/pages/Internal/VirtualContest/ShowContest/index.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ const Standings = (props: StandingsProps) => {
260260
};
261261

262262
const NormalContestTabTypes = ["Problems", "Standings"] as const;
263-
type NormalContestTabType = typeof NormalContestTabTypes[number];
263+
type NormalContestTabType = (typeof NormalContestTabTypes)[number];
264264
const TAB_PARAM = "activeTab";
265265

266266
interface NormalContestPageProps extends StandingsProps {
@@ -353,20 +353,18 @@ export const ShowContest = (props: Props) => {
353353
const enableEstimatedPerformances = contestProblems.length < 10;
354354

355355
const showProblems = start <= now;
356-
const problems = contestProblems.map(
357-
(item): VirtualContestProblem => {
358-
const problem = problemMap?.get(item.id);
359-
if (problem) {
360-
return {
361-
item,
362-
contestId: problem.contest_id,
363-
title: `${problem.problem_index}. ${problem.name}`,
364-
};
365-
} else {
366-
return { item };
367-
}
356+
const problems = contestProblems.map((item): VirtualContestProblem => {
357+
const problem = problemMap?.get(item.id);
358+
if (problem) {
359+
return {
360+
item,
361+
contestId: problem.contest_id,
362+
title: `${problem.problem_index}. ${problem.name}`,
363+
};
364+
} else {
365+
return { item };
368366
}
369-
);
367+
});
370368

371369
return (
372370
<>

atcoder-problems-frontend/src/pages/ListPage/ListTable.tsx

Lines changed: 68 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,32 @@ export const statusFilters = [
7676
"AC during Contest",
7777
"AC after Contest",
7878
] as const;
79-
export type StatusFilter = typeof statusFilters[number];
79+
export type StatusFilter = (typeof statusFilters)[number];
8080

8181
const convertSortByParam = (value: string | null): ProblemRowDataField => {
8282
return (
83-
([
84-
"id",
85-
"title",
86-
"contest",
87-
"contestDate",
88-
"contestTitle",
89-
"lastAcceptedDate",
90-
"solverCount",
91-
"point",
92-
"problemModel",
93-
"firstUserId",
94-
"executionTime",
95-
"codeLength",
96-
"mergedProblem",
97-
"shortestUserId",
98-
"fastestUserId",
99-
"status",
100-
"solveProbability",
101-
"timeEstimation",
102-
] as const).find((v) => v === value) ?? "contestDate"
83+
(
84+
[
85+
"id",
86+
"title",
87+
"contest",
88+
"contestDate",
89+
"contestTitle",
90+
"lastAcceptedDate",
91+
"solverCount",
92+
"point",
93+
"problemModel",
94+
"firstUserId",
95+
"executionTime",
96+
"codeLength",
97+
"mergedProblem",
98+
"shortestUserId",
99+
"fastestUserId",
100+
"status",
101+
"solveProbability",
102+
"timeEstimation",
103+
] as const
104+
).find((v) => v === value) ?? "contestDate"
103105
);
104106
};
105107

@@ -137,50 +139,48 @@ export const ListTable: React.FC<Props> = (props) => {
137139
const contestMap = useContestMap();
138140
const statusLabelMap = constructStatusLabelMap(filteredSubmissions, userId);
139141
const rowData = Array.from(mergedProblemMap.values())
140-
.map(
141-
(p: MergedProblem): ProblemRowData => {
142-
const contest = contestMap?.get(p.contest_id);
143-
const contestDate =
144-
contest && contest.start_epoch_second > 0
145-
? formatMomentDate(parseSecond(contest.start_epoch_second))
146-
: "";
147-
const contestTitle = contest ? contest.title : "";
142+
.map((p: MergedProblem): ProblemRowData => {
143+
const contest = contestMap?.get(p.contest_id);
144+
const contestDate =
145+
contest && contest.start_epoch_second > 0
146+
? formatMomentDate(parseSecond(contest.start_epoch_second))
147+
: "";
148+
const contestTitle = contest ? contest.title : "";
148149

149-
const status = statusLabelMap.get(p.id) ?? noneStatus();
150-
const lastAcceptedDate =
151-
status.label === StatusLabel.Success
152-
? formatMomentDate(parseSecond(status.lastAcceptedEpochSecond))
153-
: "";
154-
const point = p.point ?? INF_POINT;
155-
const firstUserId = p.first_user_id ? p.first_user_id : "";
156-
const executionTime =
157-
p.execution_time != null ? p.execution_time : INF_POINT;
158-
const codeLength = p.source_code_length
159-
? p.source_code_length
160-
: INF_POINT;
161-
const shortestUserId = p.shortest_user_id ? p.shortest_user_id : "";
162-
const fastestUserId = p.fastest_user_id ? p.fastest_user_id : "";
163-
const problemModel = problemModels?.get(p.id);
164-
return {
165-
id: p.id,
166-
title: `${p.problem_index}. ${p.name}`,
167-
contest,
168-
contestDate,
169-
contestTitle,
170-
lastAcceptedDate,
171-
solverCount: p.solver_count ? p.solver_count : 0,
172-
point,
173-
problemModel,
174-
firstUserId,
175-
executionTime,
176-
codeLength,
177-
mergedProblem: p,
178-
shortestUserId,
179-
fastestUserId,
180-
status,
181-
};
182-
}
183-
)
150+
const status = statusLabelMap.get(p.id) ?? noneStatus();
151+
const lastAcceptedDate =
152+
status.label === StatusLabel.Success
153+
? formatMomentDate(parseSecond(status.lastAcceptedEpochSecond))
154+
: "";
155+
const point = p.point ?? INF_POINT;
156+
const firstUserId = p.first_user_id ? p.first_user_id : "";
157+
const executionTime =
158+
p.execution_time != null ? p.execution_time : INF_POINT;
159+
const codeLength = p.source_code_length
160+
? p.source_code_length
161+
: INF_POINT;
162+
const shortestUserId = p.shortest_user_id ? p.shortest_user_id : "";
163+
const fastestUserId = p.fastest_user_id ? p.fastest_user_id : "";
164+
const problemModel = problemModels?.get(p.id);
165+
return {
166+
id: p.id,
167+
title: `${p.problem_index}. ${p.name}`,
168+
contest,
169+
contestDate,
170+
contestTitle,
171+
lastAcceptedDate,
172+
solverCount: p.solver_count ? p.solver_count : 0,
173+
point,
174+
problemModel,
175+
firstUserId,
176+
executionTime,
177+
codeLength,
178+
mergedProblem: p,
179+
shortestUserId,
180+
fastestUserId,
181+
status,
182+
};
183+
})
184184
.sort((a, b) => {
185185
const dateOrder = b.contestDate.localeCompare(a.contestDate);
186186
return dateOrder === 0 ? a.title.localeCompare(b.title) : dateOrder;
@@ -424,11 +424,8 @@ export const ListTable: React.FC<Props> = (props) => {
424424
dataField: "executionTime",
425425
dataSort: true,
426426
dataFormat: (executionTime: number, row): React.ReactElement => {
427-
const {
428-
fastest_submission_id,
429-
fastest_contest_id,
430-
fastest_user_id,
431-
} = row.mergedProblem;
427+
const { fastest_submission_id, fastest_contest_id, fastest_user_id } =
428+
row.mergedProblem;
432429
if (fastest_submission_id && fastest_contest_id && fastest_user_id) {
433430
return (
434431
<a
@@ -480,11 +477,8 @@ export const ListTable: React.FC<Props> = (props) => {
480477
dataField: "firstUserId",
481478
dataSort: true,
482479
dataFormat: (_: string, row): React.ReactElement => {
483-
const {
484-
first_submission_id,
485-
first_contest_id,
486-
first_user_id,
487-
} = row.mergedProblem;
480+
const { first_submission_id, first_contest_id, first_user_id } =
481+
row.mergedProblem;
488482
if (first_submission_id && first_contest_id && first_user_id) {
489483
return (
490484
<a

atcoder-problems-frontend/src/pages/ListPage/ProblemList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const RATED_FILTERS = [
5353
"Only Unrated",
5454
"Only Unrated without Difficulty",
5555
] as const;
56-
type RatedFilter = typeof RATED_FILTERS[number];
56+
type RatedFilter = (typeof RATED_FILTERS)[number];
5757

5858
interface Props {
5959
userId: string;

atcoder-problems-frontend/src/pages/TablePage/AtCoderRegularTable.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ const AtCoderRegularTableSFC: React.FC<Props> = (props) => {
7070
}
7171
const contests: OneContest[] = props.contests
7272
.map((contest) => {
73-
const problems = (
74-
props.contestToProblems.get(contest.id) ?? []
75-
).sort((a, b) => a.id.localeCompare(b.id));
73+
const problems = (props.contestToProblems.get(contest.id) ?? []).sort(
74+
(a, b) => a.id.localeCompare(b.id)
75+
);
7676
const problemStatusList = problems.map((problem) => {
7777
const status = props.statusLabelMap.get(problem.id) ?? noneStatus();
7878
return {

atcoder-problems-frontend/src/pages/UserPage/AchievementBlock/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ export const AchievementBlock: React.FC<Props> = (props) => {
5959
const userSubmissions = useUserSubmission(props.userId) ?? [];
6060
const problemModels = useProblemModelMap();
6161
const dailyCount = countUniqueAcByDate(userSubmissions);
62-
const { longestStreak, currentStreak, prevDateLabel } = calcStreak(
63-
dailyCount
64-
);
62+
const { longestStreak, currentStreak, prevDateLabel } =
63+
calcStreak(dailyCount);
6564
const shortRanking = useShortRanking() ?? [];
6665
const fastRanking = useFastRanking() ?? [];
6766
const firstRanking = useFirstRanking() ?? [];

atcoder-problems-frontend/src/pages/UserPage/CategoryPieChart/index.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ describe("test makeCategoryCounts", () => {
192192
];
193193

194194
const expected = new Map<ContestCategory, StatusCount>(
195-
ContestCategories.filter(
196-
(category) => category !== "ABC"
197-
).map((category) => [category, { solved: 0, rejected: 0, total: 0 }])
195+
ContestCategories.filter((category) => category !== "ABC").map(
196+
(category) => [category, { solved: 0, rejected: 0, total: 0 }]
197+
)
198198
);
199199
expected.set("ABC", { solved: 1, rejected: 0, total: 4 });
200200
expect(
@@ -268,9 +268,9 @@ describe("test makeCategoryCounts", () => {
268268
];
269269

270270
const expected = new Map<ContestCategory, StatusCount>(
271-
ContestCategories.filter(
272-
(category) => category !== "ABC"
273-
).map((category) => [category, { solved: 0, rejected: 0, total: 0 }])
271+
ContestCategories.filter((category) => category !== "ABC").map(
272+
(category) => [category, { solved: 0, rejected: 0, total: 0 }]
273+
)
274274
);
275275
expected.set("ABC", { solved: 1, rejected: 1, total: 4 });
276276
expect(
@@ -319,9 +319,9 @@ describe("test makeCategoryCounts", () => {
319319
const userSubmissions: Submission[] = [];
320320

321321
const expected = new Map<ContestCategory, StatusCount>(
322-
ContestCategories.filter(
323-
(category) => category !== "ABC"
324-
).map((category) => [category, { solved: 0, rejected: 0, total: 0 }])
322+
ContestCategories.filter((category) => category !== "ABC").map(
323+
(category) => [category, { solved: 0, rejected: 0, total: 0 }]
324+
)
325325
);
326326
expected.set("ABC", { solved: 0, rejected: 0, total: 4 });
327327
expect(

0 commit comments

Comments
 (0)