Skip to content

Commit

Permalink
Fix clear rating hotkey (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanDarknes authored Oct 31, 2023
1 parent cf9c7e2 commit 11863fd
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/renderer/features/player/components/right-controls.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEvent, useEffect } from 'react';
import { useEffect } from 'react';
import { Flex, Group } from '@mantine/core';
import { useHotkeys, useMediaQuery } from '@mantine/hooks';
import isElectron from 'is-electron';
Expand Down Expand Up @@ -82,18 +82,6 @@ export const RightControls = () => {
});
};

const handleClearRating = (_e: MouseEvent<HTMLDivElement> | null, rating?: number) => {
if (!currentSong || !rating) return;

updateRatingMutation.mutate({
query: {
item: [currentSong],
rating: 0,
},
serverId: currentSong?.serverId,
});
};

const handleRemoveFromFavorites = (song: QueueSong | undefined) => {
if (!song?.id) return;

Expand Down Expand Up @@ -152,7 +140,7 @@ export const RightControls = () => {
bindings.favoritePreviousToggle.isGlobal ? '' : bindings.favoritePreviousToggle.hotkey,
() => handleToggleFavorite(previousSong),
],
[bindings.rate0.isGlobal ? '' : bindings.rate0.hotkey, () => handleClearRating(null, 0)],
[bindings.rate0.isGlobal ? '' : bindings.rate0.hotkey, () => handleUpdateRating(0)],
[bindings.rate1.isGlobal ? '' : bindings.rate1.hotkey, () => handleUpdateRating(1)],
[bindings.rate2.isGlobal ? '' : bindings.rate2.hotkey, () => handleUpdateRating(2)],
[bindings.rate3.isGlobal ? '' : bindings.rate3.hotkey, () => handleUpdateRating(3)],
Expand Down

1 comment on commit 11863fd

@vercel
Copy link

@vercel vercel bot commented on 11863fd Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

feishin – ./

feishin-git-development-jeffvli.vercel.app
feishin.vercel.app
feishin-jeffvli.vercel.app

Please sign in to comment.