Skip to content

Commit

Permalink
Revert All Romaji Related
Browse files Browse the repository at this point in the history
  • Loading branch information
ENDlezZenith committed Sep 20, 2024
1 parent b50f07d commit 9983a92
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 168 deletions.
1 change: 0 additions & 1 deletion .erb/configs/webpack.config.renderer.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ const configuration: webpack.Configuration = {
publicPath: '/',
},
historyApiFallback: {
disableDotRule: true,
verbose: true,
},
setupMiddlewares(middlewares) {
Expand Down
101 changes: 0 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@
"@mantine/modals": "^6.0.17",
"@mantine/notifications": "^6.0.17",
"@mantine/utils": "^6.0.17",
"@sglkc/kuroshiro": "^1.0.1",
"@sglkc/kuroshiro-analyzer-kuromoji": "^1.0.1",
"@tanstack/react-query": "^4.32.1",
"@tanstack/react-query-devtools": "^4.32.1",
"@tanstack/react-query-persist-client": "^4.32.1",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"resetToDefault": "reset to default",
"restartRequired": "restart required",
"right": "right",
"romaji": "romaji",
"save": "save",
"saveAndReplace": "save and replace",
"saveAs": "save as",
Expand Down
15 changes: 0 additions & 15 deletions src/renderer/features/lyrics/lyrics-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface LyricsActionsProps {

onRemoveLyric: () => void;
onResetLyric: () => void;
onRomanizeLyric: () => void;
onSearchOverride: (params: LyricsOverride) => void;
onTranslateLyric: () => void;
setIndex: (idx: number) => void;
Expand All @@ -29,7 +28,6 @@ export const LyricsActions = ({
languages,
onRemoveLyric,
onResetLyric,
onRomanizeLyric,
onSearchOverride,
onTranslateLyric,
setIndex,
Expand Down Expand Up @@ -145,19 +143,6 @@ export const LyricsActions = ({
</Button>
) : null}
</Box>

<Box style={{ position: 'absolute', right: 0, top: -100 }}>
{isDesktop && sources.length ? (
<Button
uppercase
disabled={isActionsDisabled}
variant="subtle"
onClick={onRomanizeLyric}
>
{t('common.romaji', { postProcess: 'sentenceCase' })}
</Button>
) : null}
</Box>
</Box>
);
};
23 changes: 0 additions & 23 deletions src/renderer/features/lyrics/lyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { AnimatePresence, motion } from 'framer-motion';
import { ErrorBoundary } from 'react-error-boundary';
import { RiInformationFill } from 'react-icons/ri';
import styled from 'styled-components';
import Kuroshiro from '@sglkc/kuroshiro';
import KuromojiAnalyzer from '@sglkc/kuroshiro-analyzer-kuromoji';
import axios from 'axios';
import { useSongLyricsByRemoteId, useSongLyricsBySong } from './queries/lyric-query';
import { SynchronizedLyrics, SynchronizedLyricsProps } from './synchronized-lyrics';
Expand Down Expand Up @@ -89,8 +87,6 @@ export const Lyrics = () => {
const currentSong = useCurrentSong();
const lyricsSettings = useLyricsSettings();
const [index, setIndex] = useState(0);
const [romanizedLyrics, setRomanizedLyrics] = useState<string | null>(null);
const [showRomaji, setShowRomaji] = useState<boolean>(false);
const [translatedLyrics, setTranslatedLyrics] = useState<string | null>(null);
const [showTranslation, setShowTranslation] = useState<boolean>(false);

Expand Down Expand Up @@ -144,22 +140,6 @@ export const Lyrics = () => {
);
}, [currentSong?.id, currentSong?.serverId]);

const handleOnRomanizeLyric = useCallback(async () => {
if (romanizedLyrics) {
setShowRomaji(!showRomaji);
return;
}
if (!lyrics) return;
const originalLyrics = Array.isArray(lyrics.lyrics)
? lyrics.lyrics.map(([, line]) => line).join('\n')
: lyrics.lyrics;
const kuroshiro = new Kuroshiro();
await kuroshiro.init(new KuromojiAnalyzer());
const romanizedText = await kuroshiro.convert(originalLyrics, { to: 'romaji' });
setRomanizedLyrics(romanizedText);
setShowRomaji(true);
}, [lyrics, romanizedLyrics, showRomaji]);

const handleOnTranslateLyric = useCallback(async () => {
if (translatedLyrics) {
setShowTranslation(!showTranslation);
Expand Down Expand Up @@ -273,13 +253,11 @@ export const Lyrics = () => {
{synced ? (
<SynchronizedLyrics
{...(lyrics as SynchronizedLyricsProps)}
romanizedLyrics={showRomaji ? romanizedLyrics : null}
translatedLyrics={showTranslation ? translatedLyrics : null}
/>
) : (
<UnsynchronizedLyrics
{...(lyrics as UnsynchronizedLyricsProps)}
romanizedLyrics={showRomaji ? romanizedLyrics : null}
translatedLyrics={showTranslation ? translatedLyrics : null}
/>
)}
Expand All @@ -294,7 +272,6 @@ export const Lyrics = () => {
setIndex={setIndex}
onRemoveLyric={handleOnRemoveLyric}
onResetLyric={handleOnResetLyric}
onRomanizeLyric={handleOnRomanizeLyric}
onSearchOverride={handleOnSearchOverride}
onTranslateLyric={handleOnTranslateLyric}
/>
Expand Down
11 changes: 0 additions & 11 deletions src/renderer/features/lyrics/synchronized-lyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const SynchronizedLyricsContainer = styled.div<{ $gap: number }>`

export interface SynchronizedLyricsProps extends Omit<FullLyricsMetadata, 'lyrics'> {
lyrics: SynchronizedLyricsArray;
romanizedLyrics?: string | null;
translatedLyrics?: string | null;
}

Expand All @@ -65,7 +64,6 @@ export const SynchronizedLyrics = ({
name,
remote,
source,
romanizedLyrics,
translatedLyrics,
}: SynchronizedLyricsProps) => {
const playersRef = PlayersRef;
Expand Down Expand Up @@ -377,15 +375,6 @@ export const SynchronizedLyrics = ({
text={text}
onClick={() => handleSeek(time / 1000)}
/>
{romanizedLyrics && (
<LyricLine
alignment={settings.alignment}
className="lyric-line synchronized romaji"
fontSize={settings.fontSize * 0.8}
text={romanizedLyrics.split('\n')[idx]}
onClick={() => handleSeek(time / 1000)}
/>
)}
{translatedLyrics && (
<LyricLine
alignment={settings.alignment}
Expand Down
14 changes: 0 additions & 14 deletions src/renderer/features/lyrics/unsynchronized-lyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useLyricsSettings } from '/@/renderer/store';

export interface UnsynchronizedLyricsProps extends Omit<FullLyricsMetadata, 'lyrics'> {
lyrics: string;
romanizedLyrics?: string | null;
translatedLyrics?: string | null;
}

Expand Down Expand Up @@ -47,18 +46,13 @@ export const UnsynchronizedLyrics = ({
name,
remote,
source,
romanizedLyrics,
translatedLyrics,
}: UnsynchronizedLyricsProps) => {
const settings = useLyricsSettings();
const lines = useMemo(() => {
return lyrics.split('\n');
}, [lyrics]);

const romanizedLines = useMemo(() => {
return romanizedLyrics ? romanizedLyrics.split('\n') : [];
}, [romanizedLyrics]);

const translatedLines = useMemo(() => {
return translatedLyrics ? translatedLyrics.split('\n') : [];
}, [translatedLyrics]);
Expand Down Expand Up @@ -93,14 +87,6 @@ export const UnsynchronizedLyrics = ({
id={`lyric-${idx}`}
text={text}
/>
{romanizedLines[idx] && (
<LyricLine
alignment={settings.alignment}
className="lyric-line unsynchronized romaji"
fontSize={settings.fontSizeUnsync * 0.8}
text={romanizedLines[idx]}
/>
)}
{translatedLines[idx] && (
<LyricLine
alignment={settings.alignment}
Expand Down

0 comments on commit 9983a92

Please sign in to comment.