mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-16 08:24:16 +02:00
move player context and audioplayers inside of router
This commit is contained in:
@@ -11,8 +11,6 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
import { useDiscordRpc } from '/@/renderer/features/discord-rpc/use-discord-rpc';
|
import { useDiscordRpc } from '/@/renderer/features/discord-rpc/use-discord-rpc';
|
||||||
import { AudioPlayers } from '/@/renderer/features/player/components/audio-players';
|
|
||||||
import { PlayerProvider } from '/@/renderer/features/player/context/player-context';
|
|
||||||
import { WebAudioContext } from '/@/renderer/features/player/context/webaudio-context';
|
import { WebAudioContext } from '/@/renderer/features/player/context/webaudio-context';
|
||||||
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';
|
||||||
@@ -86,10 +84,7 @@ export const App = () => {
|
|||||||
zIndex={50000}
|
zIndex={50000}
|
||||||
/>
|
/>
|
||||||
<WebAudioContext.Provider value={webAudioProvider}>
|
<WebAudioContext.Provider value={webAudioProvider}>
|
||||||
<PlayerProvider>
|
<AppRouter />
|
||||||
<AppRouter />
|
|
||||||
<AudioPlayers />
|
|
||||||
</PlayerProvider>
|
|
||||||
</WebAudioContext.Provider>
|
</WebAudioContext.Provider>
|
||||||
<IsUpdatedDialog />
|
<IsUpdatedDialog />
|
||||||
</MantineProvider>
|
</MantineProvider>
|
||||||
|
|||||||
+125
-115
@@ -2,6 +2,8 @@ import { lazy, Suspense } from 'react';
|
|||||||
import { HashRouter, Route, Routes } from 'react-router';
|
import { HashRouter, Route, Routes } from 'react-router';
|
||||||
|
|
||||||
import { RouterErrorBoundary } from '/@/renderer/components/error-boundary/router-error-boundary';
|
import { RouterErrorBoundary } from '/@/renderer/components/error-boundary/router-error-boundary';
|
||||||
|
import { AudioPlayers } from '/@/renderer/features/player/components/audio-players';
|
||||||
|
import { PlayerProvider } from '/@/renderer/features/player/context/player-context';
|
||||||
import { AddToPlaylistContextModal } from '/@/renderer/features/playlists/components/add-to-playlist-context-modal';
|
import { AddToPlaylistContextModal } from '/@/renderer/features/playlists/components/add-to-playlist-context-modal';
|
||||||
import { ShareItemContextModal } from '/@/renderer/features/sharing/components/share-item-context-modal';
|
import { ShareItemContextModal } from '/@/renderer/features/sharing/components/share-item-context-modal';
|
||||||
import { ResponsiveLayout } from '/@/renderer/layouts/responsive-layout';
|
import { ResponsiveLayout } from '/@/renderer/layouts/responsive-layout';
|
||||||
@@ -74,147 +76,155 @@ export const AppRouter = () => {
|
|||||||
const router = (
|
const router = (
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<RouterErrorBoundary>
|
<RouterErrorBoundary>
|
||||||
<ModalsProvider
|
<PlayerProvider>
|
||||||
modals={{
|
<AudioPlayers />
|
||||||
addToPlaylist: AddToPlaylistContextModal,
|
<ModalsProvider
|
||||||
base: BaseContextModal,
|
modals={{
|
||||||
shareItem: ShareItemContextModal,
|
addToPlaylist: AddToPlaylistContextModal,
|
||||||
}}
|
base: BaseContextModal,
|
||||||
>
|
shareItem: ShareItemContextModal,
|
||||||
<Routes>
|
}}
|
||||||
<Route element={<TitlebarOutlet />}>
|
>
|
||||||
<Route element={<AppOutlet />} errorElement={<RouteErrorBoundary />}>
|
<Routes>
|
||||||
<Route element={<ResponsiveLayout />}>
|
<Route element={<TitlebarOutlet />}>
|
||||||
<Route
|
<Route
|
||||||
element={<HomeRoute />}
|
element={<AppOutlet />}
|
||||||
errorElement={<RouteErrorBoundary />}
|
errorElement={<RouteErrorBoundary />}
|
||||||
index
|
>
|
||||||
/>
|
<Route element={<ResponsiveLayout />}>
|
||||||
<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 path={AppRoute.LIBRARY_GENRES}>
|
|
||||||
<Route
|
<Route
|
||||||
element={<GenreListRoute />}
|
element={<HomeRoute />}
|
||||||
errorElement={<RouteErrorBoundary />}
|
errorElement={<RouteErrorBoundary />}
|
||||||
index
|
index
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={<AlbumListRoute />}
|
element={<HomeRoute />}
|
||||||
path={AppRoute.LIBRARY_GENRES_ALBUMS}
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.HOME}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={<SongListRoute />}
|
element={<SearchRoute />}
|
||||||
path={AppRoute.LIBRARY_GENRES_SONGS}
|
errorElement={<RouteErrorBoundary />}
|
||||||
/>
|
path={AppRoute.SEARCH}
|
||||||
</Route>
|
|
||||||
<Route
|
|
||||||
element={<AlbumListRoute />}
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.LIBRARY_ALBUMS}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
element={<AlbumDetailRoute />}
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.LIBRARY_ALBUMS_DETAIL}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
element={<ArtistListRoute />}
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.LIBRARY_ARTISTS}
|
|
||||||
/>
|
|
||||||
<Route path={AppRoute.LIBRARY_ARTISTS_DETAIL}>
|
|
||||||
<Route element={<AlbumArtistDetailRoute />} index />
|
|
||||||
<Route
|
|
||||||
element={<AlbumListRoute />}
|
|
||||||
path={AppRoute.LIBRARY_ARTISTS_DETAIL_DISCOGRAPHY}
|
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={<SongListRoute />}
|
element={<SettingsRoute />}
|
||||||
path={AppRoute.LIBRARY_ARTISTS_DETAIL_SONGS}
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.SETTINGS}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={<AlbumArtistDetailTopSongsListRoute />}
|
element={<NowPlayingRoute />}
|
||||||
path={AppRoute.LIBRARY_ARTISTS_DETAIL_TOP_SONGS}
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.NOW_PLAYING}
|
||||||
/>
|
/>
|
||||||
</Route>
|
<Route path={AppRoute.LIBRARY_GENRES}>
|
||||||
<Route
|
<Route
|
||||||
element={<DummyAlbumDetailRoute />}
|
element={<GenreListRoute />}
|
||||||
errorElement={<RouteErrorBoundary />}
|
errorElement={<RouteErrorBoundary />}
|
||||||
path={AppRoute.FAKE_LIBRARY_ALBUM_DETAILS}
|
index
|
||||||
/>
|
/>
|
||||||
<Route
|
|
||||||
element={<SongListRoute />}
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.LIBRARY_SONGS}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
element={<PlaylistListRoute />}
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.PLAYLISTS}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
element={<PlaylistDetailSongListRoute />}
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.PLAYLISTS_DETAIL_SONGS}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
errorElement={<RouteErrorBoundary />}
|
|
||||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS}
|
|
||||||
>
|
|
||||||
<Route element={<AlbumArtistListRoute />} index />
|
|
||||||
<Route path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL}>
|
|
||||||
<Route element={<AlbumArtistDetailRoute />} index />
|
|
||||||
<Route
|
<Route
|
||||||
element={<AlbumListRoute />}
|
element={<AlbumListRoute />}
|
||||||
path={
|
path={AppRoute.LIBRARY_GENRES_ALBUMS}
|
||||||
AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_DISCOGRAPHY
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={<SongListRoute />}
|
element={<SongListRoute />}
|
||||||
path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_SONGS}
|
path={AppRoute.LIBRARY_GENRES_SONGS}
|
||||||
|
/>
|
||||||
|
</Route>
|
||||||
|
<Route
|
||||||
|
element={<AlbumListRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.LIBRARY_ALBUMS}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
element={<AlbumDetailRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.LIBRARY_ALBUMS_DETAIL}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
element={<ArtistListRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.LIBRARY_ARTISTS}
|
||||||
|
/>
|
||||||
|
<Route path={AppRoute.LIBRARY_ARTISTS_DETAIL}>
|
||||||
|
<Route element={<AlbumArtistDetailRoute />} index />
|
||||||
|
<Route
|
||||||
|
element={<AlbumListRoute />}
|
||||||
|
path={AppRoute.LIBRARY_ARTISTS_DETAIL_DISCOGRAPHY}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
element={<SongListRoute />}
|
||||||
|
path={AppRoute.LIBRARY_ARTISTS_DETAIL_SONGS}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={<AlbumArtistDetailTopSongsListRoute />}
|
element={<AlbumArtistDetailTopSongsListRoute />}
|
||||||
path={
|
path={AppRoute.LIBRARY_ARTISTS_DETAIL_TOP_SONGS}
|
||||||
AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL_TOP_SONGS
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
|
<Route
|
||||||
|
element={<DummyAlbumDetailRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.FAKE_LIBRARY_ALBUM_DETAILS}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
element={<SongListRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.LIBRARY_SONGS}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
element={<PlaylistListRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.PLAYLISTS}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
element={<PlaylistDetailSongListRoute />}
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.PLAYLISTS_DETAIL_SONGS}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
errorElement={<RouteErrorBoundary />}
|
||||||
|
path={AppRoute.LIBRARY_ALBUM_ARTISTS}
|
||||||
|
>
|
||||||
|
<Route element={<AlbumArtistListRoute />} index />
|
||||||
|
<Route path={AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL}>
|
||||||
|
<Route element={<AlbumArtistDetailRoute />} index />
|
||||||
|
<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 element={<InvalidRoute />} path="*" />
|
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
<Route element={<TitlebarOutlet />}>
|
||||||
<Route element={<TitlebarOutlet />}>
|
<Route element={<ResponsiveLayout shell />}>
|
||||||
<Route element={<ResponsiveLayout shell />}>
|
<Route
|
||||||
<Route
|
element={<ActionRequiredRoute />}
|
||||||
element={<ActionRequiredRoute />}
|
path={AppRoute.ACTION_REQUIRED}
|
||||||
path={AppRoute.ACTION_REQUIRED}
|
/>
|
||||||
/>
|
<Route element={<LoginRoute />} path={AppRoute.LOGIN} />
|
||||||
<Route element={<LoginRoute />} path={AppRoute.LOGIN} />
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Routes>
|
||||||
</Routes>
|
</ModalsProvider>
|
||||||
</ModalsProvider>
|
</PlayerProvider>
|
||||||
</RouterErrorBoundary>
|
</RouterErrorBoundary>
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user