diff --git a/apps/client/drizzle.config.ts b/apps/client/drizzle.config.ts new file mode 100644 index 0000000..37b5ca8 --- /dev/null +++ b/apps/client/drizzle.config.ts @@ -0,0 +1,26 @@ +// import { config } from "dotenv"; +// import { defineConfig } from "drizzle-kit"; + +// config({ path: ".env" }); + +// export default defineConfig({ +// schema: "./src/db/schema.ts", +// out: "./migrations", +// dialect: "postgresql", +// dbCredentials: { +// url: process.env.DATABASE_URL!, +// }, +// }); + +import "dotenv/config"; +import { defineConfig } from "drizzle-kit"; + +export default defineConfig({ + out: "./drizzle", + schema: "./src/db/schema.ts", + dialect: "turso", + dbCredentials: { + url: process.env.TURSO_DATABASE_URL!, + authToken: process.env.TURSO_AUTH_TOKEN!, + }, +}); diff --git a/apps/client/drizzle/0000_narrow_iron_fist.sql b/apps/client/drizzle/0000_narrow_iron_fist.sql new file mode 100644 index 0000000..121d098 --- /dev/null +++ b/apps/client/drizzle/0000_narrow_iron_fist.sql @@ -0,0 +1,14 @@ +CREATE TABLE `posts_table` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `title` text NOT NULL, + `content` text NOT NULL +); +--> statement-breakpoint +CREATE TABLE `users_table` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `name` text NOT NULL, + `age` integer NOT NULL, + `email` text NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `users_table_email_unique` ON `users_table` (`email`); \ No newline at end of file diff --git a/apps/client/drizzle/meta/0000_snapshot.json b/apps/client/drizzle/meta/0000_snapshot.json new file mode 100644 index 0000000..78da980 --- /dev/null +++ b/apps/client/drizzle/meta/0000_snapshot.json @@ -0,0 +1,95 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "3df1e1e6-13eb-4b16-acb7-a1bc6c632530", + "prevId": "00000000-0000-0000-0000-000000000000", + "tables": { + "posts_table": { + "name": "posts_table", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users_table": { + "name": "users_table", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "age": { + "name": "age", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "users_table_email_unique": { + "name": "users_table_email_unique", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/apps/client/drizzle/meta/_journal.json b/apps/client/drizzle/meta/_journal.json new file mode 100644 index 0000000..823207f --- /dev/null +++ b/apps/client/drizzle/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "7", + "dialect": "sqlite", + "entries": [ + { + "idx": 0, + "version": "6", + "when": 1740026199088, + "tag": "0000_narrow_iron_fist", + "breakpoints": true + } + ] +} \ No newline at end of file diff --git a/apps/client/package.json b/apps/client/package.json index 19592e4..b37fe3e 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -7,9 +7,17 @@ "build": "next build", "start": "next start", "lint": "next lint --max-warnings 0", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "db:generate": "npx drizzle-kit generate", + "db:push": "npx drizzle-kit push", + "db:studio": "npx drizzle-kit studio", + "db:migrate": "npx drizzle-kit migrate", + "db:seed": "npx tsx src/db/drizzle.ts" }, "dependencies": { + "@clerk/nextjs": "^6.11.3", + "@libsql/client": "^0.14.0", + "@metafest/pushyplayer": "^0.1.26", "@radix-ui/react-avatar": "^1.1.3", "@radix-ui/react-collapsible": "^1.1.3", "@radix-ui/react-dialog": "^1.1.6", @@ -22,7 +30,8 @@ "@vercel/speed-insights": "^1.2.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", - "@clerk/nextjs": "^6.11.3", + "dotenv": "^16.4.7", + "drizzle-orm": "^0.39.3", "framer-motion": "^12.3.1", "lucide-react": "^0.474.0", "motion": "^12.3.1", @@ -41,8 +50,10 @@ "@types/react": "^19", "@types/react-dom": "^19", "autoprefixer": "^10.4.20", + "drizzle-kit": "^0.30.4", "postcss": "^8.5.1", "tailwindcss": "^3.4.17", + "tsx": "^4.19.3", "typescript": "^5" } } diff --git a/apps/client/src/app/api/route.ts b/apps/client/src/app/api/route.ts new file mode 100644 index 0000000..387d798 --- /dev/null +++ b/apps/client/src/app/api/route.ts @@ -0,0 +1,5 @@ +export async function GET() { + return Response.json({ + message: "Hello, world!", + }); +} diff --git a/apps/client/src/app/api/test/route.ts b/apps/client/src/app/api/test/route.ts new file mode 100644 index 0000000..4b39f49 --- /dev/null +++ b/apps/client/src/app/api/test/route.ts @@ -0,0 +1,13 @@ +import { usersTable } from "@/db/schema"; +import { getDbClient } from "@/utils/drizzle"; + +export const dynamic = 'force-dynamic'; + +export async function GET() { + const db = getDbClient(); + const users = await db.select().from(usersTable); + + return Response.json({ + users, + }); +} diff --git a/apps/client/src/app/home/gallery/page.tsx b/apps/client/src/app/home/gallery/page.tsx index e25897b..d99ad78 100644 --- a/apps/client/src/app/home/gallery/page.tsx +++ b/apps/client/src/app/home/gallery/page.tsx @@ -3,6 +3,8 @@ import { FileVideo } from "lucide-react"; import GalleryCard, { Video } from "@/components/home/videoCard"; import { fetchUserObjects } from "@/utils"; +export const dynamic = 'force-dynamic'; + const EmptyState = () => (
@@ -27,7 +29,10 @@ const VideoGrid = async () => {
{data && data.length > 0 ? ( data.map((video, index) => ( - + )) ) : ( diff --git a/apps/client/src/app/home/layout.tsx b/apps/client/src/app/home/layout.tsx index 2503a61..6fb474d 100644 --- a/apps/client/src/app/home/layout.tsx +++ b/apps/client/src/app/home/layout.tsx @@ -7,7 +7,7 @@ import { SidebarProvider, SidebarTrigger, } from "@/components/ui/sidebar"; -import { ClerkProvider, SignedOut, SignIn } from "@clerk/nextjs"; +import { ClerkProvider, SignedIn, SignedOut, SignIn } from "@clerk/nextjs"; import { Toaster } from "@/components/ui/sonner"; import TanstackProvider from "@/components/TanStackQuery/provider"; @@ -22,10 +22,11 @@ export default function Layout({ children }: { children: ReactNode }) { - {/* */} + - +
@@ -35,8 +36,8 @@ export default function Layout({ children }: { children: ReactNode }) {
{children}
- - {/* */} + + ); diff --git a/apps/client/src/app/home/mv/[slug]/page.tsx b/apps/client/src/app/home/mv/[slug]/page.tsx new file mode 100644 index 0000000..2151ab7 --- /dev/null +++ b/apps/client/src/app/home/mv/[slug]/page.tsx @@ -0,0 +1,15 @@ +'use client' +import { VideoPlayer } from "@metafest/pushyplayer"; +import "@metafest/pushyplayer/dist/index.css"; +import { useParams } from "next/navigation"; + +export default function Page() { + const params = useParams(); + const slug = params.slug as string; + + return ( + + ); +} \ No newline at end of file diff --git a/apps/client/src/app/home/page.tsx b/apps/client/src/app/home/page.tsx index 751edd3..ccc8bf6 100644 --- a/apps/client/src/app/home/page.tsx +++ b/apps/client/src/app/home/page.tsx @@ -1,11 +1,11 @@ import Feed from "@/components/home/Feed"; +export const dynamic = 'force-dynamic'; export default function Page() { return ( - -
- -
+
+ +
); } diff --git a/apps/client/src/app/home/upload/page.tsx b/apps/client/src/app/home/upload/page.tsx index cb587f0..3ddd3e3 100644 --- a/apps/client/src/app/home/upload/page.tsx +++ b/apps/client/src/app/home/upload/page.tsx @@ -1,5 +1,7 @@ import { UploadForm } from "@/components/upload/upload-form"; +export const dynamic = 'force-dynamic'; + export default function UploadPage() { return (
diff --git a/apps/client/src/components/app-sidebar.tsx b/apps/client/src/components/app-sidebar.tsx index 23598bc..a669aaf 100644 --- a/apps/client/src/components/app-sidebar.tsx +++ b/apps/client/src/components/app-sidebar.tsx @@ -23,11 +23,11 @@ export function AppSidebar({ ...props }: React.ComponentProps) { url: "/home/upload", icon: File, }, - { - name: "p2p Sharing", - url: "/home", - icon: PersonStandingIcon, - }, + // { + // name: "p2p Sharing", + // url: "/home", + // icon: PersonStandingIcon, + // }, { name: "Video Streaming", url: "/home/gallery", diff --git a/apps/client/src/components/home/videoCard.tsx b/apps/client/src/components/home/videoCard.tsx index 4d146d9..702844f 100644 --- a/apps/client/src/components/home/videoCard.tsx +++ b/apps/client/src/components/home/videoCard.tsx @@ -3,6 +3,7 @@ import React, { useState, useRef } from "react"; import { FileVideo, Clock, HardDrive } from "lucide-react"; import { Card, CardContent } from "../ui/card"; +import { useRouter } from "next/navigation"; // Utility functions const formatFileSize = (bytes: number) => { @@ -37,26 +38,32 @@ const GalleryCard = ({ video }: { video: Video }) => { const [isHovering, setIsHovering] = useState(false); const videoRef = useRef(null); const title = video.pathname?.split(".").slice(0, -1).join(".") || "Untitled"; + const router = useRouter(); + // Temporarily commented out hover play functionality const handleMouseEnter = () => { - setIsHovering(true); - if (videoRef.current) { - videoRef.current - .play() - .catch((err) => console.log("Video play failed:", err)); - } + // setIsHovering(true); + // if (videoRef.current) { + // videoRef.current + // .play() + // .catch((err) => console.log("Video play failed:", err)); + // } }; const handleMouseLeave = () => { - setIsHovering(false); - if (videoRef.current) { - videoRef.current.pause(); - videoRef.current.currentTime = 0; - } + // setIsHovering(false); + // if (videoRef.current) { + // videoRef.current.pause(); + // videoRef.current.currentTime = 0; + // } + }; + + const handleClick = () => { + router.push(`/home/mv/${video.pathname}`); }; return ( - + {/* Video Preview Section */}
{ onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} > - {isHovering ? ( + {/* Temporarily commented out hover play functionality */} + {false && isHovering ? (