Skip to content

Commit 08b233b

Browse files
Replace any[] with proper Enrollment type in dashboard.tsx
Co-authored-by: jeromehardaway <[email protected]>
1 parent 261a19f commit 08b233b

File tree

3 files changed

+149
-136
lines changed

3 files changed

+149
-136
lines changed

package-lock.json

Lines changed: 105 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/dashboard.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,44 @@ type PageWithLayout = NextPage<PageProps> & {
1919
Layout?: typeof Layout01;
2020
};
2121

22+
type Course = {
23+
id: string;
24+
title: string;
25+
description: string | null;
26+
imageUrl: string | null;
27+
difficulty: string;
28+
category: string;
29+
isPublished: boolean;
30+
estimatedHours: number | null;
31+
prerequisites: string[];
32+
tags: string[];
33+
_count: {
34+
modules: number;
35+
};
36+
};
37+
38+
type EnrollmentStatus = "ACTIVE" | "COMPLETED" | "DROPPED" | "PAUSED";
39+
40+
type Enrollment = {
41+
id: string;
42+
userId: string;
43+
courseId: string;
44+
status: EnrollmentStatus;
45+
progress: number;
46+
enrolledAt: string;
47+
completedAt: string | null;
48+
lastActivity: string;
49+
course: Course;
50+
stats: {
51+
totalLessons: number;
52+
completedLessons: number;
53+
progressPercentage: number;
54+
};
55+
};
56+
2257
const Dashboard: PageWithLayout = () => {
2358
const { data: session, status } = useSession();
24-
const [enrollments, setEnrollments] = useState<any[]>([]);
59+
const [enrollments, setEnrollments] = useState<Enrollment[]>([]);
2560
const [loading, setLoading] = useState(true);
2661

2762
useEffect(() => {

yarn.lock

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,6 @@
10551055
dependencies:
10561056
"@jridgewell/trace-mapping" "0.3.9"
10571057

1058-
"@esbuild/[email protected]":
1059-
version "0.25.5"
1060-
resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz"
1061-
integrity sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==
1062-
10631058
"@eslint-community/eslint-utils@^4.2.0":
10641059
version "4.4.1"
10651060
resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz"
@@ -1162,18 +1157,6 @@
11621157
resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz"
11631158
integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==
11641159

1165-
1166-
version "0.33.5"
1167-
resolved "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz"
1168-
integrity sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==
1169-
optionalDependencies:
1170-
"@img/sharp-libvips-darwin-arm64" "1.0.4"
1171-
1172-
1173-
version "1.0.4"
1174-
resolved "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz"
1175-
integrity sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==
1176-
11771160
"@isaacs/cliui@^8.0.2":
11781161
version "8.0.2"
11791162
resolved "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz"
@@ -1504,10 +1487,15 @@
15041487
dependencies:
15051488
fast-glob "3.3.1"
15061489

1507-
1490+
1491+
version "15.1.1"
1492+
resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.1.tgz"
1493+
integrity sha512-KgIiKDdV35KwL9TrTxPFGsPb3J5RuDpw828z3MwMQbWaOmpp/T4MeWQCwo+J2aOxsyAcfsNE334kaWXCb6YTTA==
1494+
1495+
15081496
version "15.1.1"
1509-
resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.1.tgz"
1510-
integrity sha512-pq7Hzu0KaaH6UYcCQ22mOuj2mWCD6iqGvYprp/Ep1EcCxbdNOSS+8EJADFbPHsaXLkaonIJ8lTKBGWXaFxkeNQ==
1497+
resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.1.tgz"
1498+
integrity sha512-aHP/29x8loFhB3WuW2YaWaYFJN389t6/SBsug19aNwH+PRLzDEQfCvtuP6NxRCido9OAoExd+ZuYJKF9my1Kpg==
15111499

15121500
"@nodelib/[email protected]":
15131501
version "2.1.5"
@@ -6261,16 +6249,6 @@ fs.realpath@^1.0.0:
62616249
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
62626250
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
62636251

6264-
fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3:
6265-
version "2.3.3"
6266-
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz"
6267-
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
6268-
6269-
6270-
version "2.3.2"
6271-
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
6272-
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
6273-
62746252
function-bind@^1.1.2:
62756253
version "1.1.2"
62766254
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"

0 commit comments

Comments
 (0)