Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions apps/client/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -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!,
},
});
14 changes: 14 additions & 0 deletions apps/client/drizzle/0000_narrow_iron_fist.sql
Original file line number Diff line number Diff line change
@@ -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`);
95 changes: 95 additions & 0 deletions apps/client/drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
}
13 changes: 13 additions & 0 deletions apps/client/drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "6",
"when": 1740026199088,
"tag": "0000_narrow_iron_fist",
"breakpoints": true
}
]
}
15 changes: 13 additions & 2 deletions apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
}
5 changes: 5 additions & 0 deletions apps/client/src/app/api/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export async function GET() {
return Response.json({
message: "Hello, world!",
});
}
13 changes: 13 additions & 0 deletions apps/client/src/app/api/test/route.ts
Original file line number Diff line number Diff line change
@@ -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,
});
}
7 changes: 6 additions & 1 deletion apps/client/src/app/home/gallery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => (
<div className="w-full min-h-[400px] flex flex-col items-center justify-center bg-gray-50 rounded-lg">
<FileVideo className="w-16 h-16 text-gray-400 mb-4" />
Expand All @@ -27,7 +29,10 @@ const VideoGrid = async () => {
<div className="grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4 auto-rows-fr">
{data && data.length > 0 ? (
data.map((video, index) => (
<GalleryCard key={video.httpEtag || index} video={video} />
<GalleryCard
key={video.httpEtag ? `${video.httpEtag}-${index}` : `video-${index}`}
video={video}
/>
))
) : (
<EmptyState />
Expand Down
11 changes: 6 additions & 5 deletions apps/client/src/app/home/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -22,10 +22,11 @@ export default function Layout({ children }: { children: ReactNode }) {
</SignedOut>

<TanstackProvider>
{/* <SignedIn> */}
<SignedIn>
<SidebarProvider>
<AppSidebar />
<SidebarInset>
<SidebarInset
>
<header className="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12">
<div className="flex items-center gap-2 px-4">
<SidebarTrigger className="-ml-1" />
Expand All @@ -35,8 +36,8 @@ export default function Layout({ children }: { children: ReactNode }) {
<div>{children}</div>
<Toaster />
</SidebarInset>
</SidebarProvider>
{/* </SignedIn> */}
</SidebarProvider>
</SignedIn>
</TanstackProvider>
</ClerkProvider>
);
Expand Down
15 changes: 15 additions & 0 deletions apps/client/src/app/home/mv/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<VideoPlayer
src={`https://manyfans.nuxt.dev/api/files/${slug}`}
/>
);
}
8 changes: 4 additions & 4 deletions apps/client/src/app/home/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Feed from "@/components/home/Feed";

export const dynamic = 'force-dynamic';

export default function Page() {
return (

<div className="flex flex-1 flex-col gap-4 p-4 pt-0">
<Feed />
</div>
<div className="flex flex-1 flex-col gap-4 p-4 pt-0">
<Feed />
</div>
);
}
2 changes: 2 additions & 0 deletions apps/client/src/app/home/upload/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { UploadForm } from "@/components/upload/upload-form";

export const dynamic = 'force-dynamic';

export default function UploadPage() {
return (
<div className="container max-w-2xl mx-auto py-10">
Expand Down
10 changes: 5 additions & 5 deletions apps/client/src/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
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",
Expand Down
34 changes: 21 additions & 13 deletions apps/client/src/components/home/videoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -37,34 +38,41 @@ const GalleryCard = ({ video }: { video: Video }) => {
const [isHovering, setIsHovering] = useState(false);
const videoRef = useRef<HTMLVideoElement>(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 (
<Card className="group hover:shadow-lg transition-all duration-300 h-full rounded-md">
<Card className="group hover:shadow-lg transition-all duration-300 h-full rounded-md cursor-pointer" onClick={handleClick}>
<CardContent className="p-3 space-y-3 flex flex-col h-full">
{/* Video Preview Section */}
<div
className="aspect-video bg-gray-100 rounded-lg overflow-hidden flex-shrink-0"
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
>
{isHovering ? (
{/* Temporarily commented out hover play functionality */}
{false && isHovering ? (
<video
ref={videoRef}
poster="true"
Expand Down
Loading
Loading