import { Avatar, Box, Button, Card, CardBody, Center, Grid, GridItem, Link, Text, VStack, Wrap, WrapItem, } from '@chakra-ui/react'; import { DecryptedAudioFile, ProcessState } from './fileListingSlice'; import { useRef } from 'react'; interface FileRowProps { id: string; file: DecryptedAudioFile; } export function FileRow({ id, file }: FileRowProps) { const isDecrypted = file.state === ProcessState.COMPLETE; const decryptedName = file.fileName.replace(/\.[a-z\d]{3,6}$/, '') + '.' + file.ext; const audioPlayerRef = useRef(null); const togglePlay = () => { const player = audioPlayerRef.current; if (!player) { return; } if (player.paused) { player.play(); } else { player.pause(); } }; return (
{file.metadata.cover && } {!file.metadata.cover && 暂无封面}
{file.metadata.name || file.fileName} {isDecrypted && ( 专辑: {file.metadata.album} 艺术家: {file.metadata.artist} 专辑艺术家: {file.metadata.albumArtist} )} {file.decrypted &&
); }