mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 20:40:21 +02:00
add player autodj (#7)
This commit is contained in:
@@ -7,6 +7,7 @@ import { useDiscordRpc } from '/@/renderer/features/discord-rpc/use-discord-rpc'
|
||||
import { useMainPlayerListener } from '/@/renderer/features/player/audio-player/hooks/use-main-player-listener';
|
||||
import { MpvPlayer } from '/@/renderer/features/player/audio-player/mpv-player';
|
||||
import { WebPlayer } from '/@/renderer/features/player/audio-player/web-player';
|
||||
import { useAutoDJ } from '/@/renderer/features/player/hooks/use-auto-dj';
|
||||
import { useMediaSession } from '/@/renderer/features/player/hooks/use-media-session';
|
||||
import { useMPRIS } from '/@/renderer/features/player/hooks/use-mpris';
|
||||
import { usePlaybackHotkeys } from '/@/renderer/features/player/hooks/use-playback-hotkeys';
|
||||
@@ -44,6 +45,7 @@ export const AudioPlayers = () => {
|
||||
useMainPlayerListener();
|
||||
useMediaSession();
|
||||
usePlaybackHotkeys();
|
||||
useAutoDJ();
|
||||
|
||||
useEffect(() => {
|
||||
if (webAudio && 'AudioContext' in window) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useDeleteFavorite } from '/@/renderer/features/shared/mutations/delete-
|
||||
import { useSetRating } from '/@/renderer/features/shared/mutations/set-rating-mutation';
|
||||
import {
|
||||
useAppStoreActions,
|
||||
useAutoDJSettings,
|
||||
useCurrentServer,
|
||||
useGeneralSettings,
|
||||
useHotkeySettings,
|
||||
@@ -19,9 +20,11 @@ import {
|
||||
usePlayerSong,
|
||||
usePlayerVolume,
|
||||
useSettingsStore,
|
||||
useSettingsStoreActions,
|
||||
useSidebarRightExpanded,
|
||||
} from '/@/renderer/store';
|
||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||
import { Button } from '/@/shared/components/button/button';
|
||||
import { Flex } from '/@/shared/components/flex/flex';
|
||||
import { Group } from '/@/shared/components/group/group';
|
||||
import { Rating } from '/@/shared/components/rating/rating';
|
||||
@@ -58,6 +61,7 @@ export const RightControls = () => {
|
||||
<Flex align="flex-end" direction="column" h="100%" px="1rem" py="0.5rem">
|
||||
<Group h="calc(100% / 3)">
|
||||
<RatingButton />
|
||||
<AutoDJButton />
|
||||
</Group>
|
||||
<Group align="center" gap="xs" wrap="nowrap">
|
||||
<PlayerConfig />
|
||||
@@ -70,6 +74,33 @@ export const RightControls = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const AutoDJButton = () => {
|
||||
const { t } = useTranslation();
|
||||
const settings = useAutoDJSettings();
|
||||
const { setSettings } = useSettingsStoreActions();
|
||||
|
||||
const toggleAutoDJ = () => {
|
||||
setSettings({
|
||||
autoDJ: {
|
||||
...settings,
|
||||
enabled: !settings.enabled,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={toggleAutoDJ}
|
||||
size="compact-xs"
|
||||
style={{ color: settings.enabled ? 'var(--theme-colors-primary)' : undefined }}
|
||||
uppercase
|
||||
variant="transparent"
|
||||
>
|
||||
{t('setting.autoDJ')}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
const QueueButton = () => {
|
||||
const { t } = useTranslation();
|
||||
const isSidebarRightExpanded = useSidebarRightExpanded();
|
||||
|
||||
Reference in New Issue
Block a user