import { useMemo } from 'react'; import styles from './unsynchronized-lyrics.module.css'; import { LyricLine } from '/@/renderer/features/lyrics/lyric-line'; import { useLyricsSettings } from '/@/renderer/store'; import { FullLyricsMetadata } from '/@/shared/types/domain-types'; export interface UnsynchronizedLyricsProps extends Omit { lyrics: string; translatedLyrics?: null | string; } export const UnsynchronizedLyrics = ({ artist, lyrics, name, remote, source, translatedLyrics, }: UnsynchronizedLyricsProps) => { const settings = useLyricsSettings(); const lines = useMemo(() => { return lyrics.split('\n'); }, [lyrics]); const translatedLines = useMemo(() => { return translatedLyrics ? translatedLyrics.split('\n') : []; }, [translatedLyrics]); return (
{settings.showProvider && source && ( )} {settings.showMatch && remote && ( )} {lines.map((text, idx) => (
{translatedLines[idx] && ( )}
))}
); };