diff --git a/src/pages/student/StudentLayout.tsx b/src/pages/student/StudentLayout.tsx
index 0e1d624..1ea7acb 100644
--- a/src/pages/student/StudentLayout.tsx
+++ b/src/pages/student/StudentLayout.tsx
@@ -4,7 +4,7 @@ import { Home, BookOpen, Award, User, Video } from "lucide-react";
export function StudentLayout() {
const navItems = [
{ to: "/student/home", icon: Home, label: "Home" },
- { to: "/student/drills", icon: BookOpen, label: "Drills" },
+ { to: "/student/practice", icon: BookOpen, label: "Practice" },
{ to: "/student/lessons", icon: Video, label: "Lessons" },
{ to: "/student/rewards", icon: Award, label: "Rewards" },
{ to: "/student/profile", icon: User, label: "Profile" },
diff --git a/src/pages/student/practice/Pretest.tsx b/src/pages/student/practice/Pretest.tsx
new file mode 100644
index 0000000..1a965d4
--- /dev/null
+++ b/src/pages/student/practice/Pretest.tsx
@@ -0,0 +1,199 @@
+import { useEffect, useState } from "react";
+import { useParams } from "react-router-dom";
+import { api } from "../../../utils/api";
+import { useAuthStore } from "../../../stores/authStore";
+import type { PracticeSheet } from "../../../types/sheet";
+import { CircleQuestionMark, Clock, Layers, Tag } from "lucide-react";
+import {
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+ type CarouselApi,
+} from "../../../components/ui/carousel";
+import { Button } from "../../../components/ui/button";
+
+export const Pretest = () => {
+ const user = useAuthStore((state) => state.user);
+ const { sheetId } = useParams<{ sheetId: string }>();
+ const [carouselApi, setCarouselApi] = useState
();
+ const [current, setCurrent] = useState(0);
+ const [count, setCount] = useState(0);
+
+ const [practiceSheet, setPracticeSheet] = useState(
+ null,
+ );
+
+ function handleStartTest(sheetId: string) {
+ console.log("Starting test for Practice Sheet. ID: ", sheetId);
+ }
+
+ useEffect(() => {
+ if (!user) return;
+ async function fetchPracticeSheet(sheetId: string) {
+ const authStorage = localStorage.getItem("auth-storage");
+ if (!authStorage) {
+ console.error("authStorage not found in local storage");
+ return;
+ }
+ const {
+ state: { token },
+ } = JSON.parse(authStorage);
+ if (!token) {
+ console.error("Token not found in authStorage");
+ return;
+ }
+ const data = await api.getPracticeSheetById(token, sheetId);
+ setPracticeSheet(data);
+ }
+ fetchPracticeSheet(sheetId!);
+ }, [sheetId]);
+
+ useEffect(() => {
+ if (!carouselApi) {
+ return;
+ }
+ setCount(carouselApi.scrollSnapList().length);
+ setCurrent(carouselApi.selectedScrollSnap() + 1);
+ carouselApi.on("select", () => {
+ setCurrent(carouselApi.selectedScrollSnap() + 1);
+ });
+ }, [carouselApi]);
+
+ return (
+
+
+
+
+
+
+
+ {practiceSheet?.time_limit}
+
+
Minutes
+
+
+
+
+
+
+ {practiceSheet?.modules.length}
+
+
Modules
+
+
+
+
+
+
+ {practiceSheet?.questions_count}
+
+
Questions
+
+
+
+
+
+ {practiceSheet ? (
+ practiceSheet.modules.length > 0 ? (
+ practiceSheet.modules.map((module, index) => (
+
+
+
+ Section {Math.floor(index / 2) + 1}
+
+
+ {module.title}
+
+
+
+
+
+
+
+
+ {module.duration}
+
+
Minutes
+
+
+
+
+
+
+
+
+ {module.questions.length}
+
+
Questions
+
+
+
+
+
+
+
+
+ {module.section}
+
+
Type
+
+
+
+
+
+ ))
+ ) : (
+
+
+
+ No modules available.
+
+
+
+ )
+ ) : (
+
+
+
+ )}
+
+
+
+ {practiceSheet?.modules.map((_, index) => (
+
+ ))}
+
+
+
+
+ This practice sheet will help you prepare for the SAT. Take your time
+ and do your best!
+
+
+
+
+ );
+};
diff --git a/src/pages/student/practice/Results.tsx b/src/pages/student/practice/Results.tsx
new file mode 100644
index 0000000..ec57a20
--- /dev/null
+++ b/src/pages/student/practice/Results.tsx
@@ -0,0 +1,3 @@
+export const Results = () => {
+ return Results
;
+};
diff --git a/src/pages/student/practice/Test.tsx b/src/pages/student/practice/Test.tsx
new file mode 100644
index 0000000..b6fcbc7
--- /dev/null
+++ b/src/pages/student/practice/Test.tsx
@@ -0,0 +1,3 @@
+export const Test = () => {
+ return Test
;
+};
diff --git a/src/types/sheet.ts b/src/types/sheet.ts
index 317ab56..3a85211 100644
--- a/src/types/sheet.ts
+++ b/src/types/sheet.ts
@@ -4,6 +4,49 @@ interface CreatedBy {
email: string;
}
+export interface Subject {
+ name: string;
+ section: string;
+ parent_id: string;
+ id: string;
+ slug: string;
+ parent_name: string;
+}
+
+export interface Question {
+ text: string;
+ context: string;
+ context_image_url: string;
+ type: string;
+ section: string;
+ image_url: string;
+ index: number;
+ id: string;
+ options: any[];
+ topics: Topic[];
+ correct_answer: string;
+ explanation: string;
+}
+
+export interface Topic {
+ id: string;
+ name: string;
+}
+
+export interface Module {
+ title: string;
+ duration: number;
+ section: string;
+ difficulty: string;
+ description: string;
+ sequence_order: number;
+ id: string;
+ practice_sheet_id: string;
+ subject: Subject;
+ questions: Question[];
+ questions_count: number;
+}
+
export interface PracticeSheet {
title: string;
difficulty: string;
@@ -15,9 +58,9 @@ export interface PracticeSheet {
created_at: string;
updated_at: string;
questions_count: number;
- topics: string[];
+ topics: Topic[];
created_by: CreatedBy;
- modules: string[];
+ modules: Module[];
user_status: string;
modules_count: number;
}
diff --git a/src/utils/api.ts b/src/utils/api.ts
index 8afb9b5..a219b62 100644
--- a/src/utils/api.ts
+++ b/src/utils/api.ts
@@ -1,3 +1,5 @@
+import type { PracticeSheet } from "../types/sheet";
+
const API_URL = "https://ed-dev-api.omukk.dev";
export interface LoginRequest {
@@ -36,7 +38,7 @@ class ApiClient {
private async request(
endpoint: string,
- options: RequestInit = {}
+ options: RequestInit = {},
): Promise {
const url = `${this.baseURL}${endpoint}`;
@@ -79,7 +81,7 @@ class ApiClient {
async authenticatedRequest(
endpoint: string,
token: string,
- options: RequestInit = {}
+ options: RequestInit = {},
): Promise {
return this.request(endpoint, {
...options,
@@ -98,7 +100,7 @@ class ApiClient {
async getPracticeSheets(
token: string,
page: number,
- limit: number
+ limit: number,
): Promise {
const queryParams = new URLSearchParams({
page: page.toString(),
@@ -106,12 +108,18 @@ class ApiClient {
}).toString();
return this.authenticatedRequest(
`/practice-sheets/?${queryParams}`,
- token
+ token,
);
}
- async getSatDates(token: string): Promise {
- return this.authenticatedRequest(`/sat-dates/`, token);
+ async getPracticeSheetById(
+ token: string,
+ sheetId: string,
+ ): Promise {
+ return this.authenticatedRequest(
+ `/practice-sheets/${sheetId}`,
+ token,
+ );
}
}