diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 3dd46ba..5ffc1d3 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -6,8 +6,11 @@ import ClipEdit from './pages/ClipEdit'; import Home from './pages/Home'; import {useEffect} from "react"; import MyClips from './pages/MyClips'; +import MyVods from './pages/MyVods'; import VideoPlayer from "./pages/VideoPlayer.tsx"; +import VodPlayer from "./pages/VodPlayer.tsx"; import EditClip from "./pages/EditClip.tsx"; +import EditVod from "./pages/EditVod.tsx"; import Profile from "./pages/Profile.tsx"; import { GoogleOAuthProvider } from '@react-oauth/google'; @@ -26,8 +29,11 @@ function App() { } /> } /> } /> + } /> } /> + } /> } /> + } /> } /> diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index ca409d6..bd3ecd2 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -1,6 +1,6 @@ import clsx from "clsx"; import SidebarButton from "./buttons/SidebarButton.tsx"; -import { Plus, Film, Home, User as UserIcon } from 'lucide-react'; +import { Plus, Film, Home, User as UserIcon, Video } from 'lucide-react'; import type {User} from "../utils/types.ts"; type props = { @@ -31,6 +31,7 @@ const Sidebar = ({user, className}: props) => {
} label="Clips" /> + } label="VoDs" />
)} diff --git a/frontend/src/components/video/VideoCard.tsx b/frontend/src/components/video/VideoCard.tsx index 084aafc..1561ceb 100644 --- a/frontend/src/components/video/VideoCard.tsx +++ b/frontend/src/components/video/VideoCard.tsx @@ -13,17 +13,21 @@ type VideoCardProps = { onEdit?: () => void, onDelete?: () => void, className?: string, + mediaApiPath?: string, + playerPath?: string, + itemLabel?: string, } const fallbackThumbnail = "../../../public/default_thumbnail.png"; const API_URL = import.meta.env.VITE_API_URL; -const VideoCard = ({ id, title, duration, createdAt, onEdit, onDelete, className }: VideoCardProps) => { +const VideoCard = ({ id, title, duration, createdAt, onEdit, onDelete, className, mediaApiPath = '/api/v1/clips', playerPath = '/video', itemLabel = 'clip' }: VideoCardProps) => { const [timeAgo, setTimeAgo] = useState(dateToTimeAgo(stringToDate(createdAt))); const [thumbnailAvailable, setThumbnailAvailable] = useState(true); const [menuOpen, setMenuOpen] = useState(false); const [confirmDelete, setConfirmDelete] = useState(false); const menuRef = useRef(null); + const thumbnailUrl = `${API_URL}${mediaApiPath}/${id}/thumbnail`; useEffect(() => { const interval = setInterval(() => { @@ -33,10 +37,10 @@ const VideoCard = ({ id, title, duration, createdAt, onEdit, onDelete, className }, [createdAt]); useEffect(() => { - isThumbnailAvailable(id) + isThumbnailAvailable(thumbnailUrl) .then(setThumbnailAvailable) .catch(() => setThumbnailAvailable(false)); - }, []); + }, [thumbnailUrl]); useEffect(() => { if (!menuOpen) return; @@ -57,11 +61,11 @@ const VideoCard = ({ id, title, duration, createdAt, onEdit, onDelete, className }; return ( - +
Video Thumbnail @@ -105,7 +109,7 @@ const VideoCard = ({ id, title, duration, createdAt, onEdit, onDelete, className )} {confirmDelete && (
-

Delete this clip?

+

Delete this {itemLabel}?