mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Lint all files
This commit is contained in:
parent
22af76b4d6
commit
30e52ebb54
334 changed files with 76519 additions and 75932 deletions
|
|
@ -7,32 +7,32 @@ import { useCurrentServer } from '/@/renderer/store';
|
|||
const localSettings = isElectron() ? window.electron.localSettings : null;
|
||||
|
||||
export const AppOutlet = () => {
|
||||
const currentServer = useCurrentServer();
|
||||
const currentServer = useCurrentServer();
|
||||
|
||||
const isActionsRequired = useMemo(() => {
|
||||
const isMpvRequired = () => {
|
||||
if (!isElectron()) return false;
|
||||
const mpvPath = localSettings.get('mpv_path');
|
||||
if (mpvPath) return false;
|
||||
return true;
|
||||
};
|
||||
const isActionsRequired = useMemo(() => {
|
||||
const isMpvRequired = () => {
|
||||
if (!isElectron()) return false;
|
||||
const mpvPath = localSettings.get('mpv_path');
|
||||
if (mpvPath) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
const isServerRequired = !currentServer;
|
||||
const isServerRequired = !currentServer;
|
||||
|
||||
const actions = [isServerRequired, isMpvRequired()];
|
||||
const isActionRequired = actions.some((c) => c);
|
||||
const actions = [isServerRequired, isMpvRequired()];
|
||||
const isActionRequired = actions.some((c) => c);
|
||||
|
||||
return isActionRequired;
|
||||
}, [currentServer]);
|
||||
return isActionRequired;
|
||||
}, [currentServer]);
|
||||
|
||||
if (isActionsRequired) {
|
||||
return (
|
||||
<Navigate
|
||||
replace
|
||||
to={AppRoute.ACTION_REQUIRED}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (isActionsRequired) {
|
||||
return (
|
||||
<Navigate
|
||||
replace
|
||||
to={AppRoute.ACTION_REQUIRED}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <Outlet />;
|
||||
return <Outlet />;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import isElectron from 'is-electron';
|
||||
import { lazy, Suspense } from 'react';
|
||||
import {
|
||||
Route,
|
||||
createRoutesFromElements,
|
||||
RouterProvider,
|
||||
createBrowserRouter,
|
||||
createHashRouter,
|
||||
Route,
|
||||
createRoutesFromElements,
|
||||
RouterProvider,
|
||||
createBrowserRouter,
|
||||
createHashRouter,
|
||||
} from 'react-router-dom';
|
||||
import { AppRoute } from './routes';
|
||||
import { DefaultLayout } from '/@/renderer/layouts';
|
||||
|
|
@ -13,7 +13,7 @@ import { AppOutlet } from '/@/renderer/router/app-outlet';
|
|||
import { TitlebarOutlet } from '/@/renderer/router/titlebar-outlet';
|
||||
|
||||
const NowPlayingRoute = lazy(
|
||||
() => import('/@/renderer/features/now-playing/routes/now-playing-route'),
|
||||
() => import('/@/renderer/features/now-playing/routes/now-playing-route'),
|
||||
);
|
||||
|
||||
const AlbumListRoute = lazy(() => import('/@/renderer/features/albums/routes/album-list-route'));
|
||||
|
|
@ -21,41 +21,41 @@ const AlbumListRoute = lazy(() => import('/@/renderer/features/albums/routes/alb
|
|||
const SongListRoute = lazy(() => import('/@/renderer/features/songs/routes/song-list-route'));
|
||||
|
||||
const PlaylistDetailRoute = lazy(
|
||||
() => import('/@/renderer/features/playlists/routes/playlist-detail-route'),
|
||||
() => import('/@/renderer/features/playlists/routes/playlist-detail-route'),
|
||||
);
|
||||
|
||||
const PlaylistDetailSongListRoute = lazy(
|
||||
() => import('/@/renderer/features/playlists/routes/playlist-detail-song-list-route'),
|
||||
() => import('/@/renderer/features/playlists/routes/playlist-detail-song-list-route'),
|
||||
);
|
||||
|
||||
const PlaylistListRoute = lazy(
|
||||
() => import('/@/renderer/features/playlists/routes/playlist-list-route'),
|
||||
() => import('/@/renderer/features/playlists/routes/playlist-list-route'),
|
||||
);
|
||||
|
||||
const ActionRequiredRoute = lazy(
|
||||
() => import('/@/renderer/features/action-required/routes/action-required-route'),
|
||||
() => import('/@/renderer/features/action-required/routes/action-required-route'),
|
||||
);
|
||||
|
||||
const InvalidRoute = lazy(
|
||||
() => import('/@/renderer/features/action-required/routes/invalid-route'),
|
||||
() => import('/@/renderer/features/action-required/routes/invalid-route'),
|
||||
);
|
||||
|
||||
const HomeRoute = lazy(() => import('/@/renderer/features/home/routes/home-route'));
|
||||
|
||||
const AlbumArtistListRoute = lazy(
|
||||
() => import('/@/renderer/features/artists/routes/album-artist-list-route'),
|
||||
() => import('/@/renderer/features/artists/routes/album-artist-list-route'),
|
||||
);
|
||||
|
||||
const AlbumArtistDetailRoute = lazy(
|
||||
() => import('/@/renderer/features/artists/routes/album-artist-detail-route'),
|
||||
() => import('/@/renderer/features/artists/routes/album-artist-detail-route'),
|
||||
);
|
||||
|
||||
const AlbumArtistDetailTopSongsListRoute = lazy(
|
||||
() => import('../features/artists/routes/album-artist-detail-top-songs-list-route'),
|
||||
() => import('../features/artists/routes/album-artist-detail-top-songs-list-route'),
|
||||
);
|
||||
|
||||
const AlbumDetailRoute = lazy(
|
||||
() => import('/@/renderer/features/albums/routes/album-detail-route'),
|
||||
() => import('/@/renderer/features/albums/routes/album-detail-route'),
|
||||
);
|
||||
|
||||
const SettingsRoute = lazy(() => import('/@/renderer/features/settings/routes/settings-route'));
|
||||
|
|
@ -63,125 +63,125 @@ const SettingsRoute = lazy(() => import('/@/renderer/features/settings/routes/se
|
|||
const SearchRoute = lazy(() => import('/@/renderer/features/search/routes/search-route'));
|
||||
|
||||
const RouteErrorBoundary = lazy(
|
||||
() => import('/@/renderer/features/action-required/components/route-error-boundary'),
|
||||
() => import('/@/renderer/features/action-required/components/route-error-boundary'),
|
||||
);
|
||||
|
||||
const dynamicRouter = isElectron() ? createHashRouter : createBrowserRouter;
|
||||
|
||||
export const AppRouter = () => {
|
||||
const router = dynamicRouter(
|
||||
createRoutesFromElements(
|
||||
<>
|
||||
<Route element={<TitlebarOutlet />}>
|
||||
<Route
|
||||
element={<AppOutlet />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
>
|
||||
<Route element={<DefaultLayout />}>
|
||||
<Route
|
||||
index
|
||||
element={<HomeRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
/>
|
||||
<Route
|
||||
element={<HomeRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.HOME}
|
||||
/>
|
||||
<Route
|
||||
element={<SearchRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.SEARCH}
|
||||
/>
|
||||
<Route
|
||||
element={<SettingsRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.SETTINGS}
|
||||
/>
|
||||
<Route
|
||||
element={<NowPlayingRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.NOW_PLAYING}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_ALBUMS}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumDetailRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_ALBUMS_DETAIL}
|
||||
/>
|
||||
<Route
|
||||
element={<SongListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_SONGS}
|
||||
/>
|
||||
<Route
|
||||
element={<PlaylistListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.PLAYLISTS}
|
||||
/>
|
||||
<Route
|
||||
element={<PlaylistDetailRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.PLAYLISTS_DETAIL}
|
||||
/>
|
||||
<Route
|
||||
element={<PlaylistDetailSongListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.PLAYLISTS_DETAIL_SONGS}
|
||||
/>
|
||||
<Route
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS}
|
||||
>
|
||||
<Route
|
||||
index
|
||||
element={<AlbumArtistListRoute />}
|
||||
/>
|
||||
<Route path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL}>
|
||||
<Route
|
||||
index
|
||||
element={<AlbumArtistDetailRoute />}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumListRoute />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_DISCOGRAPHY}
|
||||
/>
|
||||
<Route
|
||||
element={<SongListRoute />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_SONGS}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumArtistDetailTopSongsListRoute />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_TOP_SONGS}
|
||||
/>
|
||||
const router = dynamicRouter(
|
||||
createRoutesFromElements(
|
||||
<>
|
||||
<Route element={<TitlebarOutlet />}>
|
||||
<Route
|
||||
element={<AppOutlet />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
>
|
||||
<Route element={<DefaultLayout />}>
|
||||
<Route
|
||||
index
|
||||
element={<HomeRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
/>
|
||||
<Route
|
||||
element={<HomeRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.HOME}
|
||||
/>
|
||||
<Route
|
||||
element={<SearchRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.SEARCH}
|
||||
/>
|
||||
<Route
|
||||
element={<SettingsRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.SETTINGS}
|
||||
/>
|
||||
<Route
|
||||
element={<NowPlayingRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.NOW_PLAYING}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_ALBUMS}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumDetailRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_ALBUMS_DETAIL}
|
||||
/>
|
||||
<Route
|
||||
element={<SongListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_SONGS}
|
||||
/>
|
||||
<Route
|
||||
element={<PlaylistListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.PLAYLISTS}
|
||||
/>
|
||||
<Route
|
||||
element={<PlaylistDetailRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.PLAYLISTS_DETAIL}
|
||||
/>
|
||||
<Route
|
||||
element={<PlaylistDetailSongListRoute />}
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.PLAYLISTS_DETAIL_SONGS}
|
||||
/>
|
||||
<Route
|
||||
errorElement={<RouteErrorBoundary />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS}
|
||||
>
|
||||
<Route
|
||||
index
|
||||
element={<AlbumArtistListRoute />}
|
||||
/>
|
||||
<Route path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL}>
|
||||
<Route
|
||||
index
|
||||
element={<AlbumArtistDetailRoute />}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumListRoute />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_DISCOGRAPHY}
|
||||
/>
|
||||
<Route
|
||||
element={<SongListRoute />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_SONGS}
|
||||
/>
|
||||
<Route
|
||||
element={<AlbumArtistDetailTopSongsListRoute />}
|
||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_TOP_SONGS}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route
|
||||
element={<InvalidRoute />}
|
||||
path="*"
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route
|
||||
element={<InvalidRoute />}
|
||||
path="*"
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
<Route element={<TitlebarOutlet />}>
|
||||
<Route element={<DefaultLayout shell />}>
|
||||
<Route
|
||||
element={<ActionRequiredRoute />}
|
||||
path={AppRoute.ACTION_REQUIRED}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</>,
|
||||
),
|
||||
);
|
||||
<Route element={<TitlebarOutlet />}>
|
||||
<Route element={<DefaultLayout shell />}>
|
||||
<Route
|
||||
element={<ActionRequiredRoute />}
|
||||
path={AppRoute.ACTION_REQUIRED}
|
||||
/>
|
||||
</Route>
|
||||
</Route>
|
||||
</>,
|
||||
),
|
||||
);
|
||||
|
||||
return (
|
||||
<Suspense fallback={<></>}>
|
||||
<RouterProvider router={router} />
|
||||
</Suspense>
|
||||
);
|
||||
return (
|
||||
<Suspense fallback={<></>}>
|
||||
<RouterProvider router={router} />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
export enum AppRoute {
|
||||
ACTION_REQUIRED = '/action-required',
|
||||
EXPLORE = '/explore',
|
||||
HOME = '/',
|
||||
LIBRARY_ALBUMS = '/library/albums',
|
||||
LIBRARY_ALBUMS_DETAIL = '/library/albums/:albumId',
|
||||
LIBRARY_ALBUM_ARTISTS = '/library/album-artists',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL = '/library/album-artists/:albumArtistId',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL_DISCOGRAPHY = '/library/album-artists/:albumArtistId/discography',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL_SONGS = '/library/album-artists/:albumArtistId/songs',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL_TOP_SONGS = '/library/album-artists/:albumArtistId/top-songs',
|
||||
LIBRARY_ARTISTS = '/library/artists',
|
||||
LIBRARY_ARTISTS_DETAIL = '/library/artists/:artistId',
|
||||
LIBRARY_FOLDERS = '/library/folders',
|
||||
LIBRARY_GENRES = '/library/genres',
|
||||
LIBRARY_SONGS = '/library/songs',
|
||||
NOW_PLAYING = '/now-playing',
|
||||
PLAYING = '/playing',
|
||||
PLAYLISTS = '/playlists',
|
||||
PLAYLISTS_DETAIL = '/playlists/:playlistId',
|
||||
PLAYLISTS_DETAIL_SONGS = '/playlists/:playlistId/songs',
|
||||
SEARCH = '/search/:itemType',
|
||||
SERVERS = '/servers',
|
||||
SETTINGS = '/settings',
|
||||
ACTION_REQUIRED = '/action-required',
|
||||
EXPLORE = '/explore',
|
||||
HOME = '/',
|
||||
LIBRARY_ALBUMS = '/library/albums',
|
||||
LIBRARY_ALBUMS_DETAIL = '/library/albums/:albumId',
|
||||
LIBRARY_ALBUM_ARTISTS = '/library/album-artists',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL = '/library/album-artists/:albumArtistId',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL_DISCOGRAPHY = '/library/album-artists/:albumArtistId/discography',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL_SONGS = '/library/album-artists/:albumArtistId/songs',
|
||||
LIBRARY_ALBUM_ARTISTS_DETAIL_TOP_SONGS = '/library/album-artists/:albumArtistId/top-songs',
|
||||
LIBRARY_ARTISTS = '/library/artists',
|
||||
LIBRARY_ARTISTS_DETAIL = '/library/artists/:artistId',
|
||||
LIBRARY_FOLDERS = '/library/folders',
|
||||
LIBRARY_GENRES = '/library/genres',
|
||||
LIBRARY_SONGS = '/library/songs',
|
||||
NOW_PLAYING = '/now-playing',
|
||||
PLAYING = '/playing',
|
||||
PLAYLISTS = '/playlists',
|
||||
PLAYLISTS_DETAIL = '/playlists/:playlistId',
|
||||
PLAYLISTS_DETAIL_SONGS = '/playlists/:playlistId/songs',
|
||||
SEARCH = '/search/:itemType',
|
||||
SERVERS = '/servers',
|
||||
SETTINGS = '/settings',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,26 +5,26 @@ import { useWindowSettings } from '/@/renderer/store/settings.store';
|
|||
import { Platform } from '/@/renderer/types';
|
||||
|
||||
const TitlebarContainer = styled.header`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 5000;
|
||||
height: 65px;
|
||||
background: var(--titlebar-controls-bg);
|
||||
-webkit-app-region: drag;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 5000;
|
||||
height: 65px;
|
||||
background: var(--titlebar-controls-bg);
|
||||
-webkit-app-region: drag;
|
||||
`;
|
||||
|
||||
export const TitlebarOutlet = () => {
|
||||
const { windowBarStyle } = useWindowSettings();
|
||||
const { windowBarStyle } = useWindowSettings();
|
||||
|
||||
return (
|
||||
<>
|
||||
{windowBarStyle === Platform.WEB && (
|
||||
<TitlebarContainer>
|
||||
<Titlebar />
|
||||
</TitlebarContainer>
|
||||
)}
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{windowBarStyle === Platform.WEB && (
|
||||
<TitlebarContainer>
|
||||
<Titlebar />
|
||||
</TitlebarContainer>
|
||||
)}
|
||||
<Outlet />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue