mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
Translation Display Normalization (#982)
This commit is contained in:
parent
a2e5f86eac
commit
19c8980784
2 changed files with 21 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import clsx from 'clsx';
|
||||
import isElectron from 'is-electron';
|
||||
import { Fragment, useCallback, useEffect, useRef } from 'react';
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
|
||||
import styles from './synchronized-lyrics.module.css';
|
||||
|
||||
|
|
@ -338,25 +338,18 @@ export const SynchronizedLyrics = ({
|
|||
/>
|
||||
)}
|
||||
{lyrics.map(([time, text], idx) => (
|
||||
<Fragment key={idx}>
|
||||
<LyricLine
|
||||
alignment={settings.alignment}
|
||||
className="lyric-line synchronized"
|
||||
fontSize={settings.fontSize}
|
||||
id={`lyric-${idx}`}
|
||||
onClick={() => handleSeek(time / 1000)}
|
||||
text={text}
|
||||
/>
|
||||
{translatedLyrics && (
|
||||
<LyricLine
|
||||
alignment={settings.alignment}
|
||||
className="lyric-line synchronized translation"
|
||||
fontSize={settings.fontSize * 0.8}
|
||||
onClick={() => handleSeek(time / 1000)}
|
||||
text={translatedLyrics.split('\n')[idx]}
|
||||
/>
|
||||
)}
|
||||
</Fragment>
|
||||
<LyricLine
|
||||
alignment={settings.alignment}
|
||||
className="lyric-line synchronized"
|
||||
fontSize={settings.fontSize}
|
||||
id={`lyric-${idx}`}
|
||||
key={idx}
|
||||
onClick={() => handleSeek(time / 1000)}
|
||||
text={
|
||||
text +
|
||||
(translatedLyrics ? `_BREAK_${translatedLyrics.split('\n')[idx]}` : '')
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -50,23 +50,14 @@ export const UnsynchronizedLyrics = ({
|
|||
/>
|
||||
)}
|
||||
{lines.map((text, idx) => (
|
||||
<div key={idx}>
|
||||
<LyricLine
|
||||
alignment={settings.alignment}
|
||||
className="lyric-line unsynchronized"
|
||||
fontSize={settings.fontSizeUnsync}
|
||||
id={`lyric-${idx}`}
|
||||
text={text}
|
||||
/>
|
||||
{translatedLines[idx] && (
|
||||
<LyricLine
|
||||
alignment={settings.alignment}
|
||||
className="lyric-line unsynchronized translation"
|
||||
fontSize={settings.fontSizeUnsync * 0.8}
|
||||
text={translatedLines[idx]}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<LyricLine
|
||||
alignment={settings.alignment}
|
||||
className="lyric-line unsynchronized"
|
||||
fontSize={settings.fontSizeUnsync}
|
||||
id={`lyric-${idx}`}
|
||||
key={idx}
|
||||
text={text + (translatedLines[idx] ? `_BREAK_${translatedLines[idx]}` : '')}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue