style: Remove unused imports and variables
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { Add, Delete, PlayArrow, Share } from '@mui/icons-material';
|
||||
import { Button, Divider, ListItemText, Menu, MenuItem, Stack, Tooltip, Typography } from '@mui/material';
|
||||
import React, { useState } from 'react';
|
||||
import { Add, Delete, Share } from '@mui/icons-material';
|
||||
import { Button, Stack, Tooltip } from '@mui/material';
|
||||
import React from 'react';
|
||||
import { useLanguage } from '../../../contexts/LanguageContext';
|
||||
import { useShareVideo } from '../../../hooks/useShareVideo';
|
||||
import { Video } from '../../../types';
|
||||
|
||||
const BACKEND_URL = import.meta.env.VITE_BACKEND_URL;
|
||||
|
||||
|
||||
interface VideoActionButtonsProps {
|
||||
video: Video;
|
||||
@@ -22,83 +22,11 @@ const VideoActionButtons: React.FC<VideoActionButtonsProps> = ({
|
||||
}) => {
|
||||
const { t } = useLanguage();
|
||||
const { handleShare } = useShareVideo(video);
|
||||
const [playerMenuAnchor, setPlayerMenuAnchor] = useState<null | HTMLElement>(null);
|
||||
|
||||
const handleOpenPlayerMenu = (event: React.MouseEvent<HTMLElement>) => {
|
||||
setPlayerMenuAnchor(event.currentTarget);
|
||||
};
|
||||
|
||||
const handleClosePlayerMenu = () => {
|
||||
setPlayerMenuAnchor(null);
|
||||
};
|
||||
|
||||
const handlePlayInPlayer = (scheme: string) => {
|
||||
const videoUrl = `${BACKEND_URL}${video.videoPath || video.sourceUrl}`;
|
||||
let url = '';
|
||||
|
||||
switch (scheme) {
|
||||
case 'iina':
|
||||
url = `iina://weblink?url=${videoUrl}`;
|
||||
break;
|
||||
case 'vlc':
|
||||
url = `vlc://${videoUrl}`;
|
||||
break;
|
||||
case 'potplayer':
|
||||
url = `potplayer://${videoUrl}`;
|
||||
break;
|
||||
case 'mpv':
|
||||
url = `mpv://${videoUrl}`;
|
||||
break;
|
||||
case 'infuse':
|
||||
url = `infuse://x-callback-url/play?url=${videoUrl}`;
|
||||
break;
|
||||
}
|
||||
|
||||
if (url) {
|
||||
window.location.href = url;
|
||||
}
|
||||
handleClosePlayerMenu();
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack direction="row" spacing={1}>
|
||||
<Tooltip title={t('openInExternalPlayer')}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="inherit"
|
||||
onClick={handleOpenPlayerMenu}
|
||||
sx={{ minWidth: 'auto', p: 1, color: 'text.secondary', borderColor: 'text.secondary', '&:hover': { color: 'primary.main', borderColor: 'primary.main' } }}
|
||||
>
|
||||
<PlayArrow />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Menu
|
||||
anchorEl={playerMenuAnchor}
|
||||
open={Boolean(playerMenuAnchor)}
|
||||
onClose={handleClosePlayerMenu}
|
||||
>
|
||||
<MenuItem disabled>
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
{t('playWith')}
|
||||
</Typography>
|
||||
</MenuItem>
|
||||
<Divider />
|
||||
<MenuItem onClick={() => handlePlayInPlayer('iina')}>
|
||||
<ListItemText>IINA</ListItemText>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => handlePlayInPlayer('vlc')}>
|
||||
<ListItemText>VLC</ListItemText>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => handlePlayInPlayer('potplayer')}>
|
||||
<ListItemText>PotPlayer</ListItemText>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => handlePlayInPlayer('mpv')}>
|
||||
<ListItemText>MPV</ListItemText>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => handlePlayInPlayer('infuse')}>
|
||||
<ListItemText>Infuse</ListItemText>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<Tooltip title={t('share')}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
|
||||
@@ -50,7 +50,7 @@ const Home: React.FC = () => {
|
||||
|
||||
const [viewMode, setViewMode] = useState<'collections' | 'all-videos' | 'history'>(() => {
|
||||
const saved = localStorage.getItem('homeViewMode');
|
||||
return (saved as 'collections' | 'all-videos' | 'history') || 'collections';
|
||||
return (saved as 'collections' | 'all-videos' | 'history') || 'all-videos';
|
||||
});
|
||||
|
||||
// Initialize sort option from URL or default
|
||||
|
||||
Reference in New Issue
Block a user