Skip to content

Commit 3440c3a

Browse files
authored
Revert "feat: in progress quizzes (#8)"
This reverts commit 55d4f1e.
1 parent 55d4f1e commit 3440c3a

File tree

23 files changed

+141
-580
lines changed

23 files changed

+141
-580
lines changed

src/api/answer/answer.api.ts

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,15 @@ export const startQuiz = async ({
3434
};
3535

3636
export type GetUserAnswerInput = {
37-
answerId?: string;
38-
answersUser?: {
39-
userId: string;
40-
questionsId: string;
41-
};
37+
answerId: string;
4238
};
4339

44-
export const getUserAnswers = async ({
45-
answerId,
46-
answersUser,
47-
}: GetUserAnswerInput) => {
48-
const query = new URLSearchParams();
49-
50-
if (answerId) {
51-
query.set("answerId", answerId);
52-
}
53-
54-
if (answersUser) {
55-
query.set("userId", answersUser.userId);
56-
query.set("questionsId", answersUser.questionsId);
57-
}
58-
59-
return await request("/api/answer/details").get(
40+
export const getUserAnswers = async ({ answerId }: GetUserAnswerInput) => {
41+
return await request("/api/answer/:answerId").get(
6042
{
61-
query,
43+
params: {
44+
answerId,
45+
},
6246
},
6347
TUserAnswer
6448
);

src/api/answer/answer.schema.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,16 @@ export const TQuestionAnswer = z.object({
1313
export type QuestionAnswer = z.infer<typeof TQuestionAnswer>;
1414

1515
const TAnswer = z.object({
16-
_id: z.string(),
1716
questionId: z.string(),
18-
question: z.string(),
19-
answerType: TAnswerTypes,
2017
order: z.number(),
2118
questionAnswer: TQuestionAnswer,
2219
});
2320

2421
export const TUserAnswer = z.object({
2522
_id: z.string(),
26-
quizId: z.string(),
27-
user: z.object({
28-
userId: z.string().optional(),
29-
username: z.string(),
30-
email: z.string(),
31-
}),
32-
questionsCount: z.number(),
23+
userId: z.string().optional(),
24+
email: z.string(),
25+
username: z.string(),
3326
questionsId: z.string(),
3427
answers: z.array(TAnswer),
3528
});

src/api/query-keys.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const qk = buildModuleCacheKey({
3232
publicQuizzes: (input: GetPublicQuizzesInput) => [input],
3333
myQuizzes: null,
3434
quizQuestion: (input: GetQuizQuestionInput) => [input],
35-
inProgress: null,
3635
},
3736
answer: {
3837
getUserAnswer: (input: GetUserAnswerInput) => [input],

src/api/quiz/quiz.api.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { request } from "@lib/request";
22
import { QuizFormValues } from "@pages/create-quiz/components";
33
import {
44
QuizStatus,
5-
TInProgressQuizzes,
65
TPublicQuiz,
76
TPublicQuizzes,
87
TQuiz,
@@ -127,10 +126,3 @@ export const getPublicQuizDetails = async ({
127126
export const getMyQuizzes = async () => {
128127
return await request("/api/my-quizzes").get({}, TQuizzes);
129128
};
130-
131-
export const getQuizzesInProgress = async () => {
132-
return await request("/api/my-quizzes/in-progress").get(
133-
{},
134-
TInProgressQuizzes
135-
);
136-
};

src/api/quiz/quiz.schema.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { TUserAnswer } from "@api/answer";
21
import { z } from "zod";
32

43
export const TVisibilityOptions = z.union([
@@ -78,16 +77,3 @@ export const TPublicQuiz = z.object({
7877
export type PublicQuiz = z.infer<typeof TPublicQuiz>;
7978

8079
export const TPublicQuizzes = z.array(TPublicQuiz);
81-
82-
const TInProgressQuiz = z.intersection(
83-
TUserAnswer,
84-
z.object({
85-
answerId: z.string(),
86-
quizName: z.string().optional(),
87-
category: TQuizCategoryOptions,
88-
})
89-
);
90-
91-
export const TInProgressQuizzes = z.array(TInProgressQuiz);
92-
93-
export type InProgressQuiz = z.infer<typeof TInProgressQuiz>;

src/app/assets/icons/check.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SvgIcon, { SvgIconProps } from "@mui/material/SvgIcon";
33
export const IconCheck = ({ ...props }: SvgIconProps) => {
44
return (
55
<SvgIcon {...props} viewBox="0 0 24 24">
6-
<g clipPath="url(#clip0_91_2)">
6+
<g clip-path="url(#clip0_91_2)">
77
<path
88
fillRule="evenodd"
99
clipRule="evenodd"

src/app/assets/icons/quiz-categories/geography.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SvgIcon, { SvgIconProps } from "@mui/material/SvgIcon";
33
export const IconCategoryGeography = ({ ...props }: SvgIconProps) => {
44
return (
55
<SvgIcon {...props} viewBox="0 0 24 24">
6-
<g clipPath="url(#clip0_67_24)">
6+
<g clip-path="url(#clip0_67_24)">
77
<path
88
fillRule="evenodd"
99
clipRule="evenodd"

src/app/ui/linear-progress.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const LinearProgress = ({ label, ...props }: Props) => {
1515
const theme = useTheme();
1616
return (
1717
<Box sx={{ display: "flex", alignItems: "center", width: 1 }}>
18-
<Box sx={{ width: "100%" }}>
18+
<Box sx={{ width: "100%", mr: 1 }}>
1919
<MuiLinearProgress
2020
variant="determinate"
2121
{...props}
@@ -33,7 +33,7 @@ export const LinearProgress = ({ label, ...props }: Props) => {
3333
}}
3434
/>
3535
</Box>
36-
{label && <Box sx={{ minWidth: 35, ml: 2 }}>{label}</Box>}
36+
<Box sx={{ minWidth: 35, ml: 2 }}>{label}</Box>
3737
</Box>
3838
);
3939
};

src/components/quiz-card/in-progress-quiz-card.tsx

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/components/quiz-card/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export { InProgressQuizCard } from "./in-progress-quiz-card";
21
export { PublicQuizCard } from "./public-quiz-card";
32
export { QuizCard } from "./quiz-card";

0 commit comments

Comments
 (0)