From 65b749d03fb4fb689568753b8d6d28202e536761 Mon Sep 17 00:00:00 2001 From: Peifan Li Date: Tue, 16 Dec 2025 22:18:38 -0500 Subject: [PATCH] style: Update button styles and add kebab menu for mobile --- .../VideoInfo/VideoActionButtons.tsx | 140 +++++++++++++++++- .../VideoPlayer/VideoInfo/VideoAuthorInfo.tsx | 4 +- .../VideoPlayer/VideoInfo/VideoMetadata.tsx | 70 ++++++--- 3 files changed, 192 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/VideoPlayer/VideoInfo/VideoActionButtons.tsx b/frontend/src/components/VideoPlayer/VideoInfo/VideoActionButtons.tsx index ed2017b..9200a27 100644 --- a/frontend/src/components/VideoPlayer/VideoInfo/VideoActionButtons.tsx +++ b/frontend/src/components/VideoPlayer/VideoInfo/VideoActionButtons.tsx @@ -1,5 +1,5 @@ -import { Add, Cast, Delete, Share } from '@mui/icons-material'; -import { Button, Menu, MenuItem, Stack, Tooltip } from '@mui/material'; +import { Add, Cast, Delete, MoreVert, Share } from '@mui/icons-material'; +import { Button, IconButton, Menu, MenuItem, Stack, Tooltip, useMediaQuery, useTheme } from '@mui/material'; import React, { useState } from 'react'; import { useLanguage } from '../../../contexts/LanguageContext'; import { useSnackbar } from '../../../contexts/SnackbarContext'; @@ -22,7 +22,10 @@ const VideoActionButtons: React.FC = ({ const { t } = useLanguage(); const { handleShare } = useShareVideo(video); const { showSnackbar } = useSnackbar(); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('md')); const [playerMenuAnchor, setPlayerMenuAnchor] = useState(null); + const [kebabMenuAnchor, setKebabMenuAnchor] = useState(null); const getVideoUrl = (): string => { if (video.videoPath) { @@ -44,6 +47,14 @@ const VideoActionButtons: React.FC = ({ setPlayerMenuAnchor(null); }; + const handleKebabMenuOpen = (event: React.MouseEvent) => { + setKebabMenuAnchor(event.currentTarget); + }; + + const handleKebabMenuClose = () => { + setKebabMenuAnchor(null); + }; + const handlePlayerSelect = (player: string) => { const videoUrl = getVideoUrl(); @@ -122,7 +133,7 @@ const VideoActionButtons: React.FC = ({ handlePlayerMenuClose(); }; - return ( + const actionButtons = ( + + + + + + + + + + + + + + handlePlayerSelect('vlc')}>VLC + handlePlayerSelect('iina')}>IINA + handlePlayerSelect('mpv')}>mpv + handlePlayerSelect('potplayer')}>PotPlayer + handlePlayerSelect('infuse')}>Infuse + handlePlayerSelect('copy')}>{t('copyUrl')} + + + ); + } + + return actionButtons; }; export default VideoActionButtons; diff --git a/frontend/src/components/VideoPlayer/VideoInfo/VideoAuthorInfo.tsx b/frontend/src/components/VideoPlayer/VideoInfo/VideoAuthorInfo.tsx index 9bb0eb4..acf5a09 100644 --- a/frontend/src/components/VideoPlayer/VideoInfo/VideoAuthorInfo.tsx +++ b/frontend/src/components/VideoPlayer/VideoInfo/VideoAuthorInfo.tsx @@ -68,7 +68,7 @@ const VideoAuthorInfo: React.FC = ({ sx={{ cursor: 'pointer', '&:hover': { color: 'primary.main' }, - maxWidth: { xs: '180px', sm: 'none' }, + maxWidth: { xs: '200px', sm: 'none' }, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' @@ -86,7 +86,7 @@ const VideoAuthorInfo: React.FC = ({ size="small" onClick={handleSubscribeClick} color={isSubscribed ? 'primary' : 'default'} - sx={{ ml: { xs: 0, sm: 1 } }} + sx={{ ml: { xs: 1, sm: 1 } }} > {isSubscribed ? : } diff --git a/frontend/src/components/VideoPlayer/VideoInfo/VideoMetadata.tsx b/frontend/src/components/VideoPlayer/VideoInfo/VideoMetadata.tsx index 4e680f8..2189c86 100644 --- a/frontend/src/components/VideoPlayer/VideoInfo/VideoMetadata.tsx +++ b/frontend/src/components/VideoPlayer/VideoInfo/VideoMetadata.tsx @@ -26,57 +26,93 @@ const VideoMetadata: React.FC = ({ {video.sourceUrl && ( - + - + {t('originalLink')} )} {video.videoPath && ( - + - + {t('download')} )} {videoCollections.length > 0 && ( - + {videoCollections.map((c, index) => ( - onCollectionClick(c.id)} - style={{ + sx={{ cursor: 'pointer', - color: theme.palette.primary.main, + color: 'primary.main', fontWeight: 'bold', display: 'inline-flex', alignItems: 'center', - verticalAlign: 'bottom' + fontSize: { xs: '0.75rem', sm: '0.875rem' } }} > - + {c.name} - + {index < videoCollections.length - 1 ? , : ''} ))} )} - - + + {video.source ? video.source.charAt(0).toUpperCase() + video.source.slice(1) : 'Unknown'} {video.addedAt && ( - - + + {new Date(video.addedAt).toISOString().split('T')[0]} )} {videoResolution && ( - - + + {videoResolution && `${videoResolution}`} )}