mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 20:40:15 +02:00
Add Lyrics button to right-controls. (#1363)
* Add Microphone icon to right-controls to show/hide lyrics.
This commit is contained in:
@@ -13,16 +13,19 @@ import {
|
||||
useAppStoreActions,
|
||||
useAutoDJSettings,
|
||||
useCurrentServer,
|
||||
useFullScreenPlayerStore,
|
||||
useGeneralSettings,
|
||||
useHotkeySettings,
|
||||
usePlayerData,
|
||||
usePlayerMuted,
|
||||
usePlayerSong,
|
||||
usePlayerVolume,
|
||||
useSetFullScreenPlayerStore,
|
||||
useSettingsStore,
|
||||
useSettingsStoreActions,
|
||||
useSidebarRightExpanded,
|
||||
} from '/@/renderer/store';
|
||||
import { useFullScreenPlayerStoreActions } from '/@/renderer/store/full-screen-player.store';
|
||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||
import { Button } from '/@/shared/components/button/button';
|
||||
import { Flex } from '/@/shared/components/flex/flex';
|
||||
@@ -66,6 +69,7 @@ export const RightControls = () => {
|
||||
</Group>
|
||||
<Group align="center" gap="xs" wrap="nowrap">
|
||||
<PlayerConfig />
|
||||
<LyricsButton />
|
||||
<FavoriteButton />
|
||||
<QueueButton />
|
||||
<VolumeButton />
|
||||
@@ -147,6 +151,40 @@ const QueueButton = () => {
|
||||
return <PopoverPlayQueue />;
|
||||
};
|
||||
|
||||
const LyricsButton = () => {
|
||||
const setFullScreenPlayerStore = useSetFullScreenPlayerStore();
|
||||
const activeTab = useFullScreenPlayerStore((state) => state.activeTab);
|
||||
|
||||
const { setStore } = useFullScreenPlayerStoreActions();
|
||||
const { expanded: isFullScreenPlayerExpanded } = useFullScreenPlayerStore();
|
||||
|
||||
const expandFullScreenPlayer = () => {
|
||||
setFullScreenPlayerStore({ expanded: !isFullScreenPlayerExpanded });
|
||||
};
|
||||
|
||||
return (
|
||||
<ActionIcon
|
||||
icon="microphone"
|
||||
iconProps={{
|
||||
color: activeTab === 'lyrics' && isFullScreenPlayerExpanded ? 'primary' : undefined,
|
||||
size: 'lg',
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!isFullScreenPlayerExpanded) setStore({ activeTab: 'lyrics' });
|
||||
expandFullScreenPlayer();
|
||||
}}
|
||||
role="button"
|
||||
size="sm"
|
||||
tooltip={{
|
||||
label: t('player.lyrics', { postProcess: 'titleCase' }),
|
||||
openDelay: 0,
|
||||
}}
|
||||
variant="subtle"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const FavoriteButton = () => {
|
||||
const currentSong = usePlayerSong();
|
||||
const { bindings } = useHotkeySettings();
|
||||
|
||||
Reference in New Issue
Block a user