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
11 changes: 11 additions & 0 deletions frontend/app/components/videos/Card.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
position: relative;
}

.selectionCheckboxInline {
display: flex;
align-items: center;
margin-left: var(--mantine-spacing-xs);
opacity: 0.75;
}

.selectionCheckboxInline:hover {
opacity: 1;
}

.videoImage {
pointer-events: none;
cursor: default;
Expand Down
30 changes: 26 additions & 4 deletions frontend/app/components/videos/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Video } from "@/app/hooks/useVideos";
import { Badge, Card, Image, Progress, Tooltip, Text, Title, Group, Center, Avatar, Flex, ThemeIcon, LoadingOverlay, Loader, Box } from "@mantine/core";
import { Badge, Card, Image, Progress, Tooltip, Text, Title, Group, Center, Avatar, Flex, ThemeIcon, LoadingOverlay, Loader, Box, Checkbox } from "@mantine/core";
import Link from "next/link";
import { useEffect, useState } from "react";
import dayjs from "dayjs";
Expand All @@ -26,9 +26,21 @@ type Props = {
showMenu: boolean;
showChannel: boolean;
showViewCount?: boolean;
selectable?: boolean;
selected?: boolean;
onSelectionChange?: (selected: boolean) => void;
}

const VideoCard = ({ video, showProgress = true, showMenu = true, showChannel = true, showViewCount = true }: Props) => {
const VideoCard = ({
video,
showProgress = true,
showMenu = true,
showChannel = true,
showViewCount = true,
selectable = false,
selected = false,
onSelectionChange = () => { },
}: Props) => {
const t = useTranslations('VideoComponents')
const { isLoggedIn, hasPermission } = useAuthStore()
const [thumbnailError, setThumbnailError] = useState(false);
Expand Down Expand Up @@ -62,7 +74,6 @@ const VideoCard = ({ video, showProgress = true, showMenu = true, showChannel =
<Link href={`/videos/${video.id}`}>
<Card.Section>
<div className={classes.videoImageWrapper}>

{video.processing && (
<LoadingOverlay visible zIndex={5} overlayProps={{ radius: "sm", blur: 1 }} loaderProps={{
children: <div><Text size="xl">{t('processingOverlayText')}</Text>
Expand Down Expand Up @@ -208,6 +219,17 @@ const VideoCard = ({ video, showProgress = true, showMenu = true, showChannel =
{video.type.toUpperCase()}
</Badge>

{selectable && (
<Box pr={4} className={classes.selectionCheckboxInline}>
<Checkbox
checked={selected}
onChange={(event) => onSelectionChange(event.currentTarget.checked)}
aria-label={t('selectVideoCheckboxLabel')}
size="sm"
/>
</Box>
)}

{(showMenu && hasPermission(UserRole.Archiver)) && (
<VideoMenu video={video} />
)}
Expand All @@ -218,4 +240,4 @@ const VideoCard = ({ video, showProgress = true, showMenu = true, showChannel =
);
}

export default VideoCard;
export default VideoCard;
9 changes: 7 additions & 2 deletions frontend/app/components/videos/ChannelVideos.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// ChannelVideos.tsx
import { useState } from "react";
import { Channel } from "@/app/hooks/useChannels";
import { useFetchVideosFilter, VideoOrder, VideoSortBy, VideoType } from "@/app/hooks/useVideos";
import {
useFetchVideosFilter,
VideoOrder,
VideoSortBy,
VideoType,
} from "@/app/hooks/useVideos";
import useSettingsStore from "@/app/store/useSettingsStore";
import VideoGrid from "./Grid";
import GanymedeLoadingText from "../utils/GanymedeLoadingText";
Expand Down Expand Up @@ -58,4 +63,4 @@ const ChannelVideos = ({ channel }: Props) => {
);
};

export default ChannelVideos;
export default ChannelVideos;
Loading
Loading