Skip to content

Commit 09a162e

Browse files
committed
remove 'solve.category' dependency in 'Solve' inheritance
1 parent 4ac707d commit 09a162e

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

src/components/solves/ModalSolve.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ export default function ModalSolve({ currentTab }: { currentTab: SolveTab }) {
182182
className="w-full h-32 my-3"
183183
show={status}
184184
scramble={solve.scramble}
185-
event={solve ? solve.category : "3x3"}
185+
event={
186+
solve && selectedCube ? selectedCube.category : "3x3"
187+
}
186188
></ScrambleDisplay>
187189
)}
188190
<div>{solve.comment}</div>

src/components/timer/ManualMode.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export default function ManualMode() {
5757
dnf: false,
5858
plus2: false,
5959
rating: Math.floor(Math.random() * 20) + scramble.length,
60-
category: selectedCube.category,
6160
cubeId: selectedCube.id,
6261
};
6362
setLastSolve(newSolve);

src/hooks/useTimer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export default function useTimer() {
134134
dnf: false,
135135
plus2: false,
136136
rating: Math.floor(Math.random() * 20) + scramble.length,
137-
category: selectedCube.category,
138137
cubeId: selectedCube.id,
139138
comment: "",
140139
};

src/interfaces/Solve.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Categories } from "./Categories";
2-
31
export interface Solve {
42
id: string;
53
cubeId: string;
@@ -11,6 +9,5 @@ export interface Solve {
119
rating: number;
1210
dnf: boolean;
1311
plus2: boolean;
14-
category: Categories;
1512
comment?: string;
1613
}

src/lib/importDataFromFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Cube } from "@/interfaces/Cube";
22
import { ChangeEvent } from "react";
33
import genId from "./genId";
4+
import { Solve } from "@/interfaces/Solve";
45

56
export default function importDataFromFile(
67
event: ChangeEvent<HTMLInputElement>
@@ -116,7 +117,7 @@ function isValidCubesData(uploadedFileData: string): boolean {
116117
console.log(endTime - solvingTime, endTime, solvingTime);
117118

118119
// adjust the calculations trying to match the data structure
119-
const newSolve = {
120+
const newSolve: Solve = {
120121
id: genId(),
121122
startTime: endTime - solvingTime,
122123
endTime: endTime,
@@ -126,7 +127,6 @@ function isValidCubesData(uploadedFileData: string): boolean {
126127
dnf: hasDNF,
127128
plus2: plus2,
128129
rating: Math.floor(Math.random() * 20) + scramble.length,
129-
category: newCube.category,
130130
cubeId: newCube.id,
131131
comment: comment,
132132
};

0 commit comments

Comments
 (0)