diff --git a/.github/workflows/publish-macos.yml b/.github/workflows/publish-macos.yml index e1d336ece..4d81d3241 100644 --- a/.github/workflows/publish-macos.yml +++ b/.github/workflows/publish-macos.yml @@ -24,6 +24,7 @@ jobs: - name: Build and Publish releases env: + NODE_OPTIONS: --max-old-space-size=4096 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} uses: nick-invision/retry@v3.0.2 with: diff --git a/src/main/features/index.ts b/src/main/features/index.ts index 23184e542..9e1e86f9e 100644 --- a/src/main/features/index.ts +++ b/src/main/features/index.ts @@ -1,2 +1,9 @@ import './core'; -import(`./${process.platform}`); + +if (process.platform === 'linux') { + import('./linux'); +} else if (process.platform === 'darwin') { + import('./darwin'); +} else if (process.platform === 'win32') { + import('./win32'); +} diff --git a/src/main/features/win32/index.ts b/src/main/features/win32/index.ts index e69de29bb..cb0ff5c3b 100644 --- a/src/main/features/win32/index.ts +++ b/src/main/features/win32/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/preload/discord-rpc.ts b/src/preload/discord-rpc.ts index 5490aef6a..cc0ed1108 100644 --- a/src/preload/discord-rpc.ts +++ b/src/preload/discord-rpc.ts @@ -1,4 +1,5 @@ -import { SetActivity } from '@xhayper/discord-rpc'; +import type { SetActivity } from '@xhayper/discord-rpc'; + import { ipcRenderer } from 'electron'; const initialize = (clientId: string) => { diff --git a/src/renderer/app.tsx b/src/renderer/app.tsx index d32580dc0..2e6cfd02b 100644 --- a/src/renderer/app.tsx +++ b/src/renderer/app.tsx @@ -22,12 +22,7 @@ import { WebAudio } from '/@/shared/types/types'; import '/@/shared/styles/global.css'; import { PlayerProvider } from '/@/renderer/features/player/context/player-context'; import { AudioPlayers } from '/@/renderer/features/player/components/audio-players'; - -const ReleaseNotesModal = lazy(() => - import('./release-notes-modal').then((module) => ({ - default: module.ReleaseNotesModal, - })), -); +import { ReleaseNotesModal } from '/@/renderer/release-notes-modal'; const UpdateAvailableDialog = lazy(() => import('./update-available-dialog').then((module) => ({ @@ -82,8 +77,8 @@ const AppShell = memo(function AppShell() { + - diff --git a/src/renderer/features/discord-rpc/use-discord-rpc.ts b/src/renderer/features/discord-rpc/use-discord-rpc.ts index 63a81703a..eb2edb9fc 100644 --- a/src/renderer/features/discord-rpc/use-discord-rpc.ts +++ b/src/renderer/features/discord-rpc/use-discord-rpc.ts @@ -1,4 +1,5 @@ -import { SetActivity, StatusDisplayType } from '@xhayper/discord-rpc'; +import type { SetActivity } from '@xhayper/discord-rpc'; + import isElectron from 'is-electron'; import React, { useCallback, useEffect, useRef, useState } from 'react'; @@ -27,6 +28,13 @@ import { LibraryItem, QueueSong, ServerType } from '/@/shared/types/domain-types import { PlayerStatus } from '/@/shared/types/types'; const discordRpc = isElectron() ? window.api.discordRpc : null; + +const DiscordStatusDisplayType = { + DETAILS: 2, + NAME: 0, + STATE: 1, +} as const; + type ActivityState = [QueueSong | undefined, number, PlayerStatus]; const MAX_FIELD_LENGTH = 127; @@ -122,7 +130,7 @@ export const useDiscordRpc = () => { : undefined : sentenceCase(current[2]), state: truncate(artist), - statusDisplayType: StatusDisplayType.STATE, + statusDisplayType: DiscordStatusDisplayType.STATE, type: discordSettings.showAsListening ? 2 : 0, }; @@ -196,9 +204,9 @@ export const useDiscordRpc = () => { const artists = song?.artists.map((artist) => artist.name).join(', '); const statusDisplayMap = { - [DiscordDisplayType.ARTIST_NAME]: StatusDisplayType.STATE, - [DiscordDisplayType.FEISHIN]: StatusDisplayType.NAME, - [DiscordDisplayType.SONG_NAME]: StatusDisplayType.DETAILS, + [DiscordDisplayType.ARTIST_NAME]: DiscordStatusDisplayType.STATE, + [DiscordDisplayType.FEISHIN]: DiscordStatusDisplayType.NAME, + [DiscordDisplayType.SONG_NAME]: DiscordStatusDisplayType.DETAILS, }; const activity: SetActivity = { diff --git a/src/renderer/layouts/mobile-layout/mobile-layout.tsx b/src/renderer/layouts/mobile-layout/mobile-layout.tsx index b08d694a3..39d39db29 100644 --- a/src/renderer/layouts/mobile-layout/mobile-layout.tsx +++ b/src/renderer/layouts/mobile-layout/mobile-layout.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import { AnimatePresence } from 'motion/react'; -import { lazy, Suspense } from 'react'; +import { Suspense } from 'react'; import { Outlet } from 'react-router'; import styles from './mobile-layout.module.css'; @@ -10,6 +10,7 @@ import { FullScreenVisualizer } from '/@/renderer/features/player/components/ful import { MobileFullscreenPlayer } from '/@/renderer/features/player/components/mobile-fullscreen-player'; import { MobileSidebar } from '/@/renderer/features/sidebar/components/mobile-sidebar'; import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar'; +import { WindowBar } from '/@/renderer/layouts/window-bar'; import { useFullScreenPlayerOverlayState, useWindowBarStyle } from '/@/renderer/store'; import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { Drawer } from '/@/shared/components/drawer/drawer'; @@ -17,12 +18,6 @@ import { Spinner } from '/@/shared/components/spinner/spinner'; import { useDisclosure } from '/@/shared/hooks/use-disclosure'; import { Platform } from '/@/shared/types/types'; -const WindowBar = lazy(() => - import('/@/renderer/layouts/window-bar').then((module) => ({ - default: module.WindowBar, - })), -); - interface MobileLayoutProps { shell?: boolean; } diff --git a/src/renderer/router/app-router.tsx b/src/renderer/router/app-router.tsx index a44016cd2..9bec7ac28 100644 --- a/src/renderer/router/app-router.tsx +++ b/src/renderer/router/app-router.tsx @@ -1,6 +1,7 @@ import { lazy, Suspense } from 'react'; import { HashRouter, Route, Routes } from 'react-router'; +import { ShuffleAllContextModal } from '/@/renderer/features/player/components/shuffle-all-modal'; import { RouterErrorBoundary } from '/@/renderer/features/shared/components/router-error-boundary'; import { AuthenticationOutlet } from '/@/renderer/layouts/authentication-outlet'; import { ResponsiveLayout } from '/@/renderer/layouts/responsive-layout'; @@ -96,18 +97,6 @@ const LyricsSettingsContextModal = (props: any) => ( ); -const LazyShuffleAllContextModal = lazy(() => - import('/@/renderer/features/player/components/shuffle-all-modal').then((module) => ({ - default: module.ShuffleAllContextModal, - })), -); - -const ShuffleAllContextModal = (props: any) => ( - }> - - -); - const LazyAddToPlaylistContextModal = lazy(() => import('/@/renderer/features/playlists/components/add-to-playlist-context-modal').then( (module) => ({