diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 03e1fa6..45c810c 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -5,6 +5,7 @@ import ClipUpload from './pages/ClipUpload'; import ClipEdit from './pages/ClipEdit'; import Home from './pages/Home'; import {useEffect} from "react"; +import MyClips from './pages/MyClips'; function App() { @@ -19,6 +20,7 @@ function App() { } /> } /> } /> + } /> diff --git a/frontend/src/components/video/Playbar.tsx b/frontend/src/components/video/Playbar.tsx index f0ea19c..2dd68d6 100644 --- a/frontend/src/components/video/Playbar.tsx +++ b/frontend/src/components/video/Playbar.tsx @@ -2,6 +2,7 @@ import { useEffect, useState} from "react"; import { Volume1, Volume2, VolumeX, Play, Pause } from 'lucide-react'; import clsx from 'clsx'; import type { VideoMetadata } from "../../utils/types.ts"; +import { formatTime } from "../../utils/utils.ts"; type Props = { @@ -10,20 +11,6 @@ type Props = { className?: string; }; -function formatTime(seconds: number): string { - const h = Math.floor(seconds / 3600); - const m = Math.floor((seconds % 3600) / 60); - const s = Math.floor(seconds % 60); - - const padded = (n: number) => n.toString().padStart(2, '0'); - - if (h > 0) { - return `${h}:${padded(m)}:${padded(s)}`; - } else { - return `${m}:${padded(s)}`; - } -} - export default function Playbar({ video, videoMetadata, className }: Props) { const [isPlaying, setIsPlaying] = useState(false); const [volume, setVolume] = useState(100); diff --git a/frontend/src/components/video/VideoCard.tsx b/frontend/src/components/video/VideoCard.tsx new file mode 100644 index 0000000..cd2bf2f --- /dev/null +++ b/frontend/src/components/video/VideoCard.tsx @@ -0,0 +1,36 @@ +import clsx from "clsx"; +import { formatTime } from "../../utils/utils.ts"; +import {Link} from "react-router-dom"; + +type VideoCardProps = { + title: string, + length: number, + thumbnailUrl: string, + videoUrl: string, + className?: string +} + +const VideoCard = ({ + title, + length, + thumbnailUrl, + videoUrl, + className}: VideoCardProps) => { + return ( + +
+ Video Thumbnail + +
+

{title}

+

{formatTime(length)}

+
+ +
+ + ); +} + +export default VideoCard; \ No newline at end of file diff --git a/frontend/src/pages/MyClips.tsx b/frontend/src/pages/MyClips.tsx index e69de29..ecedbb3 100644 --- a/frontend/src/pages/MyClips.tsx +++ b/frontend/src/pages/MyClips.tsx @@ -0,0 +1,19 @@ +import VideoCard from "../components/video/VideoCard"; + +const MyClips = () => { + return ( +
+ + + +
+ ); +} + +export default MyClips; diff --git a/frontend/src/utils/utils.ts b/frontend/src/utils/utils.ts new file mode 100644 index 0000000..5a56bf7 --- /dev/null +++ b/frontend/src/utils/utils.ts @@ -0,0 +1,17 @@ +function formatTime(seconds: number): string { + const h = Math.floor(seconds / 3600); + const m = Math.floor((seconds % 3600) / 60); + const s = Math.floor(seconds % 60); + + const padded = (n: number) => n.toString().padStart(2, '0'); + + if (h > 0) { + return `${h}:${padded(m)}:${padded(s)}`; + } else { + return `${m}:${padded(s)}`; + } +} + +export { + formatTime +} \ No newline at end of file