Skip to content

Commit 85950fc

Browse files
committed
fixed drizzle
1 parent 0f75e21 commit 85950fc

File tree

7 files changed

+28
-1080
lines changed

7 files changed

+28
-1080
lines changed

src/app/admin/courses/[courseId]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default async function CourseIdPage({
3737
}
3838

3939
return (
40-
<div className="flex flex-col gap-4">
40+
<div className="flex flex-col gap-4 min-h-[500px] h-[85vh]">
4141
<div className="flex justify-end gap-4">
4242
<Link href={`/admin/courses/${id}/lesson/create`}>
4343
<Button variant={"outline"} className="cursor-pointer">Create Lesson</Button>
@@ -46,13 +46,13 @@ export default async function CourseIdPage({
4646
<Button variant={"outline"} className="cursor-pointer">Create Unit</Button>
4747
</Link>
4848
</div>
49-
<Card>
49+
<Card className="h-full">
5050
<CardTitle className="px-6 text-3xl">
5151
<span className="font-semibold">Course: </span>
5252
<span className="font-light">{course.title}</span>
5353
</CardTitle>
5454
<CardDescription className="px-6 text-md">{course.description}</CardDescription>
55-
<CardContent>
55+
<CardContent className="h-full">
5656
<CourseController units={units} lessons={lessons} />
5757
</CardContent>
5858
</Card>

src/components/admin/course/CourseController.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export default function CourseController({ units, lessons }: CourseControllerPro
5353
);
5454

5555
return (
56-
<div className="flex flex-col md:flex-row gap-6">
57-
<div className="md:w-1/4 order-2 md:order-1">
56+
<div className="flex flex-col md:flex-row gap-6 h-full">
57+
<div className="md:w-1/4 order-2 md:order-1 h-[60vh] overflow-y-auto">
5858
<DragDropContext onDragEnd={onDragEnd}>
59-
<Accordion type="single" collapsible>
59+
<Accordion type="multiple">
6060
<Droppable droppableId="units" type="UNIT">
6161
{(provided) => (
6262
<div
@@ -76,7 +76,7 @@ export default function CourseController({ units, lessons }: CourseControllerPro
7676
{...unitProvided.draggableProps}
7777
className="border p-4 rounded bg-white shadow space-y-2"
7878
>
79-
<AccordionItem value="index">
79+
<AccordionItem value={`unit-${unit.id}`}>
8080
{/* UNIT HEADER – drag handle ONLY */}
8181
<div
8282
{...unitProvided.dragHandleProps}

src/db/drizzle/0000_secret_darkstar.sql renamed to src/db/drizzle/0000_mixed_stephen_strange.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ CREATE TABLE `courses_tags` (
5757
CREATE TABLE `lessons` (
5858
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
5959
`unitId` integer NOT NULL,
60+
`title` text NOT NULL,
61+
`description` text,
6062
`media_type` text DEFAULT 'markdown' NOT NULL,
6163
`content_url` text,
6264
`contentBlobId` integer,
@@ -84,7 +86,7 @@ CREATE TABLE `tags` (
8486
CREATE UNIQUE INDEX `tags_tag_name_unique` ON `tags` (`tag_name`);--> statement-breakpoint
8587
CREATE TABLE `units` (
8688
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
87-
`course_id` text NOT NULL,
89+
`course_id` integer NOT NULL,
8890
`title` text,
8991
`position` integer DEFAULT 1 NOT NULL,
9092
`created_at` integer DEFAULT (unixepoch()) NOT NULL,

src/db/drizzle/0001_huge_gideon.sql

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

src/db/drizzle/meta/0000_snapshot.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "6",
33
"dialect": "sqlite",
4-
"id": "2750c3c1-e1d9-4edb-af49-33c04fda95ef",
4+
"id": "07ece851-eea4-4bc0-8cdf-2898908a6164",
55
"prevId": "00000000-0000-0000-0000-000000000000",
66
"tables": {
77
"attachments": {
@@ -412,6 +412,20 @@
412412
"notNull": true,
413413
"autoincrement": false
414414
},
415+
"title": {
416+
"name": "title",
417+
"type": "text",
418+
"primaryKey": false,
419+
"notNull": true,
420+
"autoincrement": false
421+
},
422+
"description": {
423+
"name": "description",
424+
"type": "text",
425+
"primaryKey": false,
426+
"notNull": false,
427+
"autoincrement": false
428+
},
415429
"media_type": {
416430
"name": "media_type",
417431
"type": "text",
@@ -599,7 +613,7 @@
599613
},
600614
"course_id": {
601615
"name": "course_id",
602-
"type": "text",
616+
"type": "integer",
603617
"primaryKey": false,
604618
"notNull": true,
605619
"autoincrement": false

0 commit comments

Comments
 (0)