mirror of
https://github.com/antebudimir/feishin.git
synced 2026-03-01 11:47:26 +00:00
fix all imports for new structure
This commit is contained in:
parent
249eaf89f8
commit
930165d006
291 changed files with 2056 additions and 1894 deletions
|
|
@ -47,7 +47,7 @@ deb:
|
||||||
- libkrb5support.so.0
|
- libkrb5support.so.0
|
||||||
- libkeyutils.so.1
|
- libkeyutils.so.1
|
||||||
- libcups.so.2
|
- libcups.so.2
|
||||||
rpm:
|
rpm:
|
||||||
depends:
|
depends:
|
||||||
- libgssapi_krb5.so.2
|
- libgssapi_krb5.so.2
|
||||||
- libavahi-common.so.3
|
- libavahi-common.so.3
|
||||||
|
|
@ -56,7 +56,7 @@ deb:
|
||||||
- libkrb5support.so.0
|
- libkrb5support.so.0
|
||||||
- libkeyutils.so.1
|
- libkeyutils.so.1
|
||||||
- libcups.so.2
|
- libcups.so.2
|
||||||
freebsd:
|
freebsd:
|
||||||
depends:
|
depends:
|
||||||
- libgssapi_krb5.so.2
|
- libgssapi_krb5.so.2
|
||||||
- libavahi-common.so.3
|
- libavahi-common.so.3
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,41 @@
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { externalizeDepsPlugin, UserConfig } from 'electron-vite';
|
import { externalizeDepsPlugin, UserConfig } from 'electron-vite';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
|
import conditionalImportPlugin from 'vite-plugin-conditional-import';
|
||||||
|
import dynamicImportPlugin from 'vite-plugin-dynamic-import';
|
||||||
|
|
||||||
|
const currentOSEnv = process.platform;
|
||||||
|
|
||||||
const config: UserConfig = {
|
const config: UserConfig = {
|
||||||
main: {
|
main: {
|
||||||
plugins: [externalizeDepsPlugin()],
|
define: {
|
||||||
|
'import.meta.env.IS_LINUX': JSON.stringify(currentOSEnv === 'linux'),
|
||||||
|
'import.meta.env.IS_MACOS': JSON.stringify(currentOSEnv === 'darwin'),
|
||||||
|
'import.meta.env.IS_WIN': JSON.stringify(currentOSEnv === 'win32'),
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
externalizeDepsPlugin(),
|
||||||
|
dynamicImportPlugin(),
|
||||||
|
conditionalImportPlugin({
|
||||||
|
currentEnv: currentOSEnv,
|
||||||
|
envs: ['win32', 'linux', 'darwin'],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'/@/main': resolve('src/main'),
|
||||||
|
'/@/shared': resolve('src/shared'),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
preload: {
|
preload: {
|
||||||
plugins: [externalizeDepsPlugin()],
|
plugins: [externalizeDepsPlugin()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'/@/preload': resolve('src/preload'),
|
||||||
|
'/@/shared': resolve('src/shared'),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
renderer: {
|
renderer: {
|
||||||
css: {
|
css: {
|
||||||
|
|
@ -20,12 +48,8 @@ const config: UserConfig = {
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'/@/i18n': resolve('src/i18n'),
|
'/@/i18n': resolve('src/i18n'),
|
||||||
'/@/main': resolve('src/main'),
|
'/@/remote': resolve('src/remote'),
|
||||||
'/@/renderer': resolve('src/renderer'),
|
'/@/renderer': resolve('src/renderer'),
|
||||||
'/@/renderer/api': resolve('src/renderer/api'),
|
|
||||||
'/@/renderer/components': resolve('src/renderer/components'),
|
|
||||||
'/@/renderer/features': resolve('src/renderer/features'),
|
|
||||||
'/@/renderer/hooks': resolve('src/renderer/hooks'),
|
|
||||||
'/@/shared': resolve('src/shared'),
|
'/@/shared': resolve('src/shared'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ export default tseslint.config(
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
'no-use-before-define': 'off',
|
'no-use-before-define': 'off',
|
||||||
quotes: ['error', 'single'],
|
quotes: ['error', 'single'],
|
||||||
|
'react-refresh/only-export-components': 'off',
|
||||||
'react/display-name': 'off',
|
'react/display-name': 'off',
|
||||||
semi: ['error', 'always'],
|
semi: ['error', 'always'],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
911
package-lock.json
generated
911
package-lock.json
generated
File diff suppressed because it is too large
Load diff
37
package.json
37
package.json
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "feishin",
|
"name": "feishin",
|
||||||
"productName": "Feishin",
|
"productName": "Feishin",
|
||||||
"version": "0.12.7",
|
"version": "0.12.7",
|
||||||
"description": "",
|
"description": "A modern self-hosted music player.",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"homepage": "https://github.com/jeffvli/feishin",
|
"homepage": "https://github.com/jeffvli/feishin",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -32,13 +32,13 @@
|
||||||
"@electron-toolkit/preload": "^3.0.1",
|
"@electron-toolkit/preload": "^3.0.1",
|
||||||
"@electron-toolkit/utils": "^4.0.0",
|
"@electron-toolkit/utils": "^4.0.0",
|
||||||
"@emotion/react": "^11.10.4",
|
"@emotion/react": "^11.10.4",
|
||||||
"@mantine/core": "^6.0.17",
|
"@mantine/core": "^6.0.21",
|
||||||
"@mantine/dates": "^6.0.17",
|
"@mantine/dates": "^6.0.21",
|
||||||
"@mantine/form": "^6.0.17",
|
"@mantine/form": "^6.0.21",
|
||||||
"@mantine/hooks": "^6.0.17",
|
"@mantine/hooks": "^6.0.21",
|
||||||
"@mantine/modals": "^6.0.17",
|
"@mantine/modals": "^6.0.21",
|
||||||
"@mantine/notifications": "^6.0.17",
|
"@mantine/notifications": "^6.0.21",
|
||||||
"@mantine/utils": "^6.0.17",
|
"@mantine/utils": "^6.0.21",
|
||||||
"@tanstack/react-query": "^4.32.1",
|
"@tanstack/react-query": "^4.32.1",
|
||||||
"@tanstack/react-query-devtools": "^4.32.1",
|
"@tanstack/react-query-devtools": "^4.32.1",
|
||||||
"@tanstack/react-query-persist-client": "^4.32.1",
|
"@tanstack/react-query-persist-client": "^4.32.1",
|
||||||
|
|
@ -116,6 +116,7 @@
|
||||||
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
||||||
"@types/react-window": "^1.8.5",
|
"@types/react-window": "^1.8.5",
|
||||||
"@types/react-window-infinite-loader": "^1.0.6",
|
"@types/react-window-infinite-loader": "^1.0.6",
|
||||||
|
"@types/source-map-support": "^0.5.10",
|
||||||
"@types/styled-components": "^5.1.26",
|
"@types/styled-components": "^5.1.26",
|
||||||
"@types/terser-webpack-plugin": "^5.0.4",
|
"@types/terser-webpack-plugin": "^5.0.4",
|
||||||
"@types/webpack-bundle-analyzer": "^4.4.1",
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
||||||
|
|
@ -132,7 +133,7 @@
|
||||||
"css-minimizer-webpack-plugin": "^3.4.1",
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
||||||
"detect-port": "^1.3.0",
|
"detect-port": "^1.3.0",
|
||||||
"electron": "^35.1.5",
|
"electron": "^35.1.5",
|
||||||
"electron-builder": "^25.1.8",
|
"electron-builder": "^26.0.12",
|
||||||
"electron-devtools-installer": "^3.2.0",
|
"electron-devtools-installer": "^3.2.0",
|
||||||
"electron-notarize": "^1.2.1",
|
"electron-notarize": "^1.2.1",
|
||||||
"electron-vite": "^3.1.0",
|
"electron-vite": "^3.1.0",
|
||||||
|
|
@ -192,10 +193,28 @@
|
||||||
"typescript-plugin-styled-components": "^3.0.0",
|
"typescript-plugin-styled-components": "^3.0.0",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
"vite": "^6.2.6",
|
"vite": "^6.2.6",
|
||||||
|
"vite-plugin-conditional-import": "^0.1.7",
|
||||||
|
"vite-plugin-dynamic-import": "^1.6.0",
|
||||||
"webpack": "^5.94.0",
|
"webpack": "^5.94.0",
|
||||||
"webpack-bundle-analyzer": "^4.5.0",
|
"webpack-bundle-analyzer": "^4.5.0",
|
||||||
"webpack-cli": "^4.9.2",
|
"webpack-cli": "^4.9.2",
|
||||||
"webpack-dev-server": "^4.8.0",
|
"webpack-dev-server": "^4.8.0",
|
||||||
"webpack-merge": "^5.8.0"
|
"webpack-merge": "^5.8.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"subsonic",
|
||||||
|
"navidrome",
|
||||||
|
"airsonic",
|
||||||
|
"jellyfin",
|
||||||
|
"react",
|
||||||
|
"electron"
|
||||||
|
],
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jeffvli/feishin/issues"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "jeffvli",
|
||||||
|
"url": "https://github.com/jeffvli/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
createOldCatalogs: true,
|
createOldCatalogs: true,
|
||||||
customValueTemplate: null,
|
customValueTemplate: null,
|
||||||
defaultNamespace: 'translation',
|
defaultNamespace: 'translation',
|
||||||
defaultValue: function (locale, namespace, key, value) {
|
defaultValue: function (locale, namespace, key) {
|
||||||
return key;
|
return key;
|
||||||
},
|
},
|
||||||
failOnUpdate: false,
|
failOnUpdate: false,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
|
|
||||||
import { store } from '../settings/index';
|
import { store } from '../settings';
|
||||||
import {
|
import {
|
||||||
getLyricsBySongId as getGenius,
|
getLyricsBySongId as getGenius,
|
||||||
query as queryGenius,
|
query as queryGenius,
|
||||||
|
|
@ -17,6 +17,8 @@ import {
|
||||||
getSearchResults as searchNetease,
|
getSearchResults as searchNetease,
|
||||||
} from './netease';
|
} from './netease';
|
||||||
|
|
||||||
|
import { Song } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
export enum LyricSource {
|
export enum LyricSource {
|
||||||
GENIUS = 'Genius',
|
GENIUS = 'Genius',
|
||||||
LRCLIB = 'lrclib.net',
|
LRCLIB = 'lrclib.net',
|
||||||
|
|
@ -94,10 +96,10 @@ const MAX_CACHED_ITEMS = 10;
|
||||||
|
|
||||||
const lyricCache = new Map<string, CachedLyrics>();
|
const lyricCache = new Map<string, CachedLyrics>();
|
||||||
|
|
||||||
const getRemoteLyrics = async (song: any) => {
|
const getRemoteLyrics = async (song: Song) => {
|
||||||
const sources = store.get('lyrics', []) as LyricSource[];
|
const sources = store.get('lyrics', []) as LyricSource[];
|
||||||
|
|
||||||
const cached = lyricCache.get(song.id);
|
const cached = lyricCache.get(song.id.toString());
|
||||||
|
|
||||||
if (cached) {
|
if (cached) {
|
||||||
for (const source of sources) {
|
for (const source of sources) {
|
||||||
|
|
@ -106,16 +108,16 @@ const getRemoteLyrics = async (song: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let lyricsFromSource = null;
|
let lyricsFromSource: InternetProviderLyricResponse | null = null;
|
||||||
|
|
||||||
for (const source of sources) {
|
for (const source of sources) {
|
||||||
const params = {
|
const params = {
|
||||||
album: song.album || song.name,
|
album: song.album || song.name,
|
||||||
artist: song.artistName,
|
artist: song.artists[0].name,
|
||||||
duration: song.duration / 1000.0,
|
duration: song.duration / 1000.0,
|
||||||
name: song.name,
|
name: song.name,
|
||||||
};
|
};
|
||||||
const response = await FETCHERS[source](params);
|
const response = await FETCHERS[source](params as unknown as LyricSearchQuery);
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
const newResult = cached
|
const newResult = cached
|
||||||
|
|
@ -127,10 +129,12 @@ const getRemoteLyrics = async (song: any) => {
|
||||||
|
|
||||||
if (lyricCache.size === MAX_CACHED_ITEMS && cached === undefined) {
|
if (lyricCache.size === MAX_CACHED_ITEMS && cached === undefined) {
|
||||||
const toRemove = lyricCache.keys().next().value;
|
const toRemove = lyricCache.keys().next().value;
|
||||||
|
if (toRemove) {
|
||||||
lyricCache.delete(toRemove);
|
lyricCache.delete(toRemove);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lyricCache.set(song.id, newResult);
|
lyricCache.set(song.id.toString(), newResult);
|
||||||
|
|
||||||
lyricsFromSource = response;
|
lyricsFromSource = response;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -13,37 +13,6 @@ const LYRICS_URL = 'https://music.163.com/api/song/lyric';
|
||||||
|
|
||||||
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/netease.ts
|
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/netease.ts
|
||||||
|
|
||||||
export interface Album {
|
|
||||||
artist: Artist;
|
|
||||||
copyrightId: number;
|
|
||||||
id: number;
|
|
||||||
mark: number;
|
|
||||||
name: string;
|
|
||||||
picId: number;
|
|
||||||
publishTime: number;
|
|
||||||
size: number;
|
|
||||||
status: number;
|
|
||||||
transNames?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Artist {
|
|
||||||
albumSize: number;
|
|
||||||
alias: any[];
|
|
||||||
fansGroup: null;
|
|
||||||
id: number;
|
|
||||||
img1v1: number;
|
|
||||||
img1v1Url: string;
|
|
||||||
name: string;
|
|
||||||
picId: number;
|
|
||||||
picUrl: null;
|
|
||||||
trans: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface NetEaseResponse {
|
|
||||||
code: number;
|
|
||||||
result: Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Result {
|
export interface Result {
|
||||||
hasMore: boolean;
|
hasMore: boolean;
|
||||||
songCount: number;
|
songCount: number;
|
||||||
|
|
@ -68,6 +37,37 @@ export interface Song {
|
||||||
transNames?: string[];
|
transNames?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Album {
|
||||||
|
artist: Artist;
|
||||||
|
copyrightId: number;
|
||||||
|
id: number;
|
||||||
|
mark: number;
|
||||||
|
name: string;
|
||||||
|
picId: number;
|
||||||
|
publishTime: number;
|
||||||
|
size: number;
|
||||||
|
status: number;
|
||||||
|
transNames?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Artist {
|
||||||
|
albumSize: number;
|
||||||
|
alias: any[];
|
||||||
|
fansGroup: null;
|
||||||
|
id: number;
|
||||||
|
img1v1: number;
|
||||||
|
img1v1Url: string;
|
||||||
|
name: string;
|
||||||
|
picId: number;
|
||||||
|
picUrl: null;
|
||||||
|
trans: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NetEaseResponse {
|
||||||
|
code: number;
|
||||||
|
result: Result;
|
||||||
|
}
|
||||||
|
|
||||||
export async function getLyricsBySongId(songId: string): Promise<null | string> {
|
export async function getLyricsBySongId(songId: string): Promise<null | string> {
|
||||||
let result: AxiosResponse<any, any>;
|
let result: AxiosResponse<any, any>;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import Fuse from 'fuse.js';
|
||||||
import {
|
import {
|
||||||
InternetProviderLyricSearchResponse,
|
InternetProviderLyricSearchResponse,
|
||||||
LyricSearchQuery,
|
LyricSearchQuery,
|
||||||
} from '../../../../renderer/api/types';
|
} from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
export const orderSearchResults = (args: {
|
export const orderSearchResults = (args: {
|
||||||
params: LyricSearchQuery;
|
params: LyricSearchQuery;
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,8 @@ ipcMain.on('player-set-queue', async (_event, current?: string, next?: string, p
|
||||||
if (current) {
|
if (current) {
|
||||||
try {
|
try {
|
||||||
await getMpvInstance()?.load(current, 'replace');
|
await getMpvInstance()?.load(current, 'replace');
|
||||||
} catch (error) {
|
} catch (error: any | NodeMpvError) {
|
||||||
|
mpvLog({ action: `Failed to load current song` }, error);
|
||||||
await getMpvInstance()?.play();
|
await getMpvInstance()?.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable promise/always-return */
|
|
||||||
import { BrowserWindow, globalShortcut, systemPreferences } from 'electron';
|
import { BrowserWindow, globalShortcut, systemPreferences } from 'electron';
|
||||||
|
|
||||||
import { isMacOS } from '../../../utils';
|
import { isMacOS } from '../../../utils';
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,25 @@ import { join } from 'path';
|
||||||
import { WebSocket, WebSocketServer, Server as WsServer } from 'ws';
|
import { WebSocket, WebSocketServer, Server as WsServer } from 'ws';
|
||||||
import { deflate, gzip } from 'zlib';
|
import { deflate, gzip } from 'zlib';
|
||||||
|
|
||||||
import { getMainWindow } from '../../..';
|
|
||||||
import { isLinux } from '../../../utils';
|
|
||||||
import manifest from './manifest.json';
|
import manifest from './manifest.json';
|
||||||
|
|
||||||
|
import { getMainWindow } from '/@/main/index';
|
||||||
|
import { isLinux } from '/@/main/utils';
|
||||||
|
import { QueueSong } from '/@/shared/types/domain-types';
|
||||||
|
import { ClientEvent, ServerEvent } from '/@/shared/types/remote-types';
|
||||||
|
import { PlayerRepeat, PlayerStatus, SongState } from '/@/shared/types/types';
|
||||||
|
|
||||||
let mprisPlayer: any | undefined;
|
let mprisPlayer: any | undefined;
|
||||||
|
|
||||||
if (isLinux()) {
|
async function initMpris() {
|
||||||
mprisPlayer = require('../../linux/mpris').mprisPlayer;
|
if (isLinux()) {
|
||||||
|
const mpris = await import('../../linux/mpris');
|
||||||
|
mprisPlayer = mpris.mprisPlayer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initMpris();
|
||||||
|
|
||||||
interface MimeType {
|
interface MimeType {
|
||||||
css: string;
|
css: string;
|
||||||
html: string;
|
html: string;
|
||||||
|
|
@ -630,8 +639,8 @@ if (mprisPlayer) {
|
||||||
mprisPlayer.on('loopStatus', (event: string) => {
|
mprisPlayer.on('loopStatus', (event: string) => {
|
||||||
const repeat = event === 'Playlist' ? 'all' : event === 'Track' ? 'one' : 'none';
|
const repeat = event === 'Playlist' ? 'all' : event === 'Track' ? 'one' : 'none';
|
||||||
|
|
||||||
currentState.repeat = repeat;
|
currentState.repeat = repeat as PlayerRepeat;
|
||||||
broadcast({ data: repeat, event: 'repeat' });
|
broadcast({ data: repeat, event: 'repeat' } as ServerEvent);
|
||||||
});
|
});
|
||||||
|
|
||||||
mprisPlayer.on('shuffle', (shuffle: boolean) => {
|
mprisPlayer.on('shuffle', (shuffle: boolean) => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { TitleTheme } from '/@/renderer/types';
|
import type { TitleTheme } from '/@/shared/types/types';
|
||||||
|
|
||||||
import { ipcMain, nativeTheme, safeStorage } from 'electron';
|
import { ipcMain, nativeTheme, safeStorage } from 'electron';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import './core';
|
import './core';
|
||||||
|
import(`./${process.platform}`);
|
||||||
// require(`./${process.platform}`)
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
import Player from 'mpris-service';
|
import Player from 'mpris-service';
|
||||||
|
|
||||||
import { PlayerRepeat, PlayerStatus } from '../../../renderer/types';
|
import { getMainWindow } from '/@/main/index';
|
||||||
import { getMainWindow } from '../../main';
|
import { QueueSong } from '/@/shared/types/domain-types';
|
||||||
|
import { PlayerRepeat, PlayerStatus } from '/@/shared/types/types';
|
||||||
import { QueueSong } from '/@/renderer/api/types';
|
|
||||||
|
|
||||||
const mprisPlayer = Player({
|
const mprisPlayer = Player({
|
||||||
identity: 'Feishin',
|
identity: 'Feishin',
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
// Dummy file to satisfy the build system
|
|
||||||
|
|
||||||
export {};
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { electronApp, is, optimizer } from '@electron-toolkit/utils';
|
import { is } from '@electron-toolkit/utils';
|
||||||
import { constants } from 'buffer';
|
|
||||||
import {
|
import {
|
||||||
app,
|
app,
|
||||||
BrowserWindow,
|
BrowserWindow,
|
||||||
|
|
@ -19,7 +18,7 @@ import {
|
||||||
import electronLocalShortcut from 'electron-localshortcut';
|
import electronLocalShortcut from 'electron-localshortcut';
|
||||||
import log from 'electron-log/main';
|
import log from 'electron-log/main';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
import { access, readFile, writeFile } from 'fs';
|
import { access, constants, readFile, writeFile } from 'fs';
|
||||||
import path, { join } from 'path';
|
import path, { join } from 'path';
|
||||||
import { deflate, inflate } from 'zlib';
|
import { deflate, inflate } from 'zlib';
|
||||||
|
|
||||||
|
|
@ -36,6 +35,8 @@ import {
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import './features';
|
import './features';
|
||||||
|
|
||||||
|
import { TitleTheme } from '/@/shared/types/types';
|
||||||
|
|
||||||
export default class AppUpdater {
|
export default class AppUpdater {
|
||||||
constructor() {
|
constructor() {
|
||||||
log.transports.file.level = 'info';
|
log.transports.file.level = 'info';
|
||||||
|
|
@ -66,18 +67,21 @@ let exitFromTray = false;
|
||||||
let forceQuit = false;
|
let forceQuit = false;
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
const sourceMapSupport = require('source-map-support');
|
import('source-map-support').then((sourceMapSupport) => {
|
||||||
sourceMapSupport.install();
|
sourceMapSupport.install();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
|
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
|
||||||
|
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
require('electron-debug')();
|
import('electron-debug').then((electronDebug) => {
|
||||||
|
electronDebug.default();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const installExtensions = async () => {
|
const installExtensions = async () => {
|
||||||
const installer = require('electron-devtools-installer');
|
import('electron-devtools-installer').then((installer) => {
|
||||||
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
|
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
|
||||||
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
|
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
|
||||||
|
|
||||||
|
|
@ -87,6 +91,7 @@ const installExtensions = async () => {
|
||||||
forceDownload,
|
forceDownload,
|
||||||
)
|
)
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const RESOURCES_PATH = app.isPackaged
|
const RESOURCES_PATH = app.isPackaged
|
||||||
|
|
@ -393,7 +398,7 @@ async function createWindow(first = true): Promise<void> {
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const saved = false;
|
let saved = false;
|
||||||
|
|
||||||
mainWindow.on('close', (event) => {
|
mainWindow.on('close', (event) => {
|
||||||
store.set('bounds', mainWindow?.getNormalBounds());
|
store.set('bounds', mainWindow?.getNormalBounds());
|
||||||
|
|
@ -446,7 +451,7 @@ async function createWindow(first = true): Promise<void> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.on('minimize', (event: any) => {
|
(mainWindow as any).on('minimize', (event: any) => {
|
||||||
if (store.get('window_minimize_to_tray') === true) {
|
if (store.get('window_minimize_to_tray') === true) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
mainWindow?.hide();
|
mainWindow?.hide();
|
||||||
|
|
@ -632,22 +637,22 @@ if (!singleInstance) {
|
||||||
|
|
||||||
app.whenReady()
|
app.whenReady()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// protocol.handle('feishin', async (request) => {
|
protocol.handle('feishin', async (request) => {
|
||||||
// const filePath = `file://${request.url.slice('feishin://'.length)}`
|
const filePath = `file://${request.url.slice('feishin://'.length)}`;
|
||||||
// const response = await net.fetch(filePath)
|
const response = await net.fetch(filePath);
|
||||||
// const contentType = response.headers.get('content-type')
|
const contentType = response.headers.get('content-type');
|
||||||
|
|
||||||
// if (!contentType || !FONT_HEADERS.includes(contentType)) {
|
if (!contentType || !FONT_HEADERS.includes(contentType)) {
|
||||||
// getMainWindow()?.webContents.send('custom-font-error', filePath)
|
getMainWindow()?.webContents.send('custom-font-error', filePath);
|
||||||
|
|
||||||
// return new Response(null, {
|
return new Response(null, {
|
||||||
// status: 403,
|
status: 403,
|
||||||
// statusText: 'Forbidden'
|
statusText: 'Forbidden',
|
||||||
// })
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return response
|
return response;
|
||||||
// })
|
});
|
||||||
|
|
||||||
createWindow();
|
createWindow();
|
||||||
if (store.get('window_enable_tray', true)) {
|
if (store.get('window_enable_tray', true)) {
|
||||||
|
|
|
||||||
5
src/preload/index.d.ts
vendored
5
src/preload/index.d.ts
vendored
|
|
@ -6,5 +6,10 @@ declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
api: PreloadApi;
|
api: PreloadApi;
|
||||||
electron: ElectronAPI;
|
electron: ElectronAPI;
|
||||||
|
queryLocalFonts?: () => Promise<Font[]>;
|
||||||
|
SERVER_LOCK?: boolean;
|
||||||
|
SERVER_NAME?: string;
|
||||||
|
SERVER_TYPE?: ServerType;
|
||||||
|
SERVER_URL?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { ipcRenderer, IpcRendererEvent, webFrame } from 'electron';
|
import { ipcRenderer, IpcRendererEvent, webFrame } from 'electron';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
|
||||||
|
import { TitleTheme } from '/@/shared/types/types';
|
||||||
|
|
||||||
const store = new Store();
|
const store = new Store();
|
||||||
|
|
||||||
const set = (
|
const set = (
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import {
|
||||||
LyricSource,
|
LyricSource,
|
||||||
} from '../main/features/core/lyrics';
|
} from '../main/features/core/lyrics';
|
||||||
|
|
||||||
|
import { QueueSong } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const getRemoteLyricsBySong = (song: QueueSong) => {
|
const getRemoteLyricsBySong = (song: QueueSong) => {
|
||||||
const result = ipcRenderer.invoke('lyric-by-song', song);
|
const result = ipcRenderer.invoke('lyric-by-song', song);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
||||||
|
|
||||||
|
import { PlayerRepeat } from '/@/shared/types/types';
|
||||||
|
|
||||||
const updatePosition = (timeSec: number) => {
|
const updatePosition = (timeSec: number) => {
|
||||||
ipcRenderer.send('mpris-update-position', timeSec);
|
ipcRenderer.send('mpris-update-position', timeSec);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
||||||
|
|
||||||
|
import { PlayerData } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const initialize = (data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
const initialize = (data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
||||||
return ipcRenderer.invoke('player-initialize', data);
|
return ipcRenderer.invoke('player-initialize', data);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
||||||
|
|
||||||
|
import { QueueSong } from '/@/shared/types/domain-types';
|
||||||
|
import { PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
const requestFavorite = (
|
const requestFavorite = (
|
||||||
cb: (
|
cb: (
|
||||||
event: IpcRendererEvent,
|
event: IpcRendererEvent,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { MantineProvider } from '@mantine/core';
|
import { MantineProvider } from '@mantine/core';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import './styles/global.scss';
|
import './styles/global.scss';
|
||||||
import { useIsDark, useReconnect } from '/@/remote/store';
|
|
||||||
import { Shell } from '/@/remote/components/shell';
|
import { Shell } from '/@/remote/components/shell';
|
||||||
|
import { useIsDark, useReconnect } from '/@/remote/store';
|
||||||
|
|
||||||
export const App = () => {
|
export const App = () => {
|
||||||
const isDark = useIsDark();
|
const isDark = useIsDark();
|
||||||
|
|
@ -14,8 +16,6 @@ export const App = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MantineProvider
|
<MantineProvider
|
||||||
withGlobalStyles
|
|
||||||
withNormalizeCSS
|
|
||||||
theme={{
|
theme={{
|
||||||
colorScheme: isDark ? 'dark' : 'light',
|
colorScheme: isDark ? 'dark' : 'light',
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -77,6 +77,8 @@ export const App = () => {
|
||||||
xs: '0rem',
|
xs: '0rem',
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
withGlobalStyles
|
||||||
|
withNormalizeCSS
|
||||||
>
|
>
|
||||||
<Shell />
|
<Shell />
|
||||||
</MantineProvider>
|
</MantineProvider>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CiImageOff, CiImageOn } from 'react-icons/ci';
|
import { CiImageOff, CiImageOn } from 'react-icons/ci';
|
||||||
|
|
||||||
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
||||||
import { useShowImage, useToggleShowImage } from '/@/remote/store';
|
import { useShowImage, useToggleShowImage } from '/@/remote/store';
|
||||||
|
|
||||||
|
|
@ -9,10 +10,10 @@ export const ImageButton = () => {
|
||||||
return (
|
return (
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
mr={5}
|
mr={5}
|
||||||
|
onClick={() => toggleImage()}
|
||||||
size="xl"
|
size="xl"
|
||||||
tooltip={showImage ? 'Hide Image' : 'Show Image'}
|
tooltip={showImage ? 'Hide Image' : 'Show Image'}
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => toggleImage()}
|
|
||||||
>
|
>
|
||||||
{showImage ? <CiImageOff size={30} /> : <CiImageOn size={30} />}
|
{showImage ? <CiImageOff size={30} /> : <CiImageOn size={30} />}
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
import { RiRestartLine } from 'react-icons/ri';
|
||||||
|
|
||||||
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
||||||
import { useConnected, useReconnect } from '/@/remote/store';
|
import { useConnected, useReconnect } from '/@/remote/store';
|
||||||
import { RiRestartLine } from 'react-icons/ri';
|
|
||||||
|
|
||||||
export const ReconnectButton = () => {
|
export const ReconnectButton = () => {
|
||||||
const connected = useConnected();
|
const connected = useConnected();
|
||||||
|
|
@ -10,10 +11,10 @@ export const ReconnectButton = () => {
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
$active={!connected}
|
$active={!connected}
|
||||||
mr={5}
|
mr={5}
|
||||||
|
onClick={() => reconnect()}
|
||||||
size="xl"
|
size="xl"
|
||||||
tooltip={connected ? 'Reconnect' : 'Not connected. Reconnect.'}
|
tooltip={connected ? 'Reconnect' : 'Not connected. Reconnect.'}
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => reconnect()}
|
|
||||||
>
|
>
|
||||||
<RiRestartLine size={30} />
|
<RiRestartLine size={30} />
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
import { MouseEvent, ReactNode, Ref, forwardRef } from 'react';
|
import { Button, type ButtonProps as MantineButtonProps, Tooltip } from '@mantine/core';
|
||||||
import { Button, type ButtonProps as MantineButtonProps } from '@mantine/core';
|
import { forwardRef, MouseEvent, ReactNode, Ref } from 'react';
|
||||||
import { Tooltip } from '/@/renderer/components/tooltip';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
export interface ButtonProps extends StyledButtonProps {
|
||||||
|
tooltip: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface StyledButtonProps extends MantineButtonProps {
|
interface StyledButtonProps extends MantineButtonProps {
|
||||||
$active?: boolean;
|
$active?: boolean;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
|
@ -11,10 +14,6 @@ interface StyledButtonProps extends MantineButtonProps {
|
||||||
ref: Ref<HTMLButtonElement>;
|
ref: Ref<HTMLButtonElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ButtonProps extends StyledButtonProps {
|
|
||||||
tooltip: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const StyledButton = styled(Button)<StyledButtonProps>`
|
const StyledButton = styled(Button)<StyledButtonProps>`
|
||||||
svg {
|
svg {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -35,12 +34,12 @@ const StyledButton = styled(Button)<StyledButtonProps>`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const RemoteButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
export const RemoteButton = forwardRef<HTMLButtonElement, any>(
|
||||||
({ children, tooltip, ...props }: ButtonProps, ref) => {
|
({ children, tooltip, ...props }: any, ref) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
withinPortal
|
|
||||||
label={tooltip}
|
label={tooltip}
|
||||||
|
withinPortal
|
||||||
>
|
>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
{...props}
|
{...props}
|
||||||
|
|
@ -52,9 +51,3 @@ export const RemoteButton = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
RemoteButton.defaultProps = {
|
|
||||||
$active: false,
|
|
||||||
onClick: undefined,
|
|
||||||
onMouseDown: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import { useIsDark, useToggleDark } from '/@/remote/store';
|
|
||||||
import { RiMoonLine, RiSunLine } from 'react-icons/ri';
|
|
||||||
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
|
||||||
import { AppTheme } from '/@/renderer/themes/types';
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import { RiMoonLine, RiSunLine } from 'react-icons/ri';
|
||||||
|
|
||||||
|
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
||||||
|
import { useIsDark, useToggleDark } from '/@/remote/store';
|
||||||
|
import { AppTheme } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
export const ThemeButton = () => {
|
export const ThemeButton = () => {
|
||||||
const isDark = useIsDark();
|
const isDark = useIsDark();
|
||||||
|
|
@ -16,10 +17,10 @@ export const ThemeButton = () => {
|
||||||
return (
|
return (
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
mr={5}
|
mr={5}
|
||||||
|
onClick={() => toggleDark()}
|
||||||
size="xl"
|
size="xl"
|
||||||
tooltip="Toggle Theme"
|
tooltip="Toggle Theme"
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => toggleDark()}
|
|
||||||
>
|
>
|
||||||
{isDark ? <RiSunLine size={30} /> : <RiMoonLine size={30} />}
|
{isDark ? <RiSunLine size={30} /> : <RiMoonLine size={30} />}
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import { useCallback } from 'react';
|
import { Group, Image, Rating, Text, Title, Tooltip } from '@mantine/core';
|
||||||
import { Group, Image, Text, Title } from '@mantine/core';
|
|
||||||
import { useInfo, useSend, useShowImage } from '/@/remote/store';
|
|
||||||
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
|
||||||
import formatDuration from 'format-duration';
|
import formatDuration from 'format-duration';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
import { useCallback } from 'react';
|
||||||
import {
|
import {
|
||||||
RiHeartLine,
|
RiHeartLine,
|
||||||
RiPauseFill,
|
RiPauseFill,
|
||||||
|
|
@ -15,10 +13,11 @@ import {
|
||||||
RiSkipForwardFill,
|
RiSkipForwardFill,
|
||||||
RiVolumeUpFill,
|
RiVolumeUpFill,
|
||||||
} from 'react-icons/ri';
|
} from 'react-icons/ri';
|
||||||
import { PlayerRepeat, PlayerStatus } from '/@/renderer/types';
|
|
||||||
|
import { RemoteButton } from '/@/remote/components/buttons/remote-button';
|
||||||
import { WrapperSlider } from '/@/remote/components/wrapped-slider';
|
import { WrapperSlider } from '/@/remote/components/wrapped-slider';
|
||||||
import { Tooltip } from '/@/renderer/components/tooltip';
|
import { useInfo, useSend, useShowImage } from '/@/remote/store';
|
||||||
import { Rating } from '/@/renderer/components/rating';
|
import { PlayerRepeat, PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const RemoteContainer = () => {
|
export const RemoteContainer = () => {
|
||||||
const { position, repeat, shuffle, song, status, volume } = useInfo();
|
const { position, repeat, shuffle, song, status, volume } = useInfo();
|
||||||
|
|
@ -62,16 +61,14 @@ export const RemoteContainer = () => {
|
||||||
>
|
>
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
disabled={!id}
|
disabled={!id}
|
||||||
|
onClick={() => send({ event: 'previous' })}
|
||||||
tooltip="Previous track"
|
tooltip="Previous track"
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => send({ event: 'previous' })}
|
|
||||||
>
|
>
|
||||||
<RiSkipBackFill size={25} />
|
<RiSkipBackFill size={25} />
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
disabled={!id}
|
disabled={!id}
|
||||||
tooltip={id && status === PlayerStatus.PLAYING ? 'Pause' : 'Play'}
|
|
||||||
variant="default"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (status === PlayerStatus.PLAYING) {
|
if (status === PlayerStatus.PLAYING) {
|
||||||
send({ event: 'pause' });
|
send({ event: 'pause' });
|
||||||
|
|
@ -79,6 +76,8 @@ export const RemoteContainer = () => {
|
||||||
send({ event: 'play' });
|
send({ event: 'play' });
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
tooltip={id && status === PlayerStatus.PLAYING ? 'Pause' : 'Play'}
|
||||||
|
variant="default"
|
||||||
>
|
>
|
||||||
{id && status === PlayerStatus.PLAYING ? (
|
{id && status === PlayerStatus.PLAYING ? (
|
||||||
<RiPauseFill size={25} />
|
<RiPauseFill size={25} />
|
||||||
|
|
@ -88,9 +87,9 @@ export const RemoteContainer = () => {
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
disabled={!id}
|
disabled={!id}
|
||||||
|
onClick={() => send({ event: 'next' })}
|
||||||
tooltip="Next track"
|
tooltip="Next track"
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => send({ event: 'next' })}
|
|
||||||
>
|
>
|
||||||
<RiSkipForwardFill size={25} />
|
<RiSkipForwardFill size={25} />
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
|
|
@ -101,14 +100,15 @@ export const RemoteContainer = () => {
|
||||||
>
|
>
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
$active={shuffle || false}
|
$active={shuffle || false}
|
||||||
|
onClick={() => send({ event: 'shuffle' })}
|
||||||
tooltip={shuffle ? 'Shuffle tracks' : 'Shuffle disabled'}
|
tooltip={shuffle ? 'Shuffle tracks' : 'Shuffle disabled'}
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => send({ event: 'shuffle' })}
|
|
||||||
>
|
>
|
||||||
<RiShuffleFill size={25} />
|
<RiShuffleFill size={25} />
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
$active={repeat !== undefined && repeat !== PlayerRepeat.NONE}
|
$active={repeat !== undefined && repeat !== PlayerRepeat.NONE}
|
||||||
|
onClick={() => send({ event: 'repeat' })}
|
||||||
tooltip={`Repeat ${
|
tooltip={`Repeat ${
|
||||||
repeat === PlayerRepeat.ONE
|
repeat === PlayerRepeat.ONE
|
||||||
? 'One'
|
? 'One'
|
||||||
|
|
@ -117,7 +117,6 @@ export const RemoteContainer = () => {
|
||||||
: 'none'
|
: 'none'
|
||||||
}`}
|
}`}
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => send({ event: 'repeat' })}
|
|
||||||
>
|
>
|
||||||
{repeat === undefined || repeat === PlayerRepeat.ONE ? (
|
{repeat === undefined || repeat === PlayerRepeat.ONE ? (
|
||||||
<RiRepeatOneLine size={25} />
|
<RiRepeatOneLine size={25} />
|
||||||
|
|
@ -128,13 +127,13 @@ export const RemoteContainer = () => {
|
||||||
<RemoteButton
|
<RemoteButton
|
||||||
$active={song?.userFavorite}
|
$active={song?.userFavorite}
|
||||||
disabled={!id}
|
disabled={!id}
|
||||||
tooltip={song?.userFavorite ? 'Unfavorite' : 'Favorite'}
|
|
||||||
variant="default"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
|
||||||
send({ event: 'favorite', favorite: !song.userFavorite, id });
|
send({ event: 'favorite', favorite: !song.userFavorite, id });
|
||||||
}}
|
}}
|
||||||
|
tooltip={song?.userFavorite ? 'Unfavorite' : 'Favorite'}
|
||||||
|
variant="default"
|
||||||
>
|
>
|
||||||
<RiHeartLine size={25} />
|
<RiHeartLine size={25} />
|
||||||
</RemoteButton>
|
</RemoteButton>
|
||||||
|
|
@ -145,10 +144,10 @@ export const RemoteContainer = () => {
|
||||||
openDelay={1000}
|
openDelay={1000}
|
||||||
>
|
>
|
||||||
<Rating
|
<Rating
|
||||||
sx={{ margin: 'auto' }}
|
|
||||||
value={song.userRating ?? 0}
|
|
||||||
onChange={debouncedSetRating}
|
onChange={debouncedSetRating}
|
||||||
onDoubleClick={() => debouncedSetRating(0)}
|
onDoubleClick={() => debouncedSetRating(0)}
|
||||||
|
sx={{ margin: 'auto' }}
|
||||||
|
value={song.userRating ?? 0}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -159,14 +158,15 @@ export const RemoteContainer = () => {
|
||||||
label={(value) => formatDuration(value * 1e3)}
|
label={(value) => formatDuration(value * 1e3)}
|
||||||
leftLabel={formatDuration(position * 1e3)}
|
leftLabel={formatDuration(position * 1e3)}
|
||||||
max={song.duration / 1e3}
|
max={song.duration / 1e3}
|
||||||
|
onChangeEnd={(e) => send({ event: 'position', position: e })}
|
||||||
rightLabel={formatDuration(song.duration)}
|
rightLabel={formatDuration(song.duration)}
|
||||||
value={position}
|
value={position}
|
||||||
onChangeEnd={(e) => send({ event: 'position', position: e })}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<WrapperSlider
|
<WrapperSlider
|
||||||
leftLabel={<RiVolumeUpFill size={20} />}
|
leftLabel={<RiVolumeUpFill size={20} />}
|
||||||
max={100}
|
max={100}
|
||||||
|
onChangeEnd={(e) => send({ event: 'volume', volume: e })}
|
||||||
rightLabel={
|
rightLabel={
|
||||||
<Text
|
<Text
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|
@ -176,12 +176,11 @@ export const RemoteContainer = () => {
|
||||||
</Text>
|
</Text>
|
||||||
}
|
}
|
||||||
value={volume ?? 0}
|
value={volume ?? 0}
|
||||||
onChangeEnd={(e) => send({ event: 'volume', volume: e })}
|
|
||||||
/>
|
/>
|
||||||
{showImage && (
|
{showImage && (
|
||||||
<Image
|
<Image
|
||||||
src={song?.imageUrl?.replaceAll(/&(size|width|height=\d+)/g, '')}
|
|
||||||
onError={() => send({ event: 'proxy' })}
|
onError={() => send({ event: 'proxy' })}
|
||||||
|
src={song?.imageUrl?.replaceAll(/&(size|width|height=\d+)/g, '')}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@ import {
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Title,
|
Title,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { ThemeButton } from '/@/remote/components/buttons/theme-button';
|
|
||||||
import { ImageButton } from '/@/remote/components/buttons/image-button';
|
import { ImageButton } from '/@/remote/components/buttons/image-button';
|
||||||
import { RemoteContainer } from '/@/remote/components/remote-container';
|
|
||||||
import { ReconnectButton } from '/@/remote/components/buttons/reconnect-button';
|
import { ReconnectButton } from '/@/remote/components/buttons/reconnect-button';
|
||||||
|
import { ThemeButton } from '/@/remote/components/buttons/theme-button';
|
||||||
|
import { RemoteContainer } from '/@/remote/components/remote-container';
|
||||||
import { useConnected } from '/@/remote/store';
|
import { useConnected } from '/@/remote/store';
|
||||||
|
|
||||||
export const Shell = () => {
|
export const Shell = () => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { useState, ReactNode } from 'react';
|
import { rem, Slider, SliderProps } from '@mantine/core';
|
||||||
import { SliderProps } from '@mantine/core';
|
import { ReactNode, useState } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { PlayerbarSlider } from '/@/renderer/features/player/components/playerbar-slider';
|
|
||||||
|
|
||||||
const SliderContainer = styled.div`
|
const SliderContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -25,6 +24,54 @@ const SliderWrapper = styled.div`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const PlayerbarSlider = ({ ...props }: SliderProps) => {
|
||||||
|
return (
|
||||||
|
<Slider
|
||||||
|
styles={{
|
||||||
|
bar: {
|
||||||
|
backgroundColor: 'var(--playerbar-slider-track-progress-bg)',
|
||||||
|
transition: 'background-color 0.2s ease',
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
backgroundColor: 'var(--tooltip-bg)',
|
||||||
|
color: 'var(--tooltip-fg)',
|
||||||
|
fontSize: '1.1rem',
|
||||||
|
fontWeight: 600,
|
||||||
|
padding: '0 1rem',
|
||||||
|
},
|
||||||
|
root: {
|
||||||
|
'&:hover': {
|
||||||
|
'& .mantine-Slider-bar': {
|
||||||
|
backgroundColor: 'var(--primary-color)',
|
||||||
|
},
|
||||||
|
'& .mantine-Slider-thumb': {
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
thumb: {
|
||||||
|
backgroundColor: 'var(--slider-thumb-bg)',
|
||||||
|
borderColor: 'var(--primary-color)',
|
||||||
|
borderWidth: rem(1),
|
||||||
|
height: '1rem',
|
||||||
|
opacity: 0,
|
||||||
|
width: '1rem',
|
||||||
|
},
|
||||||
|
track: {
|
||||||
|
'&::before': {
|
||||||
|
backgroundColor: 'var(--playerbar-slider-track-bg)',
|
||||||
|
right: 'calc(0.1rem * -1)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
onClick={(e) => {
|
||||||
|
e?.stopPropagation();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export interface WrappedProps extends Omit<SliderProps, 'onChangeEnd'> {
|
export interface WrappedProps extends Omit<SliderProps, 'onChangeEnd'> {
|
||||||
leftLabel?: ReactNode;
|
leftLabel?: ReactNode;
|
||||||
onChangeEnd: (value: number) => void;
|
onChangeEnd: (value: number) => void;
|
||||||
|
|
@ -43,9 +90,6 @@ export const WrapperSlider = ({ leftLabel, rightLabel, value, ...props }: Wrappe
|
||||||
<PlayerbarSlider
|
<PlayerbarSlider
|
||||||
{...props}
|
{...props}
|
||||||
min={0}
|
min={0}
|
||||||
size={6}
|
|
||||||
value={!isSeeking ? (value ?? 0) : seek}
|
|
||||||
w="100%"
|
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setIsSeeking(true);
|
setIsSeeking(true);
|
||||||
setSeek(e);
|
setSeek(e);
|
||||||
|
|
@ -54,6 +98,9 @@ export const WrapperSlider = ({ leftLabel, rightLabel, value, ...props }: Wrappe
|
||||||
props.onChangeEnd(e);
|
props.onChangeEnd(e);
|
||||||
setIsSeeking(false);
|
setIsSeeking(false);
|
||||||
}}
|
}}
|
||||||
|
size={6}
|
||||||
|
value={!isSeeking ? (value ?? 0) : seek}
|
||||||
|
w="100%"
|
||||||
/>
|
/>
|
||||||
</SliderWrapper>
|
</SliderWrapper>
|
||||||
{rightLabel && <SliderValueWrapper $position="right">{rightLabel}</SliderValueWrapper>}
|
{rightLabel && <SliderValueWrapper $position="right">{rightLabel}</SliderValueWrapper>}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Notifications } from '@mantine/notifications';
|
import { Notifications } from '@mantine/notifications';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
|
|
||||||
import { App } from '/@/remote/app';
|
import { App } from '/@/remote/app';
|
||||||
|
|
||||||
const container = document.getElementById('root')! as HTMLElement;
|
const container = document.getElementById('root')! as HTMLElement;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
/// <reference lib="WebWorker" />
|
/// <reference lib="WebWorker" />
|
||||||
|
|
||||||
export type {};
|
export type {};
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
declare const self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
const url = new URL(location.toString());
|
const url = new URL(location.toString());
|
||||||
const version = url.searchParams.get('version');
|
const version = url.searchParams.get('version');
|
||||||
const prod = url.searchParams.get('prod') === 'true';
|
const prod = url.searchParams.get('prod') === 'true';
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
import { hideNotification, showNotification } from '@mantine/notifications';
|
|
||||||
import type { NotificationProps as MantineNotificationProps } from '@mantine/notifications';
|
import type { NotificationProps as MantineNotificationProps } from '@mantine/notifications';
|
||||||
|
|
||||||
|
import { hideNotification, showNotification } from '@mantine/notifications';
|
||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import { devtools, persist } from 'zustand/middleware';
|
import { devtools, persist } from 'zustand/middleware';
|
||||||
import { immer } from 'zustand/middleware/immer';
|
import { immer } from 'zustand/middleware/immer';
|
||||||
import type { ClientEvent, ServerEvent, SongUpdateSocket } from '/@/remote/types';
|
|
||||||
|
|
||||||
interface StatefulWebSocket extends WebSocket {
|
import { ClientEvent, ServerEvent, SongUpdateSocket } from '/@/shared/types/remote-types';
|
||||||
natural: boolean;
|
|
||||||
|
export interface SettingsSlice extends SettingsState {
|
||||||
|
actions: {
|
||||||
|
reconnect: () => void;
|
||||||
|
send: (data: ClientEvent) => void;
|
||||||
|
toggleIsDark: () => void;
|
||||||
|
toggleShowImage: () => void;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SettingsState {
|
interface SettingsState {
|
||||||
|
|
@ -18,13 +25,8 @@ interface SettingsState {
|
||||||
socket?: StatefulWebSocket;
|
socket?: StatefulWebSocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SettingsSlice extends SettingsState {
|
interface StatefulWebSocket extends WebSocket {
|
||||||
actions: {
|
natural: boolean;
|
||||||
reconnect: () => void;
|
|
||||||
send: (data: ClientEvent) => void;
|
|
||||||
toggleIsDark: () => void;
|
|
||||||
toggleShowImage: () => void;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: SettingsState = {
|
const initialState: SettingsState = {
|
||||||
|
|
@ -106,19 +108,18 @@ export const useRemoteStore = create<SettingsSlice>()(
|
||||||
const credentials = await fetch('/credentials');
|
const credentials = await fetch('/credentials');
|
||||||
authHeader = await credentials.text();
|
authHeader = await credentials.text();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to get credentials');
|
console.error('Failed to get credentials', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
set((state) => {
|
set((state) => {
|
||||||
const socket = new WebSocket(
|
const socket = new WebSocket(
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
location.href.replace('http', 'ws'),
|
location.href.replace('http', 'ws'),
|
||||||
) as StatefulWebSocket;
|
) as StatefulWebSocket;
|
||||||
|
|
||||||
socket.natural = false;
|
socket.natural = false;
|
||||||
|
|
||||||
socket.addEventListener('message', (message) => {
|
socket.addEventListener('message', (message) => {
|
||||||
const { event, data } = JSON.parse(message.data) as ServerEvent;
|
const { data, event } = JSON.parse(message.data) as ServerEvent;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case 'error': {
|
case 'error': {
|
||||||
|
|
@ -207,7 +208,6 @@ export const useRemoteStore = create<SettingsSlice>()(
|
||||||
|
|
||||||
socket.addEventListener('close', (reason) => {
|
socket.addEventListener('close', (reason) => {
|
||||||
if (reason.code === 4002 || reason.code === 4003) {
|
if (reason.code === 4002 || reason.code === 4003) {
|
||||||
// eslint-disable-next-line no-restricted-globals
|
|
||||||
location.reload();
|
location.reload();
|
||||||
} else if (reason.code === 4000) {
|
} else if (reason.code === 4000) {
|
||||||
toast.warn({
|
toast.warn({
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
import type { AuthenticationResponse, ControllerEndpoint, ServerType } from '/@/renderer/api/types';
|
|
||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
import { JellyfinController } from '/@/renderer/api/jellyfin/jellyfin-controller';
|
import { JellyfinController } from '/@/renderer/api/jellyfin/jellyfin-controller';
|
||||||
import { NavidromeController } from '/@/renderer/api/navidrome/navidrome-controller';
|
import { NavidromeController } from '/@/renderer/api/navidrome/navidrome-controller';
|
||||||
import { SubsonicController } from '/@/renderer/api/subsonic/subsonic-controller';
|
import { SubsonicController } from '/@/renderer/api/subsonic/subsonic-controller';
|
||||||
import { toast } from '/@/renderer/components/toast/index';
|
import { toast } from '/@/renderer/components/toast/index';
|
||||||
import { useAuthStore } from '/@/renderer/store';
|
import { useAuthStore } from '/@/renderer/store';
|
||||||
|
import {
|
||||||
|
AuthenticationResponse,
|
||||||
|
ControllerEndpoint,
|
||||||
|
ServerType,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
type ApiController = {
|
type ApiController = {
|
||||||
jellyfin: ControllerEndpoint;
|
jellyfin: ControllerEndpoint;
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,11 @@ import { z } from 'zod';
|
||||||
import packageJson from '../../../../package.json';
|
import packageJson from '../../../../package.json';
|
||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
import { jfType } from '/@/renderer/api/jellyfin/jellyfin-types';
|
import { authenticationFailure } from '/@/renderer/api/utils';
|
||||||
import { ServerListItem } from '/@/renderer/api/types';
|
|
||||||
import { authenticationFailure, getClientType } from '/@/renderer/api/utils';
|
|
||||||
import { useAuthStore } from '/@/renderer/store';
|
import { useAuthStore } from '/@/renderer/store';
|
||||||
|
import { jfType } from '/@/shared/api/jellyfin/jellyfin-types';
|
||||||
|
import { getClientType } from '/@/shared/api/utils';
|
||||||
|
import { ServerListItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const c = initContract();
|
const c = initContract();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import chunk from 'lodash/chunk';
|
import chunk from 'lodash/chunk';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { jfNormalize } from './jellyfin-normalize';
|
|
||||||
|
|
||||||
import { ServerFeature } from '/@/renderer/api/features-types';
|
|
||||||
import { JFSongListSort, JFSortOrder } from '/@/renderer/api/jellyfin.types';
|
|
||||||
import { jfApiClient } from '/@/renderer/api/jellyfin/jellyfin-api';
|
import { jfApiClient } from '/@/renderer/api/jellyfin/jellyfin-api';
|
||||||
import { jfType } from '/@/renderer/api/jellyfin/jellyfin-types';
|
import { JFSongListSort, JFSortOrder } from '/@/shared/api/jellyfin.types';
|
||||||
|
import { jfNormalize } from '/@/shared/api/jellyfin/jellyfin-normalize';
|
||||||
|
import { jfType } from '/@/shared/api/jellyfin/jellyfin-types';
|
||||||
|
import { getFeatures, hasFeature, VersionInfo } from '/@/shared/api/utils';
|
||||||
import {
|
import {
|
||||||
albumArtistListSortMap,
|
albumArtistListSortMap,
|
||||||
albumListSortMap,
|
albumListSortMap,
|
||||||
|
|
@ -18,8 +17,8 @@ import {
|
||||||
Song,
|
Song,
|
||||||
songListSortMap,
|
songListSortMap,
|
||||||
sortOrderMap,
|
sortOrderMap,
|
||||||
} from '/@/renderer/api/types';
|
} from '/@/shared/types/domain-types';
|
||||||
import { getFeatures, hasFeature, VersionInfo } from '/@/renderer/api/utils';
|
import { ServerFeature } from '/@/shared/types/features-types';
|
||||||
|
|
||||||
const formatCommaDelimitedString = (value: string[]) => {
|
const formatCommaDelimitedString = (value: string[]) => {
|
||||||
return value.join(',');
|
return value.join(',');
|
||||||
|
|
@ -282,7 +281,7 @@ export const JellyfinController: ControllerEndpoint = {
|
||||||
throw new Error('No userId found');
|
throw new Error('No userId found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const yearsGroup = [];
|
const yearsGroup: string[] = [];
|
||||||
if (query.minYear && query.maxYear) {
|
if (query.minYear && query.maxYear) {
|
||||||
for (let i = Number(query.minYear); i <= Number(query.maxYear); i += 1) {
|
for (let i = Number(query.minYear); i <= Number(query.maxYear); i += 1) {
|
||||||
yearsGroup.push(String(i));
|
yearsGroup.push(String(i));
|
||||||
|
|
@ -555,7 +554,7 @@ export const JellyfinController: ControllerEndpoint = {
|
||||||
throw new Error('No userId found');
|
throw new Error('No userId found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const yearsGroup = [];
|
const yearsGroup: string[] = [];
|
||||||
if (query.minYear && query.maxYear) {
|
if (query.minYear && query.maxYear) {
|
||||||
for (let i = Number(query.minYear); i <= Number(query.maxYear); i += 1) {
|
for (let i = Number(query.minYear); i <= Number(query.maxYear); i += 1) {
|
||||||
yearsGroup.push(String(i));
|
yearsGroup.push(String(i));
|
||||||
|
|
@ -692,7 +691,7 @@ export const JellyfinController: ControllerEndpoint = {
|
||||||
throw new Error('No userId found');
|
throw new Error('No userId found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const yearsGroup = [];
|
const yearsGroup: string[] = [];
|
||||||
if (query.minYear && query.maxYear) {
|
if (query.minYear && query.maxYear) {
|
||||||
for (let i = Number(query.minYear); i <= Number(query.maxYear); i += 1) {
|
for (let i = Number(query.minYear); i <= Number(query.maxYear); i += 1) {
|
||||||
yearsGroup.push(String(i));
|
yearsGroup.push(String(i));
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ import debounce from 'lodash/debounce';
|
||||||
import omitBy from 'lodash/omitBy';
|
import omitBy from 'lodash/omitBy';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
|
|
||||||
import { ndType } from './navidrome-types';
|
|
||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
import { ServerListItem } from '/@/renderer/api/types';
|
import { authenticationFailure } from '/@/renderer/api/utils';
|
||||||
import { authenticationFailure, resultWithHeaders } from '/@/renderer/api/utils';
|
import { toast } from '/@/renderer/components';
|
||||||
import { toast } from '/@/renderer/components/toast';
|
|
||||||
import { useAuthStore } from '/@/renderer/store';
|
import { useAuthStore } from '/@/renderer/store';
|
||||||
|
import { ndType } from '/@/shared/api/navidrome/navidrome-types';
|
||||||
|
import { resultWithHeaders } from '/@/shared/api/utils';
|
||||||
|
import { ServerListItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const localSettings = isElectron() ? window.api.localSettings : null;
|
const localSettings = isElectron() ? window.api.localSettings : null;
|
||||||
|
|
||||||
|
|
@ -274,7 +274,6 @@ axiosClient.interceptors.response.use(
|
||||||
const currentServer = useAuthStore.getState().currentServer;
|
const currentServer = useAuthStore.getState().currentServer;
|
||||||
|
|
||||||
if (localSettings && currentServer?.savePassword) {
|
if (localSettings && currentServer?.savePassword) {
|
||||||
// eslint-disable-next-line promise/no-promise-in-callback
|
|
||||||
return localSettings
|
return localSettings
|
||||||
.passwordGet(currentServer.id)
|
.passwordGet(currentServer.id)
|
||||||
.then(async (password: null | string) => {
|
.then(async (password: null | string) => {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
import { ndApiClient } from '/@/renderer/api/navidrome/navidrome-api';
|
||||||
|
import { ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
|
||||||
|
import { SubsonicController } from '/@/renderer/api/subsonic/subsonic-controller';
|
||||||
|
import { NDSongListSort } from '/@/shared/api/navidrome.types';
|
||||||
|
import { ndNormalize } from '/@/shared/api/navidrome/navidrome-normalize';
|
||||||
|
import { ndType } from '/@/shared/api/navidrome/navidrome-types';
|
||||||
|
import { ssNormalize } from '/@/shared/api/subsonic/subsonic-normalize';
|
||||||
|
import { SubsonicExtensions } from '/@/shared/api/subsonic/subsonic-types';
|
||||||
|
import { getFeatures, hasFeature, VersionInfo } from '/@/shared/api/utils';
|
||||||
import {
|
import {
|
||||||
albumArtistListSortMap,
|
albumArtistListSortMap,
|
||||||
albumListSortMap,
|
albumListSortMap,
|
||||||
|
|
@ -12,18 +21,8 @@ import {
|
||||||
songListSortMap,
|
songListSortMap,
|
||||||
sortOrderMap,
|
sortOrderMap,
|
||||||
userListSortMap,
|
userListSortMap,
|
||||||
} from '../types';
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { ServerFeature, ServerFeatures } from '/@/shared/types/features-types';
|
||||||
import { ServerFeature, ServerFeatures } from '/@/renderer/api/features-types';
|
|
||||||
import { NDSongListSort } from '/@/renderer/api/navidrome.types';
|
|
||||||
import { ndApiClient } from '/@/renderer/api/navidrome/navidrome-api';
|
|
||||||
import { ndNormalize } from '/@/renderer/api/navidrome/navidrome-normalize';
|
|
||||||
import { ndType } from '/@/renderer/api/navidrome/navidrome-types';
|
|
||||||
import { ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
|
|
||||||
import { SubsonicController } from '/@/renderer/api/subsonic/subsonic-controller';
|
|
||||||
import { ssNormalize } from '/@/renderer/api/subsonic/subsonic-normalize';
|
|
||||||
import { SubsonicExtensions } from '/@/renderer/api/subsonic/subsonic-types';
|
|
||||||
import { getFeatures, hasFeature, VersionInfo } from '/@/renderer/api/utils';
|
|
||||||
|
|
||||||
const VERSION_INFO: VersionInfo = [
|
const VERSION_INFO: VersionInfo = [
|
||||||
['0.55.0', { [ServerFeature.BFR]: [1] }],
|
['0.55.0', { [ServerFeature.BFR]: [1] }],
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import { QueryFunctionContext } from '@tanstack/react-query';
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AlbumArtistDetailQuery,
|
AlbumArtistDetailQuery,
|
||||||
AlbumArtistListQuery,
|
AlbumArtistListQuery,
|
||||||
|
|
@ -19,9 +17,11 @@ import type {
|
||||||
SongListQuery,
|
SongListQuery,
|
||||||
TopSongListQuery,
|
TopSongListQuery,
|
||||||
UserListQuery,
|
UserListQuery,
|
||||||
} from './types';
|
} from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
import { LyricSource } from './types';
|
import { QueryFunctionContext } from '@tanstack/react-query';
|
||||||
|
|
||||||
|
import { LyricSource } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
export const splitPaginatedQuery = (key: any) => {
|
export const splitPaginatedQuery = (key: any) => {
|
||||||
const { limit, startIndex, ...filter } = key || {};
|
const { limit, startIndex, ...filter } = key || {};
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ import qs from 'qs';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
import { ssType } from '/@/renderer/api/subsonic/subsonic-types';
|
|
||||||
import { ServerListItem } from '/@/renderer/api/types';
|
|
||||||
import { toast } from '/@/renderer/components/toast/index';
|
import { toast } from '/@/renderer/components/toast/index';
|
||||||
|
import { ssType } from '/@/shared/api/subsonic/subsonic-types';
|
||||||
|
import { ServerListItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const c = initContract();
|
const c = initContract();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import filter from 'lodash/filter';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import md5 from 'md5';
|
import md5 from 'md5';
|
||||||
|
|
||||||
import { ServerFeatures } from '/@/renderer/api/features-types';
|
|
||||||
import { ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
|
import { ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
|
||||||
import { ssNormalize } from '/@/renderer/api/subsonic/subsonic-normalize';
|
import { randomString } from '/@/renderer/utils';
|
||||||
import { AlbumListSortType, SubsonicExtensions } from '/@/renderer/api/subsonic/subsonic-types';
|
import { ssNormalize } from '/@/shared/api/subsonic/subsonic-normalize';
|
||||||
|
import { AlbumListSortType, SubsonicExtensions } from '/@/shared/api/subsonic/subsonic-types';
|
||||||
import {
|
import {
|
||||||
AlbumListSort,
|
AlbumListSort,
|
||||||
ControllerEndpoint,
|
ControllerEndpoint,
|
||||||
|
|
@ -18,8 +18,8 @@ import {
|
||||||
sortAlbumList,
|
sortAlbumList,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
sortSongList,
|
sortSongList,
|
||||||
} from '/@/renderer/api/types';
|
} from '/@/shared/types/domain-types';
|
||||||
import { randomString } from '/@/renderer/utils';
|
import { ServerFeatures } from '/@/shared/types/features-types';
|
||||||
|
|
||||||
const ALBUM_LIST_SORT_MAPPING: Record<AlbumListSort, AlbumListSortType | undefined> = {
|
const ALBUM_LIST_SORT_MAPPING: Record<AlbumListSort, AlbumListSortType | undefined> = {
|
||||||
[AlbumListSort.ALBUM_ARTIST]: AlbumListSortType.ALPHABETICAL_BY_ARTIST,
|
[AlbumListSort.ALBUM_ARTIST]: AlbumListSortType.ALPHABETICAL_BY_ARTIST,
|
||||||
|
|
@ -287,7 +287,7 @@ export const SubsonicController: ControllerEndpoint = {
|
||||||
let type = ALBUM_LIST_SORT_MAPPING[query.sortBy] ?? AlbumListSortType.ALPHABETICAL_BY_NAME;
|
let type = ALBUM_LIST_SORT_MAPPING[query.sortBy] ?? AlbumListSortType.ALPHABETICAL_BY_NAME;
|
||||||
|
|
||||||
if (query.artistIds) {
|
if (query.artistIds) {
|
||||||
const promises = [];
|
const promises: any[] = [];
|
||||||
|
|
||||||
for (const artistId of query.artistIds) {
|
for (const artistId of query.artistIds) {
|
||||||
promises.push(
|
promises.push(
|
||||||
|
|
@ -858,8 +858,8 @@ export const SubsonicController: ControllerEndpoint = {
|
||||||
return ssNormalize.song(res.body.song, apiClientProps.server);
|
return ssNormalize.song(res.body.song, apiClientProps.server);
|
||||||
},
|
},
|
||||||
getSongList: async ({ apiClientProps, query }) => {
|
getSongList: async ({ apiClientProps, query }) => {
|
||||||
const fromAlbumPromises = [];
|
const fromAlbumPromises: any[] = [];
|
||||||
const artistDetailPromises = [];
|
const artistDetailPromises: any[] = [];
|
||||||
let results: any[] = [];
|
let results: any[] = [];
|
||||||
|
|
||||||
if (query.searchTerm) {
|
if (query.searchTerm) {
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,13 @@ import isElectron from 'is-electron';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { initSimpleImg } from 'react-simple-img';
|
import { initSimpleImg } from 'react-simple-img';
|
||||||
|
|
||||||
import i18n from '../i18n/i18n';
|
|
||||||
import { toast } from './components';
|
|
||||||
import { useTheme } from './hooks';
|
|
||||||
import { AppRouter } from './router/app-router';
|
|
||||||
import './styles/global.scss';
|
import './styles/global.scss';
|
||||||
|
|
||||||
import '@ag-grid-community/styles/ag-grid.css';
|
import '@ag-grid-community/styles/ag-grid.css';
|
||||||
import 'overlayscrollbars/overlayscrollbars.css';
|
import 'overlayscrollbars/overlayscrollbars.css';
|
||||||
|
|
||||||
import {
|
import i18n from '/@/i18n/i18n';
|
||||||
useCssSettings,
|
import { toast } from '/@/renderer/components';
|
||||||
useHotkeySettings,
|
|
||||||
usePlaybackSettings,
|
|
||||||
useRemoteSettings,
|
|
||||||
useSettingsStore,
|
|
||||||
} from './store/settings.store';
|
|
||||||
|
|
||||||
import { ContextMenuProvider } from '/@/renderer/features/context-menu';
|
import { ContextMenuProvider } from '/@/renderer/features/context-menu';
|
||||||
import { useDiscordRpc } from '/@/renderer/features/discord-rpc/use-discord-rpc';
|
import { useDiscordRpc } from '/@/renderer/features/discord-rpc/use-discord-rpc';
|
||||||
import { PlayQueueHandlerContext } from '/@/renderer/features/player';
|
import { PlayQueueHandlerContext } from '/@/renderer/features/player';
|
||||||
|
|
@ -30,12 +20,23 @@ import { WebAudioContext } from '/@/renderer/features/player/context/webaudio-co
|
||||||
import { useHandlePlayQueueAdd } from '/@/renderer/features/player/hooks/use-handle-playqueue-add';
|
import { useHandlePlayQueueAdd } from '/@/renderer/features/player/hooks/use-handle-playqueue-add';
|
||||||
import { updateSong } from '/@/renderer/features/player/update-remote-song';
|
import { updateSong } from '/@/renderer/features/player/update-remote-song';
|
||||||
import { getMpvProperties } from '/@/renderer/features/settings/components/playback/mpv-settings';
|
import { getMpvProperties } from '/@/renderer/features/settings/components/playback/mpv-settings';
|
||||||
|
import { useTheme } from '/@/renderer/hooks';
|
||||||
import { useServerVersion } from '/@/renderer/hooks/use-server-version';
|
import { useServerVersion } from '/@/renderer/hooks/use-server-version';
|
||||||
import { IsUpdatedDialog } from '/@/renderer/is-updated-dialog';
|
import { IsUpdatedDialog } from '/@/renderer/is-updated-dialog';
|
||||||
import { PlayerState, usePlayerStore, useQueueControls } from '/@/renderer/store';
|
import { AppRouter } from '/@/renderer/router/app-router';
|
||||||
import { FontType, PlaybackType, PlayerStatus, WebAudio } from '/@/renderer/types';
|
import {
|
||||||
|
PlayerState,
|
||||||
|
useCssSettings,
|
||||||
|
useHotkeySettings,
|
||||||
|
usePlaybackSettings,
|
||||||
|
usePlayerStore,
|
||||||
|
useQueueControls,
|
||||||
|
useRemoteSettings,
|
||||||
|
useSettingsStore,
|
||||||
|
} from '/@/renderer/store';
|
||||||
import { sanitizeCss } from '/@/renderer/utils/sanitize';
|
import { sanitizeCss } from '/@/renderer/utils/sanitize';
|
||||||
import { setQueue } from '/@/renderer/utils/set-transcoded-queue-data';
|
import { setQueue } from '/@/renderer/utils/set-transcoded-queue-data';
|
||||||
|
import { FontType, PlaybackType, PlayerStatus, WebAudio } from '/@/shared/types/types';
|
||||||
|
|
||||||
ModuleRegistry.registerModules([ClientSideRowModelModule, InfiniteRowModelModule]);
|
ModuleRegistry.registerModules([ClientSideRowModelModule, InfiniteRowModelModule]);
|
||||||
|
|
||||||
|
|
@ -58,8 +59,8 @@ export const App = () => {
|
||||||
const handlePlayQueueAdd = useHandlePlayQueueAdd();
|
const handlePlayQueueAdd = useHandlePlayQueueAdd();
|
||||||
const { clearQueue, restoreQueue } = useQueueControls();
|
const { clearQueue, restoreQueue } = useQueueControls();
|
||||||
const remoteSettings = useRemoteSettings();
|
const remoteSettings = useRemoteSettings();
|
||||||
const textStyleRef = useRef<HTMLStyleElement>();
|
const textStyleRef = useRef<HTMLStyleElement | null>(null);
|
||||||
const cssRef = useRef<HTMLStyleElement>();
|
const cssRef = useRef<HTMLStyleElement | null>(null);
|
||||||
useDiscordRpc();
|
useDiscordRpc();
|
||||||
useServerVersion();
|
useServerVersion();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,9 @@
|
||||||
import type { Song } from '/@/renderer/api/types';
|
import type { Song } from '/@/shared/types/domain-types';
|
||||||
import type { CrossfadeStyle } from '/@/renderer/types';
|
import type { CrossfadeStyle } from '/@/shared/types/types';
|
||||||
import type { ReactPlayerProps } from 'react-player';
|
import type { ReactPlayerProps } from 'react-player';
|
||||||
|
|
||||||
import isElectron from 'is-electron';
|
import isElectron from 'is-electron';
|
||||||
import {
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
||||||
forwardRef,
|
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useImperativeHandle,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
import ReactPlayer from 'react-player/lazy';
|
import ReactPlayer from 'react-player/lazy';
|
||||||
|
|
||||||
import { api } from '/@/renderer/api';
|
import { api } from '/@/renderer/api';
|
||||||
|
|
@ -23,7 +15,7 @@ import { toast } from '/@/renderer/components/toast';
|
||||||
import { useWebAudio } from '/@/renderer/features/player/hooks/use-webaudio';
|
import { useWebAudio } from '/@/renderer/features/player/hooks/use-webaudio';
|
||||||
import { getServerById, TranscodingConfig, usePlaybackSettings, useSpeed } from '/@/renderer/store';
|
import { getServerById, TranscodingConfig, usePlaybackSettings, useSpeed } from '/@/renderer/store';
|
||||||
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store/settings.store';
|
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store/settings.store';
|
||||||
import { PlaybackStyle, PlayerStatus } from '/@/renderer/types';
|
import { PlaybackStyle, PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
export type AudioPlayerProgress = {
|
export type AudioPlayerProgress = {
|
||||||
loaded: number;
|
loaded: number;
|
||||||
|
|
@ -33,9 +25,11 @@ export type AudioPlayerProgress = {
|
||||||
};
|
};
|
||||||
|
|
||||||
interface AudioPlayerProps extends ReactPlayerProps {
|
interface AudioPlayerProps extends ReactPlayerProps {
|
||||||
|
autoNext: () => void;
|
||||||
crossfadeDuration: number;
|
crossfadeDuration: number;
|
||||||
crossfadeStyle: CrossfadeStyle;
|
crossfadeStyle: CrossfadeStyle;
|
||||||
currentPlayer: 1 | 2;
|
currentPlayer: 1 | 2;
|
||||||
|
muted: boolean;
|
||||||
playbackStyle: PlaybackStyle;
|
playbackStyle: PlaybackStyle;
|
||||||
player1?: Song;
|
player1?: Song;
|
||||||
player2?: Song;
|
player2?: Song;
|
||||||
|
|
@ -93,9 +87,8 @@ const useSongUrl = (transcode: TranscodingConfig, current: boolean, song?: Song)
|
||||||
}, [current, song?.uniqueId, song?.serverId, song?.streamUrl, transcode]);
|
}, [current, song?.uniqueId, song?.serverId, song?.streamUrl, transcode]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AudioPlayer = forwardRef(
|
export const AudioPlayer = ({ ref, ...props }: AudioPlayerProps) => {
|
||||||
(
|
const {
|
||||||
{
|
|
||||||
autoNext,
|
autoNext,
|
||||||
crossfadeDuration,
|
crossfadeDuration,
|
||||||
crossfadeStyle,
|
crossfadeStyle,
|
||||||
|
|
@ -106,9 +99,8 @@ export const AudioPlayer = forwardRef(
|
||||||
player2,
|
player2,
|
||||||
status,
|
status,
|
||||||
volume,
|
volume,
|
||||||
}: AudioPlayerProps,
|
} = props;
|
||||||
ref: any,
|
|
||||||
) => {
|
|
||||||
const player1Ref = useRef<ReactPlayer>(null);
|
const player1Ref = useRef<ReactPlayer>(null);
|
||||||
const player2Ref = useRef<ReactPlayer>(null);
|
const player2Ref = useRef<ReactPlayer>(null);
|
||||||
const [isTransitioning, setIsTransitioning] = useState(false);
|
const [isTransitioning, setIsTransitioning] = useState(false);
|
||||||
|
|
@ -123,12 +115,8 @@ export const AudioPlayer = forwardRef(
|
||||||
const stream2 = useSongUrl(transcode, currentPlayer === 2, player2);
|
const stream2 = useSongUrl(transcode, currentPlayer === 2, player2);
|
||||||
|
|
||||||
const { setWebAudio, webAudio } = useWebAudio();
|
const { setWebAudio, webAudio } = useWebAudio();
|
||||||
const [player1Source, setPlayer1Source] = useState<MediaElementAudioSourceNode | null>(
|
const [player1Source, setPlayer1Source] = useState<MediaElementAudioSourceNode | null>(null);
|
||||||
null,
|
const [player2Source, setPlayer2Source] = useState<MediaElementAudioSourceNode | null>(null);
|
||||||
);
|
|
||||||
const [player2Source, setPlayer2Source] = useState<MediaElementAudioSourceNode | null>(
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
|
|
||||||
const calculateReplayGain = useCallback(
|
const calculateReplayGain = useCallback(
|
||||||
(song: Song): number => {
|
(song: Song): number => {
|
||||||
|
|
@ -319,11 +307,9 @@ export const AudioPlayer = forwardRef(
|
||||||
const setSink = async () => {
|
const setSink = async () => {
|
||||||
try {
|
try {
|
||||||
if (audioDeviceId !== 'default') {
|
if (audioDeviceId !== 'default') {
|
||||||
// @ts-ignore
|
await (webAudio.context as any).setSinkId(audioDeviceId);
|
||||||
await webAudio.context.setSinkId(audioDeviceId);
|
|
||||||
} else {
|
} else {
|
||||||
// @ts-ignore
|
await (webAudio.context as any).setSinkId('');
|
||||||
await webAudio.context.setSinkId('');
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error({ message: `Error setting sink: ${(error as Error).message}` });
|
toast.error({ message: `Error setting sink: ${(error as Error).message}` });
|
||||||
|
|
@ -457,5 +443,4 @@ export const AudioPlayer = forwardRef(
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
};
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Dispatch } from 'react';
|
import type { Dispatch } from 'react';
|
||||||
|
|
||||||
import { CrossfadeStyle } from '/@/renderer/types';
|
import { CrossfadeStyle } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const gaplessHandler = (args: {
|
export const gaplessHandler = (args: {
|
||||||
currentTime: number;
|
currentTime: number;
|
||||||
|
|
|
||||||
|
|
@ -130,12 +130,6 @@ export const _Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
|
||||||
export const Button = createPolymorphicComponent<'button', ButtonProps>(_Button);
|
export const Button = createPolymorphicComponent<'button', ButtonProps>(_Button);
|
||||||
|
|
||||||
_Button.defaultProps = {
|
|
||||||
loading: undefined,
|
|
||||||
onClick: undefined,
|
|
||||||
tooltip: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
interface HoldButtonProps extends ButtonProps {
|
interface HoldButtonProps extends ButtonProps {
|
||||||
timeoutProps: {
|
timeoutProps: {
|
||||||
callback: () => void;
|
callback: () => void;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/renderer/types';
|
import type { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
|
|
||||||
import { Center } from '@mantine/core';
|
import { Center } from '@mantine/core';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
@ -7,10 +7,10 @@ import { generatePath, useNavigate } from 'react-router';
|
||||||
import { SimpleImg } from 'react-simple-img';
|
import { SimpleImg } from 'react-simple-img';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { CardControls } from '/@/renderer/components/card/card-controls';
|
import { CardControls } from '/@/renderer/components/card/card-controls';
|
||||||
import { CardRows } from '/@/renderer/components/card/card-rows';
|
import { CardRows } from '/@/renderer/components/card/card-rows';
|
||||||
import { Skeleton } from '/@/renderer/components/skeleton';
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
||||||
|
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const CardWrapper = styled.div<{
|
const CardWrapper = styled.div<{
|
||||||
link?: boolean;
|
link?: boolean;
|
||||||
|
|
@ -130,7 +130,7 @@ export const AlbumCard = ({
|
||||||
const handleNavigate = useCallback(() => {
|
const handleNavigate = useCallback(() => {
|
||||||
navigate(
|
navigate(
|
||||||
generatePath(
|
generatePath(
|
||||||
route.route,
|
route.route as string,
|
||||||
route.slugs?.reduce((acc, slug) => {
|
route.slugs?.reduce((acc, slug) => {
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
|
|
@ -207,6 +207,7 @@ export const AlbumCard = ({
|
||||||
{(cardRows || []).map((_row: CardRow<Album>, index: number) => (
|
{(cardRows || []).map((_row: CardRow<Album>, index: number) => (
|
||||||
<Skeleton
|
<Skeleton
|
||||||
height={15}
|
height={15}
|
||||||
|
key={`skeleton-${data?.id}-${index}`}
|
||||||
my={3}
|
my={3}
|
||||||
radius="md"
|
radius="md"
|
||||||
visible
|
visible
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { PlayQueueAddOptions } from '/@/renderer/types';
|
import type { PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
import type { UnstyledButtonProps } from '@mantine/core';
|
import type { UnstyledButtonProps } from '@mantine/core';
|
||||||
import type { MouseEvent } from 'react';
|
import type { MouseEvent } from 'react';
|
||||||
|
|
||||||
|
|
@ -7,7 +7,6 @@ import React from 'react';
|
||||||
import { RiHeartFill, RiHeartLine, RiMore2Fill, RiPlayFill } from 'react-icons/ri';
|
import { RiHeartFill, RiHeartLine, RiMore2Fill, RiPlayFill } from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { _Button } from '/@/renderer/components/button';
|
import { _Button } from '/@/renderer/components/button';
|
||||||
import {
|
import {
|
||||||
ALBUM_CONTEXT_MENU_ITEMS,
|
ALBUM_CONTEXT_MENU_ITEMS,
|
||||||
|
|
@ -15,7 +14,8 @@ import {
|
||||||
} from '/@/renderer/features/context-menu/context-menu-items';
|
} from '/@/renderer/features/context-menu/context-menu-items';
|
||||||
import { useHandleGeneralContextMenu } from '/@/renderer/features/context-menu/hooks/use-handle-context-menu';
|
import { useHandleGeneralContextMenu } from '/@/renderer/features/context-menu/hooks/use-handle-context-menu';
|
||||||
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
||||||
import { Play } from '/@/renderer/types';
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
import { Play } from '/@/shared/types/types';
|
||||||
|
|
||||||
type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
|
type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import { generatePath } from 'react-router';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, Playlist, Song } from '/@/renderer/api/types';
|
|
||||||
import { Text } from '/@/renderer/components/text';
|
import { Text } from '/@/renderer/components/text';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { CardRow } from '/@/renderer/types';
|
|
||||||
import { formatDateAbsolute, formatDateRelative, formatRating } from '/@/renderer/utils/format';
|
import { formatDateAbsolute, formatDateRelative, formatRating } from '/@/renderer/utils/format';
|
||||||
|
import { Album, AlbumArtist, Artist, Playlist, Song } from '/@/shared/types/domain-types';
|
||||||
|
import { CardRow } from '/@/shared/types/types';
|
||||||
|
|
||||||
const Row = styled.div<{ $secondary?: boolean }>`
|
const Row = styled.div<{ $secondary?: boolean }>`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import { generatePath, Link } from 'react-router-dom';
|
||||||
import { SimpleImg } from 'react-simple-img';
|
import { SimpleImg } from 'react-simple-img';
|
||||||
import styled, { css } from 'styled-components';
|
import styled, { css } from 'styled-components';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { CardRows } from '/@/renderer/components/card';
|
import { CardRows } from '/@/renderer/components/card';
|
||||||
import { Skeleton } from '/@/renderer/components/skeleton';
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
||||||
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
|
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
|
||||||
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/renderer/types';
|
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
|
|
||||||
interface BaseGridCardProps {
|
interface BaseGridCardProps {
|
||||||
controls: {
|
controls: {
|
||||||
|
|
@ -109,7 +109,7 @@ export const PosterCard = ({
|
||||||
}: BaseGridCardProps & { uniqueId: string }) => {
|
}: BaseGridCardProps & { uniqueId: string }) => {
|
||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
const path = generatePath(
|
const path = generatePath(
|
||||||
controls.route.route,
|
controls.route.route as string,
|
||||||
controls.route.slugs?.reduce((acc, slug) => {
|
controls.route.slugs?.reduce((acc, slug) => {
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,3 @@ export const DatePicker = ({ maxWidth, width, ...props }: DatePickerProps) => {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DatePicker.defaultProps = {
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ import { RiArrowLeftSLine, RiArrowRightSLine } from 'react-icons/ri';
|
||||||
import { generatePath, Link } from 'react-router-dom';
|
import { generatePath, Link } from 'react-router-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Album, LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { Badge } from '/@/renderer/components/badge';
|
import { Badge } from '/@/renderer/components/badge';
|
||||||
import { Button } from '/@/renderer/components/button';
|
import { Button } from '/@/renderer/components/button';
|
||||||
import { TextTitle } from '/@/renderer/components/text-title';
|
import { TextTitle } from '/@/renderer/components/text-title';
|
||||||
import { usePlayQueueAdd } from '/@/renderer/features/player/hooks/use-playqueue-add';
|
import { usePlayQueueAdd } from '/@/renderer/features/player/hooks/use-playqueue-add';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { usePlayButtonBehavior } from '/@/renderer/store';
|
import { usePlayButtonBehavior } from '/@/renderer/store';
|
||||||
import { Play } from '/@/renderer/types';
|
import { Album, LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
import { Play } from '/@/shared/types/types';
|
||||||
|
|
||||||
const Carousel = styled(motion.div)`
|
const Carousel = styled(motion.div)`
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -64,9 +64,9 @@ const BackgroundImage = styled.img`
|
||||||
width: 150%;
|
width: 150%;
|
||||||
height: 150%;
|
height: 150%;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
filter: blur(24px);
|
|
||||||
object-fit: var(--image-fit);
|
object-fit: var(--image-fit);
|
||||||
object-position: 0 30%;
|
object-position: 0 30%;
|
||||||
|
filter: blur(24px);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const BackgroundImageOverlay = styled.div`
|
const BackgroundImageOverlay = styled.div`
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,20 @@ import 'swiper/css';
|
||||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||||
import { Swiper as SwiperCore } from 'swiper/types';
|
import { Swiper as SwiperCore } from 'swiper/types';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, LibraryItem, RelatedArtist } from '/@/renderer/api/types';
|
|
||||||
import { Button } from '/@/renderer/components/button';
|
import { Button } from '/@/renderer/components/button';
|
||||||
import { PosterCard } from '/@/renderer/components/card/poster-card';
|
import { PosterCard } from '/@/renderer/components/card/poster-card';
|
||||||
import { TextTitle } from '/@/renderer/components/text-title';
|
import { TextTitle } from '/@/renderer/components/text-title';
|
||||||
import { usePlayQueueAdd } from '/@/renderer/features/player';
|
import { usePlayQueueAdd } from '/@/renderer/features/player';
|
||||||
import { useCreateFavorite, useDeleteFavorite } from '/@/renderer/features/shared';
|
import { useCreateFavorite, useDeleteFavorite } from '/@/renderer/features/shared';
|
||||||
import { usePlayButtonBehavior } from '/@/renderer/store';
|
import { usePlayButtonBehavior } from '/@/renderer/store';
|
||||||
import { CardRoute, CardRow } from '/@/renderer/types';
|
import {
|
||||||
|
Album,
|
||||||
|
AlbumArtist,
|
||||||
|
Artist,
|
||||||
|
LibraryItem,
|
||||||
|
RelatedArtist,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { CardRoute, CardRow } from '/@/shared/types/types';
|
||||||
|
|
||||||
const getSlidesPerView = (windowWidth: number) => {
|
const getSlidesPerView = (windowWidth: number) => {
|
||||||
if (windowWidth < 400) return 2;
|
if (windowWidth < 400) return 2;
|
||||||
|
|
@ -178,6 +184,7 @@ export const SwiperGridCarousel = ({
|
||||||
}}
|
}}
|
||||||
data={el}
|
data={el}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
|
key={`${uniqueId}-${el.id}`}
|
||||||
uniqueId={uniqueId}
|
uniqueId={uniqueId}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -367,39 +367,3 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
TextInput.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
NumberInput.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
PasswordInput.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
FileInput.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
JsonInput.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
Textarea.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,6 @@ export const BaseContextModal = ({
|
||||||
modalBody: (vars: ContextModalVars) => React.ReactNode;
|
modalBody: (vars: ContextModalVars) => React.ReactNode;
|
||||||
}>) => <>{innerProps.modalBody({ context, id })}</>;
|
}>) => <>{innerProps.modalBody({ context, id })}</>;
|
||||||
|
|
||||||
Modal.defaultProps = {
|
|
||||||
children: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
interface ConfirmModalProps {
|
interface ConfirmModalProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import styled from 'styled-components';
|
||||||
|
|
||||||
import { useShouldPadTitlebar, useTheme } from '/@/renderer/hooks';
|
import { useShouldPadTitlebar, useTheme } from '/@/renderer/hooks';
|
||||||
import { useWindowSettings } from '/@/renderer/store/settings.store';
|
import { useWindowSettings } from '/@/renderer/store/settings.store';
|
||||||
import { Platform } from '/@/renderer/types';
|
import { Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
const Container = styled(motion(Flex))<{
|
const Container = styled(motion(Flex))<{
|
||||||
$height?: string;
|
$height?: string;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { Button } from '/@/renderer/components/button';
|
||||||
import { DropdownMenu } from '/@/renderer/components/dropdown-menu';
|
import { DropdownMenu } from '/@/renderer/components/dropdown-menu';
|
||||||
import { QueryBuilderOption } from '/@/renderer/components/query-builder/query-builder-option';
|
import { QueryBuilderOption } from '/@/renderer/components/query-builder/query-builder-option';
|
||||||
import { Select } from '/@/renderer/components/select';
|
import { Select } from '/@/renderer/components/select';
|
||||||
import { QueryBuilderGroup, QueryBuilderRule } from '/@/renderer/types';
|
import { QueryBuilderGroup, QueryBuilderRule } from '/@/shared/types/types';
|
||||||
|
|
||||||
const FILTER_GROUP_OPTIONS_DATA = [
|
const FILTER_GROUP_OPTIONS_DATA = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { RiSubtractLine } from 'react-icons/ri';
|
||||||
import { Button } from '/@/renderer/components/button';
|
import { Button } from '/@/renderer/components/button';
|
||||||
import { NumberInput, TextInput } from '/@/renderer/components/input';
|
import { NumberInput, TextInput } from '/@/renderer/components/input';
|
||||||
import { Select } from '/@/renderer/components/select';
|
import { Select } from '/@/renderer/components/select';
|
||||||
import { QueryBuilderRule } from '/@/renderer/types';
|
import { QueryBuilderRule } from '/@/shared/types/types';
|
||||||
|
|
||||||
type DeleteArgs = {
|
type DeleteArgs = {
|
||||||
groupIndex: number[];
|
groupIndex: number[];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
||||||
import { Rating as MantineRating, RatingProps } from '@mantine/core';
|
import { Rating as MantineRating, RatingProps } from '@mantine/core';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable react/display-name */
|
|
||||||
import type { ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
import type { ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
|
||||||
|
|
||||||
import { ScrollArea as MantineScrollArea } from '@mantine/core';
|
import { ScrollArea as MantineScrollArea } from '@mantine/core';
|
||||||
|
|
@ -10,7 +9,7 @@ import styled from 'styled-components';
|
||||||
|
|
||||||
import { PageHeader, PageHeaderProps } from '/@/renderer/components/page-header';
|
import { PageHeader, PageHeaderProps } from '/@/renderer/components/page-header';
|
||||||
import { useWindowSettings } from '/@/renderer/store/settings.store';
|
import { useWindowSettings } from '/@/renderer/store/settings.store';
|
||||||
import { Platform } from '/@/renderer/types';
|
import { Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
const DragContainer = styled.div`
|
const DragContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -136,13 +136,3 @@ export const MultiSelect = ({ maxWidth, width, ...props }: MultiSelectProps) =>
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Select.defaultProps = {
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
MultiSelect.defaultProps = {
|
|
||||||
maxWidth: undefined,
|
|
||||||
width: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { SEPARATOR_STRING } from '/@/renderer/api/utils';
|
|
||||||
import { Text } from '/@/renderer/components/text';
|
import { Text } from '/@/renderer/components/text';
|
||||||
|
import { SEPARATOR_STRING } from '/@/shared/api/utils';
|
||||||
|
|
||||||
export const Separator = () => {
|
export const Separator = () => {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import type { IconType } from 'react-icons';
|
|
||||||
|
|
||||||
import { Center } from '@mantine/core';
|
import { Center } from '@mantine/core';
|
||||||
|
import { IconBaseProps } from 'react-icons';
|
||||||
import { RiLoader5Fill } from 'react-icons/ri';
|
import { RiLoader5Fill } from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { rotating } from '/@/renderer/styles';
|
import { rotating } from '/@/renderer/styles';
|
||||||
|
|
||||||
interface SpinnerProps extends IconType {
|
interface SpinnerProps extends IconBaseProps {
|
||||||
color?: string;
|
color?: string;
|
||||||
container?: boolean;
|
container?: boolean;
|
||||||
size?: number;
|
size?: number;
|
||||||
|
|
@ -34,8 +33,3 @@ export const Spinner = ({ ...props }: SpinnerProps) => {
|
||||||
|
|
||||||
return <SpinnerIcon {...props} />;
|
return <SpinnerIcon {...props} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
Spinner.defaultProps = {
|
|
||||||
color: undefined,
|
|
||||||
size: 15,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,3 @@ const _TextTitle = ({ $noSelect, $secondary, children, overflow, ...rest }: Text
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TextTitle = createPolymorphicComponent<'div', TextTitleProps>(_TextTitle);
|
export const TextTitle = createPolymorphicComponent<'div', TextTitleProps>(_TextTitle);
|
||||||
|
|
||||||
_TextTitle.defaultProps = {
|
|
||||||
$link: false,
|
|
||||||
$noSelect: false,
|
|
||||||
$secondary: false,
|
|
||||||
overflow: 'visible',
|
|
||||||
to: '',
|
|
||||||
weight: 400,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,3 @@ export const _Text = ({ $noSelect, $secondary, children, font, overflow, ...rest
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Text = createPolymorphicComponent<'div', TextProps>(_Text);
|
export const Text = createPolymorphicComponent<'div', TextProps>(_Text);
|
||||||
|
|
||||||
_Text.defaultProps = {
|
|
||||||
$link: false,
|
|
||||||
$noSelect: false,
|
|
||||||
$secondary: false,
|
|
||||||
font: undefined,
|
|
||||||
overflow: 'visible',
|
|
||||||
to: '',
|
|
||||||
weight: 400,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,3 @@ export const Tooltip = ({ children, ...rest }: TooltipProps) => {
|
||||||
</StyledTooltip>
|
</StyledTooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tooltip.defaultProps = {
|
|
||||||
openDelay: 0,
|
|
||||||
position: 'top',
|
|
||||||
withArrow: true,
|
|
||||||
withinPortal: true,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,18 @@ import { SimpleImg } from 'react-simple-img';
|
||||||
import { ListChildComponentProps } from 'react-window';
|
import { ListChildComponentProps } from 'react-window';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, LibraryItem, Playlist, Song } from '/@/renderer/api/types';
|
|
||||||
import { CardRows } from '/@/renderer/components/card';
|
import { CardRows } from '/@/renderer/components/card';
|
||||||
import { Skeleton } from '/@/renderer/components/skeleton';
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
||||||
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
|
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
|
||||||
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/renderer/types';
|
import {
|
||||||
|
Album,
|
||||||
|
AlbumArtist,
|
||||||
|
Artist,
|
||||||
|
LibraryItem,
|
||||||
|
Playlist,
|
||||||
|
Song,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
|
|
||||||
interface BaseGridCardProps {
|
interface BaseGridCardProps {
|
||||||
columnIndex: number;
|
columnIndex: number;
|
||||||
|
|
@ -142,7 +149,7 @@ export const DefaultCard = ({
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const path = generatePath(
|
const path = generatePath(
|
||||||
controls.route.route,
|
controls.route.route as string,
|
||||||
controls.route.slugs?.reduce((acc, slug) => {
|
controls.route.slugs?.reduce((acc, slug) => {
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
import type { PlayQueueAddOptions } from '/@/renderer/types';
|
|
||||||
import type { UnstyledButtonProps } from '@mantine/core';
|
import type { UnstyledButtonProps } from '@mantine/core';
|
||||||
|
|
||||||
import React, { MouseEvent, useState } from 'react';
|
import React, { MouseEvent, useState } from 'react';
|
||||||
import { RiHeartFill, RiHeartLine, RiMoreFill, RiPlayFill } from 'react-icons/ri';
|
import { RiHeartFill, RiHeartLine, RiMoreFill, RiPlayFill } from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
import { _Button } from '/@/renderer/components/button';
|
||||||
import {
|
import {
|
||||||
ALBUM_CONTEXT_MENU_ITEMS,
|
ALBUM_CONTEXT_MENU_ITEMS,
|
||||||
ARTIST_CONTEXT_MENU_ITEMS,
|
ARTIST_CONTEXT_MENU_ITEMS,
|
||||||
PLAYLIST_CONTEXT_MENU_ITEMS,
|
PLAYLIST_CONTEXT_MENU_ITEMS,
|
||||||
} from '../../../features/context-menu/context-menu-items';
|
} from '/@/renderer/features/context-menu/context-menu-items';
|
||||||
|
|
||||||
import { LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { _Button } from '/@/renderer/components/button';
|
|
||||||
import { useHandleGridContextMenu } from '/@/renderer/features/context-menu/hooks/use-handle-context-menu';
|
import { useHandleGridContextMenu } from '/@/renderer/features/context-menu/hooks/use-handle-context-menu';
|
||||||
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
||||||
import { Play } from '/@/renderer/types';
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
import { Play, PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
|
|
||||||
type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
|
type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { areEqual } from 'react-window';
|
||||||
|
|
||||||
import { DefaultCard } from '/@/renderer/components/virtual-grid/grid-card/default-card';
|
import { DefaultCard } from '/@/renderer/components/virtual-grid/grid-card/default-card';
|
||||||
import { PosterCard } from '/@/renderer/components/virtual-grid/grid-card/poster-card';
|
import { PosterCard } from '/@/renderer/components/virtual-grid/grid-card/poster-card';
|
||||||
import { GridCardData, ListDisplayType } from '/@/renderer/types';
|
import { CardRow, GridCardData, ListDisplayType } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const GridCard = memo(({ data, index, style }: ListChildComponentProps) => {
|
export const GridCard = memo(({ data, index, style }: ListChildComponentProps) => {
|
||||||
const {
|
const {
|
||||||
|
|
@ -23,7 +23,7 @@ export const GridCard = memo(({ data, index, style }: ListChildComponentProps) =
|
||||||
route,
|
route,
|
||||||
} = data as GridCardData;
|
} = data as GridCardData;
|
||||||
|
|
||||||
const cards = [];
|
const cards: React.ReactNode[] = [];
|
||||||
const startIndex = index * columnCount;
|
const startIndex = index * columnCount;
|
||||||
const stopIndex = Math.min(itemCount - 1, startIndex + columnCount - 1);
|
const stopIndex = Math.min(itemCount - 1, startIndex + columnCount - 1);
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ export const GridCard = memo(({ data, index, style }: ListChildComponentProps) =
|
||||||
<View
|
<View
|
||||||
columnIndex={i}
|
columnIndex={i}
|
||||||
controls={{
|
controls={{
|
||||||
cardRows,
|
cardRows: cardRows as CardRow<any>[],
|
||||||
handleFavorite,
|
handleFavorite,
|
||||||
handlePlayQueueAdd,
|
handlePlayQueueAdd,
|
||||||
itemGap,
|
itemGap,
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,18 @@ import { SimpleImg } from 'react-simple-img';
|
||||||
import { ListChildComponentProps } from 'react-window';
|
import { ListChildComponentProps } from 'react-window';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, LibraryItem, Playlist, Song } from '/@/renderer/api/types';
|
|
||||||
import { CardRows } from '/@/renderer/components/card';
|
import { CardRows } from '/@/renderer/components/card';
|
||||||
import { Skeleton } from '/@/renderer/components/skeleton';
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
||||||
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
|
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
|
||||||
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/renderer/types';
|
import {
|
||||||
|
Album,
|
||||||
|
AlbumArtist,
|
||||||
|
Artist,
|
||||||
|
LibraryItem,
|
||||||
|
Playlist,
|
||||||
|
Song,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
|
|
||||||
interface BaseGridCardProps {
|
interface BaseGridCardProps {
|
||||||
columnIndex: number;
|
columnIndex: number;
|
||||||
|
|
@ -130,7 +137,7 @@ export const PosterCard = ({
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const path = generatePath(
|
const path = generatePath(
|
||||||
controls.route.route,
|
controls.route.route as string,
|
||||||
controls.route.slugs?.reduce((acc, slug) => {
|
controls.route.slugs?.reduce((acc, slug) => {
|
||||||
return {
|
return {
|
||||||
...acc,
|
...acc,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
import type { CardRoute, CardRow, ListDisplayType, PlayQueueAddOptions } from '/@/renderer/types';
|
import type {
|
||||||
|
CardRoute,
|
||||||
|
CardRow,
|
||||||
|
ListDisplayType,
|
||||||
|
PlayQueueAddOptions,
|
||||||
|
} from '/@/shared/types/types';
|
||||||
import type { Ref } from 'react';
|
import type { Ref } from 'react';
|
||||||
import type { FixedSizeListProps } from 'react-window';
|
import type { FixedSizeListProps } from 'react-window';
|
||||||
|
|
||||||
|
|
@ -7,8 +12,8 @@ import memoize from 'memoize-one';
|
||||||
import { FixedSizeList } from 'react-window';
|
import { FixedSizeList } from 'react-window';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { GridCard } from '/@/renderer/components/virtual-grid/grid-card';
|
import { GridCard } from '/@/renderer/components/virtual-grid/grid-card';
|
||||||
|
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const createItemData = memoize(
|
const createItemData = memoize(
|
||||||
(
|
(
|
||||||
|
|
@ -123,10 +128,6 @@ export const VirtualGridWrapper = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
VirtualGridWrapper.defaultProps = {
|
|
||||||
route: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const VirtualGridContainer = styled.div`
|
export const VirtualGridContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { CardRoute, CardRow, PlayQueueAddOptions } from '/@/renderer/types';
|
import type { CardRoute, CardRow, PlayQueueAddOptions } from '/@/shared/types/types';
|
||||||
import type { FixedSizeListProps } from 'react-window';
|
import type { FixedSizeListProps } from 'react-window';
|
||||||
|
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
|
@ -13,9 +13,9 @@ import {
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import InfiniteLoader from 'react-window-infinite-loader';
|
import InfiniteLoader from 'react-window-infinite-loader';
|
||||||
|
|
||||||
import { AnyLibraryItem, Genre, LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper';
|
import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper';
|
||||||
import { ListDisplayType } from '/@/renderer/types';
|
import { AnyLibraryItem, Genre, LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
import { ListDisplayType } from '/@/shared/types/types';
|
||||||
|
|
||||||
export type VirtualInfiniteGridRef = {
|
export type VirtualInfiniteGridRef = {
|
||||||
resetLoadMoreItemsCache: () => void;
|
resetLoadMoreItemsCache: () => void;
|
||||||
|
|
@ -211,9 +211,3 @@ export const VirtualInfiniteGrid = forwardRef(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
VirtualInfiniteGrid.defaultProps = {
|
|
||||||
display: ListDisplayType.CARD,
|
|
||||||
minimumBatchSize: 20,
|
|
||||||
route: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AlbumArtist, Artist } from '/@/renderer/api/types';
|
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
|
||||||
import type { ICellRendererParams } from '@ag-grid-community/core';
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AlbumArtist, Artist } from '/@/renderer/api/types';
|
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
|
||||||
import type { ICellRendererParams } from '@ag-grid-community/core';
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ import React, { MouseEvent } from 'react';
|
||||||
import { RiPlayFill } from 'react-icons/ri';
|
import { RiPlayFill } from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { usePlayQueueAdd } from '/@/renderer/features/player';
|
import { usePlayQueueAdd } from '/@/renderer/features/player';
|
||||||
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
|
||||||
import { Play } from '/@/renderer/types';
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
import { Play } from '/@/shared/types/types';
|
||||||
|
|
||||||
type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
|
type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ import { Link } from 'react-router-dom';
|
||||||
import { SimpleImg } from 'react-simple-img';
|
import { SimpleImg } from 'react-simple-img';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { AlbumArtist, Artist } from '/@/renderer/api/types';
|
|
||||||
import { SEPARATOR_STRING } from '/@/renderer/api/utils';
|
|
||||||
import { Skeleton } from '/@/renderer/components/skeleton';
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
||||||
import { Text } from '/@/renderer/components/text';
|
import { Text } from '/@/renderer/components/text';
|
||||||
import { ListCoverControls } from '/@/renderer/components/virtual-table/cells/combined-title-cell-controls';
|
import { ListCoverControls } from '/@/renderer/components/virtual-table/cells/combined-title-cell-controls';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
|
import { SEPARATOR_STRING } from '/@/shared/api/utils';
|
||||||
|
import { AlbumArtist, Artist } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
const CellContainer = styled(motion.div)<{ height: number }>`
|
const CellContainer = styled(motion.div)<{ height: number }>`
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable import/no-cycle */
|
|
||||||
import type { ICellRendererParams } from '@ag-grid-community/core';
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
||||||
|
|
||||||
import { RiHeartFill, RiHeartLine } from 'react-icons/ri';
|
import { RiHeartFill, RiHeartLine } from 'react-icons/ri';
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,9 @@ import { useState } from 'react';
|
||||||
import { RiCheckboxBlankLine, RiCheckboxLine } from 'react-icons/ri';
|
import { RiCheckboxBlankLine, RiCheckboxLine } from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { getNodesByDiscNumber, setNodeSelection } from '../utils';
|
|
||||||
|
|
||||||
import { Button } from '/@/renderer/components/button';
|
import { Button } from '/@/renderer/components/button';
|
||||||
import { Paper } from '/@/renderer/components/paper';
|
import { Paper } from '/@/renderer/components/paper';
|
||||||
|
import { getNodesByDiscNumber, setNodeSelection } from '/@/renderer/components/virtual-table/utils';
|
||||||
|
|
||||||
const Container = styled(Paper)`
|
const Container = styled(Paper)`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,3 @@ export const GenericCell = (
|
||||||
</CellContainer>
|
</CellContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GenericCell.defaultProps = {
|
|
||||||
position: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AlbumArtist, Artist } from '/@/renderer/api/types';
|
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
|
||||||
import type { ICellRendererParams } from '@ag-grid-community/core';
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable import/no-cycle */
|
|
||||||
import type { ICellRendererParams } from '@ag-grid-community/core';
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
||||||
|
|
||||||
import { Rating } from '/@/renderer/components/rating';
|
import { Rating } from '/@/renderer/components/rating';
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,3 @@ export const GenericTableHeader = (
|
||||||
</HeaderWrapper>
|
</HeaderWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GenericTableHeader.defaultProps = {
|
|
||||||
position: 'left',
|
|
||||||
preset: undefined,
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/li
|
||||||
import { RowClassRules, RowNode } from '@ag-grid-community/core';
|
import { RowClassRules, RowNode } from '@ag-grid-community/core';
|
||||||
import { MutableRefObject, useEffect, useMemo, useRef } from 'react';
|
import { MutableRefObject, useEffect, useMemo, useRef } from 'react';
|
||||||
|
|
||||||
import { Song } from '/@/renderer/api/types';
|
|
||||||
import { useAppFocus } from '/@/renderer/hooks';
|
import { useAppFocus } from '/@/renderer/hooks';
|
||||||
import { useCurrentSong, usePlayerStore } from '/@/renderer/store';
|
import { useCurrentSong, usePlayerStore } from '/@/renderer/store';
|
||||||
import { PlayerStatus } from '/@/renderer/types';
|
import { Song } from '/@/shared/types/domain-types';
|
||||||
|
import { PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
interface UseCurrentSongRowStylesProps {
|
interface UseCurrentSongRowStylesProps {
|
||||||
tableRef: MutableRefObject<AgGridReactType | null>;
|
tableRef: MutableRefObject<AgGridReactType | null>;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { useInView } from 'framer-motion';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
import { useWindowSettings } from '/@/renderer/store/settings.store';
|
import { useWindowSettings } from '/@/renderer/store/settings.store';
|
||||||
import { Platform } from '/@/renderer/types';
|
import { Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const useFixedTableHeader = ({ enabled }: { enabled: boolean }) => {
|
export const useFixedTableHeader = ({ enabled }: { enabled: boolean }) => {
|
||||||
const tableHeaderRef = useRef<HTMLDivElement | null>(null);
|
const tableHeaderRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
|
||||||
|
|
@ -16,21 +16,20 @@ import { MutableRefObject, useCallback, useMemo } from 'react';
|
||||||
import { generatePath, useNavigate } from 'react-router';
|
import { generatePath, useNavigate } from 'react-router';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { ListKey, useListStoreByKey } from '../../../store/list.store';
|
|
||||||
|
|
||||||
import { api } from '/@/renderer/api';
|
import { api } from '/@/renderer/api';
|
||||||
import { queryKeys, QueryPagination } from '/@/renderer/api/query-keys';
|
import { queryKeys, QueryPagination } from '/@/renderer/api/query-keys';
|
||||||
|
import { getColumnDefs, VirtualTableProps } from '/@/renderer/components/virtual-table';
|
||||||
|
import { SetContextMenuItems, useHandleTableContextMenu } from '/@/renderer/features/context-menu';
|
||||||
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
|
import { PersistedTableColumn, useListStoreActions } from '/@/renderer/store';
|
||||||
|
import { ListKey, useListStoreByKey } from '/@/renderer/store/list.store';
|
||||||
import {
|
import {
|
||||||
BasePaginatedResponse,
|
BasePaginatedResponse,
|
||||||
BaseQuery,
|
BaseQuery,
|
||||||
LibraryItem,
|
LibraryItem,
|
||||||
ServerListItem,
|
ServerListItem,
|
||||||
} from '/@/renderer/api/types';
|
} from '/@/shared/types/domain-types';
|
||||||
import { getColumnDefs, VirtualTableProps } from '/@/renderer/components/virtual-table';
|
import { ListDisplayType, TablePagination } from '/@/shared/types/types';
|
||||||
import { SetContextMenuItems, useHandleTableContextMenu } from '/@/renderer/features/context-menu';
|
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
|
||||||
import { useListStoreActions } from '/@/renderer/store';
|
|
||||||
import { ListDisplayType, TablePagination } from '/@/renderer/types';
|
|
||||||
|
|
||||||
export type AgGridFetchFn<TResponse, TFilter> = (
|
export type AgGridFetchFn<TResponse, TFilter> = (
|
||||||
args: { filter: TFilter; limit: number; startIndex: number },
|
args: { filter: TFilter; limit: number; startIndex: number },
|
||||||
|
|
@ -295,7 +294,7 @@ export const useVirtualTable = <TFilter extends BaseQuery<any>>({
|
||||||
if (!columnsOrder) return;
|
if (!columnsOrder) return;
|
||||||
|
|
||||||
const columnsInSettings = properties.table.columns;
|
const columnsInSettings = properties.table.columns;
|
||||||
const updatedColumns = [];
|
const updatedColumns: PersistedTableColumn[] = [];
|
||||||
for (const column of columnsOrder) {
|
for (const column of columnsOrder) {
|
||||||
const columnInSettings = columnsInSettings.find(
|
const columnInSettings = columnsInSettings.find(
|
||||||
(c) => c.column === column.getColDef().colId,
|
(c) => c.column === column.getColDef().colId,
|
||||||
|
|
|
||||||
|
|
@ -39,17 +39,17 @@ import { TablePagination } from '/@/renderer/components/virtual-table/table-pagi
|
||||||
import { useTableChange } from '/@/renderer/hooks/use-song-change';
|
import { useTableChange } from '/@/renderer/hooks/use-song-change';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { PersistedTableColumn } from '/@/renderer/store/settings.store';
|
import { PersistedTableColumn } from '/@/renderer/store/settings.store';
|
||||||
import {
|
|
||||||
PlayerStatus,
|
|
||||||
TableColumn,
|
|
||||||
TablePagination as TablePaginationType,
|
|
||||||
} from '/@/renderer/types';
|
|
||||||
import {
|
import {
|
||||||
formatDateAbsolute,
|
formatDateAbsolute,
|
||||||
formatDateAbsoluteUTC,
|
formatDateAbsoluteUTC,
|
||||||
formatDateRelative,
|
formatDateRelative,
|
||||||
formatSizeString,
|
formatSizeString,
|
||||||
} from '/@/renderer/utils/format';
|
} from '/@/renderer/utils/format';
|
||||||
|
import {
|
||||||
|
PlayerStatus,
|
||||||
|
TableColumn,
|
||||||
|
TablePagination as TablePaginationType,
|
||||||
|
} from '/@/shared/types/types';
|
||||||
|
|
||||||
export * from './hooks/use-click-outside-deselect';
|
export * from './hooks/use-click-outside-deselect';
|
||||||
export * from './hooks/use-fixed-table-header';
|
export * from './hooks/use-fixed-table-header';
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { MultiSelect } from '/@/renderer/components/select';
|
||||||
import { Slider } from '/@/renderer/components/slider';
|
import { Slider } from '/@/renderer/components/slider';
|
||||||
import { Switch } from '/@/renderer/components/switch';
|
import { Switch } from '/@/renderer/components/switch';
|
||||||
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store/settings.store';
|
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store/settings.store';
|
||||||
import { TableColumn, TableType } from '/@/renderer/types';
|
import { TableColumn, TableType } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const SONG_TABLE_COLUMNS = [
|
export const SONG_TABLE_COLUMNS = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,15 @@ import { MutableRefObject } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { RiHashtag } from 'react-icons/ri';
|
import { RiHashtag } from 'react-icons/ri';
|
||||||
|
|
||||||
import { MotionFlex } from '../motion';
|
|
||||||
|
|
||||||
import { Button } from '/@/renderer/components/button';
|
import { Button } from '/@/renderer/components/button';
|
||||||
import { NumberInput } from '/@/renderer/components/input';
|
import { NumberInput } from '/@/renderer/components/input';
|
||||||
|
import { MotionFlex } from '/@/renderer/components/motion';
|
||||||
import { Pagination } from '/@/renderer/components/pagination';
|
import { Pagination } from '/@/renderer/components/pagination';
|
||||||
import { Popover } from '/@/renderer/components/popover';
|
import { Popover } from '/@/renderer/components/popover';
|
||||||
import { Text } from '/@/renderer/components/text';
|
import { Text } from '/@/renderer/components/text';
|
||||||
import { useContainerQuery } from '/@/renderer/hooks';
|
import { useContainerQuery } from '/@/renderer/hooks';
|
||||||
import { ListKey } from '/@/renderer/store';
|
import { ListKey } from '/@/renderer/store';
|
||||||
import { TablePagination as TablePaginationType } from '/@/renderer/types';
|
import { TablePagination as TablePaginationType } from '/@/shared/types/types';
|
||||||
|
|
||||||
interface TablePaginationProps {
|
interface TablePaginationProps {
|
||||||
pageKey: ListKey;
|
pageKey: ListKey;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { createContext, useContext } from 'react';
|
import { createContext, useContext } from 'react';
|
||||||
|
|
||||||
import { ListKey } from '/@/renderer/store';
|
import { ListKey } from '/@/renderer/store';
|
||||||
import { Play } from '/@/renderer/types';
|
import { Play } from '/@/shared/types/types';
|
||||||
|
|
||||||
interface ListContextProps {
|
interface ListContextProps {
|
||||||
customFilters?: Record<string, unknown>;
|
customFilters?: Record<string, unknown>;
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Button, Checkbox, FileInput, Text } from '/@/renderer/components';
|
import { Button, Checkbox, FileInput, Text } from '/@/renderer/components';
|
||||||
import { usePlaybackSettings, useSettingsStoreActions } from '/@/renderer/store';
|
import { usePlaybackSettings, useSettingsStoreActions } from '/@/renderer/store';
|
||||||
import { PlaybackType } from '/@/renderer/types';
|
import { PlaybackType } from '/@/shared/types/types';
|
||||||
|
|
||||||
const localSettings = isElectron() ? window.api.localSettings : null;
|
const localSettings = isElectron() ? window.api.localSettings : null;
|
||||||
|
|
||||||
export const MpvRequired = () => {
|
export const MpvRequired = () => {
|
||||||
const [mpvPath, setMpvPath] = useState('');
|
const [, setMpvPath] = useState('');
|
||||||
const settings = usePlaybackSettings();
|
const settings = usePlaybackSettings();
|
||||||
const { setSettings } = useSettingsStoreActions();
|
const { setSettings } = useSettingsStoreActions();
|
||||||
const [disabled, setDisabled] = useState(false);
|
const [disabled, setDisabled] = useState(false);
|
||||||
|
|
@ -50,7 +50,6 @@ export const MpvRequired = () => {
|
||||||
<FileInput
|
<FileInput
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onChange={handleSetMpvPath}
|
onChange={handleSetMpvPath}
|
||||||
placeholder={mpvPath}
|
|
||||||
/>
|
/>
|
||||||
<Text>{t('setting.disable_mpv', { context: 'description' })}</Text>
|
<Text>{t('setting.disable_mpv', { context: 'description' })}</Text>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,6 @@ import { Link } from 'react-router-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||||
import {
|
|
||||||
AlbumListQuery,
|
|
||||||
AlbumListSort,
|
|
||||||
LibraryItem,
|
|
||||||
QueueSong,
|
|
||||||
SortOrder,
|
|
||||||
} from '/@/renderer/api/types';
|
|
||||||
import { Button, Popover, Spoiler } from '/@/renderer/components';
|
import { Button, Popover, Spoiler } from '/@/renderer/components';
|
||||||
import { MemoizedSwiperGridCarousel } from '/@/renderer/components/grid-carousel';
|
import { MemoizedSwiperGridCarousel } from '/@/renderer/components/grid-carousel';
|
||||||
import {
|
import {
|
||||||
|
|
@ -47,13 +40,21 @@ import { useGenreRoute } from '/@/renderer/hooks/use-genre-route';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { useCurrentServer, useCurrentSong, useCurrentStatus } from '/@/renderer/store';
|
import { useCurrentServer, useCurrentSong, useCurrentStatus } from '/@/renderer/store';
|
||||||
import {
|
import {
|
||||||
|
PersistedTableColumn,
|
||||||
useGeneralSettings,
|
useGeneralSettings,
|
||||||
usePlayButtonBehavior,
|
usePlayButtonBehavior,
|
||||||
useSettingsStoreActions,
|
useSettingsStoreActions,
|
||||||
useTableSettings,
|
useTableSettings,
|
||||||
} from '/@/renderer/store/settings.store';
|
} from '/@/renderer/store/settings.store';
|
||||||
import { Play } from '/@/renderer/types';
|
|
||||||
import { replaceURLWithHTMLLinks } from '/@/renderer/utils/linkify';
|
import { replaceURLWithHTMLLinks } from '/@/renderer/utils/linkify';
|
||||||
|
import {
|
||||||
|
AlbumListQuery,
|
||||||
|
AlbumListSort,
|
||||||
|
LibraryItem,
|
||||||
|
QueueSong,
|
||||||
|
SortOrder,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { Play } from '/@/shared/types/types';
|
||||||
|
|
||||||
const isFullWidthRow = (node: RowNode) => {
|
const isFullWidthRow = (node: RowNode) => {
|
||||||
return node.id?.startsWith('disc-');
|
return node.id?.startsWith('disc-');
|
||||||
|
|
@ -305,7 +306,7 @@ export const AlbumDetailContent = ({ background, tableRef }: AlbumDetailContentP
|
||||||
if (!columnsOrder) return;
|
if (!columnsOrder) return;
|
||||||
|
|
||||||
const columnsInSettings = tableConfig.columns;
|
const columnsInSettings = tableConfig.columns;
|
||||||
const updatedColumns = [];
|
const updatedColumns: PersistedTableColumn[] = [];
|
||||||
for (const column of columnsOrder) {
|
for (const column of columnsOrder) {
|
||||||
const columnInSettings = columnsInSettings.find(
|
const columnInSettings = columnsInSettings.find(
|
||||||
(c) => c.column === column.getColDef().colId,
|
(c) => c.column === column.getColDef().colId,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { generatePath, useParams } from 'react-router';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||||
import { AlbumDetailResponse, LibraryItem, ServerType } from '/@/renderer/api/types';
|
|
||||||
import { Rating, Text } from '/@/renderer/components';
|
import { Rating, Text } from '/@/renderer/components';
|
||||||
import { useAlbumDetail } from '/@/renderer/features/albums/queries/album-detail-query';
|
import { useAlbumDetail } from '/@/renderer/features/albums/queries/album-detail-query';
|
||||||
import { LibraryHeader, useSetRating } from '/@/renderer/features/shared';
|
import { LibraryHeader, useSetRating } from '/@/renderer/features/shared';
|
||||||
|
|
@ -15,6 +14,7 @@ import { queryClient } from '/@/renderer/lib/react-query';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { useCurrentServer } from '/@/renderer/store';
|
import { useCurrentServer } from '/@/renderer/store';
|
||||||
import { formatDateAbsoluteUTC, formatDurationString } from '/@/renderer/utils';
|
import { formatDateAbsoluteUTC, formatDurationString } from '/@/renderer/utils';
|
||||||
|
import { AlbumDetailResponse, LibraryItem, ServerType } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface AlbumDetailHeaderProps {
|
interface AlbumDetailHeaderProps {
|
||||||
background: {
|
background: {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { Spinner } from '/@/renderer/components';
|
||||||
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { useListStoreByKey } from '/@/renderer/store';
|
import { useListStoreByKey } from '/@/renderer/store';
|
||||||
import { ListDisplayType } from '/@/renderer/types';
|
import { ListDisplayType } from '/@/shared/types/types';
|
||||||
|
|
||||||
const AlbumListGridView = lazy(() =>
|
const AlbumListGridView = lazy(() =>
|
||||||
import('/@/renderer/features/albums/components/album-list-grid-view').then((module) => ({
|
import('/@/renderer/features/albums/components/album-list-grid-view').then((module) => ({
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,6 @@ import { ListOnScrollProps } from 'react-window';
|
||||||
|
|
||||||
import { controller } from '/@/renderer/api/controller';
|
import { controller } from '/@/renderer/api/controller';
|
||||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||||
import {
|
|
||||||
Album,
|
|
||||||
AlbumListQuery,
|
|
||||||
AlbumListResponse,
|
|
||||||
AlbumListSort,
|
|
||||||
LibraryItem,
|
|
||||||
} from '/@/renderer/api/types';
|
|
||||||
import { ALBUM_CARD_ROWS } from '/@/renderer/components';
|
import { ALBUM_CARD_ROWS } from '/@/renderer/components';
|
||||||
import {
|
import {
|
||||||
VirtualGridAutoSizerContainer,
|
VirtualGridAutoSizerContainer,
|
||||||
|
|
@ -23,7 +16,14 @@ import { usePlayQueueAdd } from '/@/renderer/features/player';
|
||||||
import { useHandleFavorite } from '/@/renderer/features/shared/hooks/use-handle-favorite';
|
import { useHandleFavorite } from '/@/renderer/features/shared/hooks/use-handle-favorite';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { useCurrentServer, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
|
import { useCurrentServer, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
|
||||||
import { CardRow, ListDisplayType } from '/@/renderer/types';
|
import {
|
||||||
|
Album,
|
||||||
|
AlbumListQuery,
|
||||||
|
AlbumListResponse,
|
||||||
|
AlbumListSort,
|
||||||
|
LibraryItem,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { CardRow, ListDisplayType } from '/@/shared/types/types';
|
||||||
|
|
||||||
export const AlbumListGridView = ({ gridRef, itemCount }: any) => {
|
export const AlbumListGridView = ({ gridRef, itemCount }: any) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
@ -134,7 +134,7 @@ export const AlbumListGridView = ({ gridRef, itemCount }: any) => {
|
||||||
stale: false,
|
stale: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemData = [];
|
const itemData: Album[] = [];
|
||||||
|
|
||||||
for (const [, data] of queriesFromCache) {
|
for (const [, data] of queriesFromCache) {
|
||||||
const { items, startIndex } = data || {};
|
const { items, startIndex } = data || {};
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,6 @@ import {
|
||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
import { queryKeys } from '/@/renderer/api/query-keys';
|
import { queryKeys } from '/@/renderer/api/query-keys';
|
||||||
import {
|
|
||||||
AlbumListQuery,
|
|
||||||
AlbumListSort,
|
|
||||||
LibraryItem,
|
|
||||||
ServerType,
|
|
||||||
SortOrder,
|
|
||||||
} from '/@/renderer/api/types';
|
|
||||||
import { Button, DropdownMenu, MultiSelect, Slider, Switch, Text } from '/@/renderer/components';
|
import { Button, DropdownMenu, MultiSelect, Slider, Switch, Text } from '/@/renderer/components';
|
||||||
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
||||||
import { ALBUM_TABLE_COLUMNS } from '/@/renderer/components/virtual-table';
|
import { ALBUM_TABLE_COLUMNS } from '/@/renderer/components/virtual-table';
|
||||||
|
|
@ -41,7 +34,14 @@ import {
|
||||||
useListStoreActions,
|
useListStoreActions,
|
||||||
useListStoreByKey,
|
useListStoreByKey,
|
||||||
} from '/@/renderer/store';
|
} from '/@/renderer/store';
|
||||||
import { ListDisplayType, Play, TableColumn } from '/@/renderer/types';
|
import {
|
||||||
|
AlbumListQuery,
|
||||||
|
AlbumListSort,
|
||||||
|
LibraryItem,
|
||||||
|
ServerType,
|
||||||
|
SortOrder,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
import { ListDisplayType, Play, TableColumn } from '/@/shared/types/types';
|
||||||
|
|
||||||
const FILTERS = {
|
const FILTERS = {
|
||||||
jellyfin: [
|
jellyfin: [
|
||||||
|
|
@ -314,7 +314,7 @@ export const AlbumListHeaderFilters = ({
|
||||||
(e: MouseEvent<HTMLButtonElement>) => {
|
(e: MouseEvent<HTMLButtonElement>) => {
|
||||||
if (!e.currentTarget?.value) return;
|
if (!e.currentTarget?.value) return;
|
||||||
|
|
||||||
let updatedFilters = null;
|
let updatedFilters: AlbumListFilter | null = null;
|
||||||
if (e.currentTarget.value === String(filter.musicFolderId)) {
|
if (e.currentTarget.value === String(filter.musicFolderId)) {
|
||||||
updatedFilters = setFilter({
|
updatedFilters = setFilter({
|
||||||
customFilters,
|
customFilters,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import debounce from 'lodash/debounce';
|
||||||
import { type ChangeEvent, type MutableRefObject, useEffect, useRef } from 'react';
|
import { type ChangeEvent, type MutableRefObject, useEffect, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { AlbumListQuery, LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { PageHeader, SearchInput } from '/@/renderer/components';
|
import { PageHeader, SearchInput } from '/@/renderer/components';
|
||||||
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
||||||
import { AlbumListHeaderFilters } from '/@/renderer/features/albums/components/album-list-header-filters';
|
import { AlbumListHeaderFilters } from '/@/renderer/features/albums/components/album-list-header-filters';
|
||||||
|
|
@ -14,6 +13,7 @@ import { useContainerQuery } from '/@/renderer/hooks';
|
||||||
import { useDisplayRefresh } from '/@/renderer/hooks/use-display-refresh';
|
import { useDisplayRefresh } from '/@/renderer/hooks/use-display-refresh';
|
||||||
import { AlbumListFilter, useCurrentServer, usePlayButtonBehavior } from '/@/renderer/store';
|
import { AlbumListFilter, useCurrentServer, usePlayButtonBehavior } from '/@/renderer/store';
|
||||||
import { titleCase } from '/@/renderer/utils';
|
import { titleCase } from '/@/renderer/utils';
|
||||||
|
import { AlbumListQuery, LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface AlbumListHeaderProps {
|
interface AlbumListHeaderProps {
|
||||||
genreId?: string;
|
genreId?: string;
|
||||||
|
|
@ -34,7 +34,7 @@ export const AlbumListHeader = ({
|
||||||
const server = useCurrentServer();
|
const server = useCurrentServer();
|
||||||
const cq = useContainerQuery();
|
const cq = useContainerQuery();
|
||||||
const playButtonBehavior = usePlayButtonBehavior();
|
const playButtonBehavior = usePlayButtonBehavior();
|
||||||
const genreRef = useRef<string>();
|
const genreRef = useRef<string | undefined>(undefined);
|
||||||
const { filter, handlePlay, refresh, search } = useDisplayRefresh<AlbumListQuery>({
|
const { filter, handlePlay, refresh, search } = useDisplayRefresh<AlbumListQuery>({
|
||||||
gridRef,
|
gridRef,
|
||||||
itemCount,
|
itemCount,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import { useVirtualTable } from '../../../components/virtual-table/hooks/use-virtual-table';
|
|
||||||
|
|
||||||
import { LibraryItem } from '/@/renderer/api/types';
|
|
||||||
import { VirtualGridAutoSizerContainer } from '/@/renderer/components/virtual-grid';
|
import { VirtualGridAutoSizerContainer } from '/@/renderer/components/virtual-grid';
|
||||||
import { VirtualTable } from '/@/renderer/components/virtual-table';
|
import { VirtualTable } from '/@/renderer/components/virtual-table';
|
||||||
|
import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use-virtual-table';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { ALBUM_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items';
|
import { ALBUM_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items';
|
||||||
import { useCurrentServer } from '/@/renderer/store';
|
import { useCurrentServer } from '/@/renderer/store';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
export const AlbumListTableView = ({ itemCount, tableRef }: any) => {
|
export const AlbumListTableView = ({ itemCount, tableRef }: any) => {
|
||||||
const server = useCurrentServer();
|
const server = useCurrentServer();
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,19 @@ import debounce from 'lodash/debounce';
|
||||||
import { ChangeEvent, useMemo, useState } from 'react';
|
import { ChangeEvent, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { useListFilterByKey } from '../../../store/list.store';
|
import { NumberInput, SpinnerIcon, Switch, Text } from '/@/renderer/components';
|
||||||
|
import { MultiSelectWithInvalidData } from '/@/renderer/components/select-with-invalid-data';
|
||||||
|
import { useAlbumArtistList } from '/@/renderer/features/artists/queries/album-artist-list-query';
|
||||||
|
import { useGenreList } from '/@/renderer/features/genres';
|
||||||
|
import { useTagList } from '/@/renderer/features/tag/queries/use-tag-list';
|
||||||
|
import { AlbumListFilter, useListFilterByKey, useListStoreActions } from '/@/renderer/store';
|
||||||
import {
|
import {
|
||||||
AlbumArtistListSort,
|
AlbumArtistListSort,
|
||||||
AlbumListQuery,
|
AlbumListQuery,
|
||||||
GenreListSort,
|
GenreListSort,
|
||||||
LibraryItem,
|
LibraryItem,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
} from '/@/renderer/api/types';
|
} from '/@/shared/types/domain-types';
|
||||||
import { NumberInput, SpinnerIcon, Switch, Text } from '/@/renderer/components';
|
|
||||||
import { MultiSelectWithInvalidData } from '/@/renderer/components/select-with-invalid-data';
|
|
||||||
import { useAlbumArtistList } from '/@/renderer/features/artists/queries/album-artist-list-query';
|
|
||||||
import { useGenreList } from '/@/renderer/features/genres';
|
|
||||||
import { useTagList } from '/@/renderer/features/tag/queries/use-tag-list';
|
|
||||||
import { AlbumListFilter, useListStoreActions } from '/@/renderer/store';
|
|
||||||
|
|
||||||
interface JellyfinAlbumFiltersProps {
|
interface JellyfinAlbumFiltersProps {
|
||||||
customFilters?: Partial<AlbumListFilter>;
|
customFilters?: Partial<AlbumListFilter>;
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,19 @@ import debounce from 'lodash/debounce';
|
||||||
import { ChangeEvent, useMemo, useState } from 'react';
|
import { ChangeEvent, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import {
|
|
||||||
AlbumArtistListSort,
|
|
||||||
AlbumListQuery,
|
|
||||||
GenreListSort,
|
|
||||||
LibraryItem,
|
|
||||||
SortOrder,
|
|
||||||
} from '/@/renderer/api/types';
|
|
||||||
import { NumberInput, SpinnerIcon, Switch, Text } from '/@/renderer/components';
|
import { NumberInput, SpinnerIcon, Switch, Text } from '/@/renderer/components';
|
||||||
import { SelectWithInvalidData } from '/@/renderer/components/select-with-invalid-data';
|
import { SelectWithInvalidData } from '/@/renderer/components/select-with-invalid-data';
|
||||||
import { useAlbumArtistList } from '/@/renderer/features/artists/queries/album-artist-list-query';
|
import { useAlbumArtistList } from '/@/renderer/features/artists/queries/album-artist-list-query';
|
||||||
import { useGenreList } from '/@/renderer/features/genres';
|
import { useGenreList } from '/@/renderer/features/genres';
|
||||||
import { useTagList } from '/@/renderer/features/tag/queries/use-tag-list';
|
import { useTagList } from '/@/renderer/features/tag/queries/use-tag-list';
|
||||||
import { AlbumListFilter, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
|
import { AlbumListFilter, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
|
||||||
|
import {
|
||||||
|
AlbumArtistListSort,
|
||||||
|
AlbumListQuery,
|
||||||
|
GenreListSort,
|
||||||
|
LibraryItem,
|
||||||
|
SortOrder,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface NavidromeAlbumFiltersProps {
|
interface NavidromeAlbumFiltersProps {
|
||||||
customFilters?: Partial<AlbumListFilter>;
|
customFilters?: Partial<AlbumListFilter>;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,15 @@ import debounce from 'lodash/debounce';
|
||||||
import { ChangeEvent, useMemo } from 'react';
|
import { ChangeEvent, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { AlbumListQuery, GenreListSort, LibraryItem, SortOrder } from '/@/renderer/api/types';
|
|
||||||
import { NumberInput, Select, Switch, Text } from '/@/renderer/components';
|
import { NumberInput, Select, Switch, Text } from '/@/renderer/components';
|
||||||
import { useGenreList } from '/@/renderer/features/genres';
|
import { useGenreList } from '/@/renderer/features/genres';
|
||||||
import { AlbumListFilter, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
|
import { AlbumListFilter, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
|
||||||
|
import {
|
||||||
|
AlbumListQuery,
|
||||||
|
GenreListSort,
|
||||||
|
LibraryItem,
|
||||||
|
SortOrder,
|
||||||
|
} from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface SubsonicAlbumFiltersProps {
|
interface SubsonicAlbumFiltersProps {
|
||||||
onFilterChange: (filters: AlbumListFilter) => void;
|
onFilterChange: (filters: AlbumListFilter) => void;
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue