mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 18:33:33 +00:00
feat: add context menu on left controls and sidebar image
This commit is contained in:
parent
c36735575f
commit
65ecdc7666
2 changed files with 38 additions and 3 deletions
|
|
@ -46,6 +46,11 @@ export const LeftControls = () => {
|
|||
);
|
||||
|
||||
const handleToggleFullScreenPlayer = (e?: KeyboardEvent | MouseEvent<HTMLDivElement>) => {
|
||||
// don't toggle if right click
|
||||
if (e && 'button' in e && e.button === 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
e?.stopPropagation();
|
||||
setFullScreenPlayerStore({ expanded: !isFullScreenPlayerExpanded });
|
||||
};
|
||||
|
|
@ -55,6 +60,15 @@ export const LeftControls = () => {
|
|||
setSideBar({ image: true });
|
||||
};
|
||||
|
||||
const handleToggleContextMenu = (e: MouseEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (isSongDefined && !isFullScreenPlayerExpanded) {
|
||||
handleGeneralContextMenu(e, [currentSong!]);
|
||||
}
|
||||
};
|
||||
|
||||
const stopPropagation = (e?: MouseEvent) => e?.stopPropagation();
|
||||
|
||||
useHotkeys([
|
||||
|
|
@ -79,6 +93,7 @@ export const LeftControls = () => {
|
|||
initial={{ opacity: 0, x: -50 }}
|
||||
key="playerbar-image"
|
||||
onClick={handleToggleFullScreenPlayer}
|
||||
onContextMenu={handleToggleContextMenu}
|
||||
role="button"
|
||||
transition={{ duration: 0.2, ease: 'easeIn' }}
|
||||
>
|
||||
|
|
@ -127,6 +142,7 @@ export const LeftControls = () => {
|
|||
component={Link}
|
||||
fw={500}
|
||||
isLink
|
||||
onContextMenu={handleToggleContextMenu} // Ajout du clic droit
|
||||
overflow="hidden"
|
||||
to={AppRoute.NOW_PLAYING}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue