restructure files onto electron-vite boilerplate

This commit is contained in:
jeffvli
2025-05-18 14:03:18 -07:00
parent 91ce2cd8a1
commit 1cf587bc8f
457 changed files with 9927 additions and 11705 deletions
@@ -1,23 +1,24 @@
import { UseQueryResult, useQuery, useQueryClient } from '@tanstack/react-query';
import { useQuery, useQueryClient, UseQueryResult } from '@tanstack/react-query';
import isElectron from 'is-electron';
import { api } from '/@/renderer/api';
import { ServerFeature } from '/@/renderer/api/features-types';
import { queryKeys } from '/@/renderer/api/query-keys';
import {
FullLyricsMetadata,
InternetProviderLyricResponse,
LyricGetQuery,
LyricsQuery,
QueueSong,
SynchronizedLyricsArray,
InternetProviderLyricResponse,
FullLyricsMetadata,
LyricGetQuery,
StructuredLyric,
ServerType,
StructuredLyric,
SynchronizedLyricsArray,
} from '/@/renderer/api/types';
import { hasFeature } from '/@/renderer/api/utils';
import { QueryHookArgs } from '/@/renderer/lib/react-query';
import { getServerById, useLyricsSettings } from '/@/renderer/store';
import { queryKeys } from '/@/renderer/api/query-keys';
import { api } from '/@/renderer/api';
import isElectron from 'is-electron';
import { hasFeature } from '/@/renderer/api/utils';
import { ServerFeature } from '/@/renderer/api/features-types';
const lyricsIpc = isElectron() ? window.electron.lyrics : null;
const lyricsIpc = isElectron() ? window.api.lyrics : null;
// Match LRC lyrics format by https://github.com/ustbhuangyi/lyric-parser
// [mm:ss.SSS] text
@@ -62,7 +63,7 @@ const formatLyrics = (lyrics: string) => {
export const useServerLyrics = (
args: QueryHookArgs<LyricsQuery>,
): UseQueryResult<string | null> => {
): UseQueryResult<null | string> => {
const { query, serverId } = args;
const server = getServerById(serverId);
@@ -92,7 +93,7 @@ export const useSongLyricsBySong = (
cacheTime: Infinity,
enabled: !!song && !!server,
onError: () => {},
queryFn: async ({ signal }): Promise<FullLyricsMetadata | StructuredLyric[] | null> => {
queryFn: async ({ signal }): Promise<FullLyricsMetadata | null | StructuredLyric[]> => {
if (!server) throw new Error('Server not found');
if (!song) return null;
@@ -156,7 +157,7 @@ export const useSongLyricsBySong = (
export const useSongLyricsByRemoteId = (
args: QueryHookArgs<Partial<LyricGetQuery>>,
): UseQueryResult<string | null> => {
): UseQueryResult<null | string> => {
const queryClient = useQueryClient();
const { query, serverId } = args;