Add remaining lyric actions functionality

This commit is contained in:
jeffvli 2023-06-09 03:53:49 -07:00 committed by Jeff
parent aaa1b5f63a
commit e56350c1c2
5 changed files with 60 additions and 99 deletions

View file

@ -12,7 +12,6 @@ import isElectron from 'is-electron';
import { PlayersRef } from '/@/renderer/features/player/ref/players-ref';
import { FullLyricsMetadata, SynchronizedLyricsArray } from '/@/renderer/api/types';
import styled from 'styled-components';
import { LyricSkip } from '/@/renderer/features/lyrics/lyric-skip';
const mpvPlayer = isElectron() ? window.electron.mpvPlayer : null;
@ -22,14 +21,12 @@ const SynchronizedLyricsContainer = styled.div`
interface SynchronizedLyricsProps extends Omit<FullLyricsMetadata, 'lyrics'> {
lyrics: SynchronizedLyricsArray;
onRemoveLyric: () => void;
}
export const SynchronizedLyrics = ({
artist,
lyrics,
name,
onRemoveLyric,
remote,
source,
}: SynchronizedLyricsProps) => {
@ -146,16 +143,6 @@ export const SynchronizedLyrics = ({
}
}, []);
const removeLyric = useCallback(() => {
onRemoveLyric();
if (lyricTimer.current) {
clearTimeout(lyricTimer.current);
}
timerEpoch.current += 1;
}, [onRemoveLyric]);
useEffect(() => {
// Copy the follow settings into a ref that can be accessed in the timeout
followRef.current = settings.follow;
@ -276,13 +263,10 @@ export const SynchronizedLyrics = ({
/>
)}
{remote && (
<>
<LyricLine
className="lyric-credit"
text={`(Matched as ${artist} by ${name})`}
/>
<LyricSkip onClick={removeLyric} />
</>
<LyricLine
className="lyric-credit"
text={`(Matched as ${artist} by ${name})`}
/>
)}
{lyrics.map(([, text], idx) => (
<LyricLine