address changes
This commit is contained in:
parent
73cd647486
commit
46cc1a635f
4 changed files with 26 additions and 14 deletions
|
@ -954,7 +954,7 @@ const getServerInfo = async (args: ServerInfoArgs): Promise<ServerInfo> => {
|
||||||
const res = await jfApiClient(apiClientProps).getServerInfo();
|
const res = await jfApiClient(apiClientProps).getServerInfo();
|
||||||
|
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
throw new Error('Failed to get song detail');
|
throw new Error('Failed to get server info');
|
||||||
}
|
}
|
||||||
|
|
||||||
return { id: apiClientProps.server?.id, version: res.body.Version };
|
return { id: apiClientProps.server?.id, version: res.body.Version };
|
||||||
|
|
|
@ -411,7 +411,7 @@ export const getStructuredLyrics = async (
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
throw new Error('Failed to get server extensions');
|
throw new Error('Failed to get structured lyrics');
|
||||||
}
|
}
|
||||||
|
|
||||||
const lyrics = res.body.lyricsList?.structuredLyrics;
|
const lyrics = res.body.lyricsList?.structuredLyrics;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Box, Group } from '@mantine/core';
|
import { Box, Center, Group, Select, SelectItem } from '@mantine/core';
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { RiAddFill, RiSubtractFill } from 'react-icons/ri';
|
import { RiAddFill, RiSubtractFill } from 'react-icons/ri';
|
||||||
|
@ -13,15 +13,22 @@ import {
|
||||||
} from '/@/renderer/store';
|
} from '/@/renderer/store';
|
||||||
|
|
||||||
interface LyricsActionsProps {
|
interface LyricsActionsProps {
|
||||||
|
index: number;
|
||||||
|
languages: SelectItem[];
|
||||||
|
|
||||||
onRemoveLyric: () => void;
|
onRemoveLyric: () => void;
|
||||||
onResetLyric: () => void;
|
onResetLyric: () => void;
|
||||||
onSearchOverride: (params: LyricsOverride) => void;
|
onSearchOverride: (params: LyricsOverride) => void;
|
||||||
|
setIndex: (idx: number) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LyricsActions = ({
|
export const LyricsActions = ({
|
||||||
|
index,
|
||||||
|
languages,
|
||||||
onRemoveLyric,
|
onRemoveLyric,
|
||||||
onResetLyric,
|
onResetLyric,
|
||||||
onSearchOverride,
|
onSearchOverride,
|
||||||
|
setIndex,
|
||||||
}: LyricsActionsProps) => {
|
}: LyricsActionsProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const currentSong = useCurrentSong();
|
const currentSong = useCurrentSong();
|
||||||
|
@ -42,6 +49,18 @@ export const LyricsActions = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box style={{ position: 'relative', width: '100%' }}>
|
<Box style={{ position: 'relative', width: '100%' }}>
|
||||||
|
{languages.length > 1 && (
|
||||||
|
<Center>
|
||||||
|
<Select
|
||||||
|
clearable={false}
|
||||||
|
data={languages}
|
||||||
|
style={{ bottom: 30, position: 'absolute' }}
|
||||||
|
value={index.toString()}
|
||||||
|
onChange={(value) => setIndex(parseInt(value!, 10))}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
|
||||||
<Group position="center">
|
<Group position="center">
|
||||||
{isDesktop && sources.length ? (
|
{isDesktop && sources.length ? (
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { RiInformationFill } from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { useSongLyricsByRemoteId, useSongLyricsBySong } from './queries/lyric-query';
|
import { useSongLyricsByRemoteId, useSongLyricsBySong } from './queries/lyric-query';
|
||||||
import { SynchronizedLyrics, SynchronizedLyricsProps } from './synchronized-lyrics';
|
import { SynchronizedLyrics, SynchronizedLyricsProps } from './synchronized-lyrics';
|
||||||
import { Select, Spinner, TextTitle } from '/@/renderer/components';
|
import { Spinner, TextTitle } from '/@/renderer/components';
|
||||||
import { ErrorFallback } from '/@/renderer/features/action-required';
|
import { ErrorFallback } from '/@/renderer/features/action-required';
|
||||||
import {
|
import {
|
||||||
UnsynchronizedLyrics,
|
UnsynchronizedLyrics,
|
||||||
|
@ -214,17 +214,10 @@ export const Lyrics = () => {
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
)}
|
)}
|
||||||
<ActionsContainer>
|
<ActionsContainer>
|
||||||
{languages.length > 1 && (
|
|
||||||
<Select
|
|
||||||
clearable={false}
|
|
||||||
data={languages}
|
|
||||||
style={{ bottom: 50, position: 'absolute' }}
|
|
||||||
value={index.toString()}
|
|
||||||
onChange={(value) => setIndex(parseInt(value!, 10))}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<LyricsActions
|
<LyricsActions
|
||||||
|
index={index}
|
||||||
|
languages={languages}
|
||||||
|
setIndex={setIndex}
|
||||||
onRemoveLyric={handleOnRemoveLyric}
|
onRemoveLyric={handleOnRemoveLyric}
|
||||||
onResetLyric={handleOnResetLyric}
|
onResetLyric={handleOnResetLyric}
|
||||||
onSearchOverride={handleOnSearchOverride}
|
onSearchOverride={handleOnSearchOverride}
|
||||||
|
|
Reference in a new issue