fix set rating click on context menu (#900)

- star rating icon overriddes the pointer click event
This commit is contained in:
jeffvli 2025-05-06 18:23:14 -07:00
parent 262203b62d
commit ec0e7256cb

View file

@ -97,6 +97,18 @@ const JELLYFIN_IGNORED_MENU_ITEMS: ContextMenuItemType[] = ['setRating', 'shareI
const utils = isElectron() ? window.electron.utils : null; const utils = isElectron() ? window.electron.utils : null;
function RatingIcon({ rating }: { rating: number }) {
return (
<Rating
readOnly
style={{
pointerEvents: 'none',
}}
value={rating}
/>
);
}
export interface ContextMenuProviderProps { export interface ContextMenuProviderProps {
children: ReactNode; children: ReactNode;
} }
@ -835,62 +847,32 @@ export const ContextMenuProvider = ({ children }: ContextMenuProviderProps) => {
children: [ children: [
{ {
id: 'zeroStar', id: 'zeroStar',
label: ( label: <RatingIcon rating={0} />,
<Rating
readOnly
value={0}
/>
),
onClick: () => handleUpdateRating(0), onClick: () => handleUpdateRating(0),
}, },
{ {
id: 'oneStar', id: 'oneStar',
label: ( label: <RatingIcon rating={1} />,
<Rating
readOnly
value={1}
/>
),
onClick: () => handleUpdateRating(1), onClick: () => handleUpdateRating(1),
}, },
{ {
id: 'twoStar', id: 'twoStar',
label: ( label: <RatingIcon rating={2} />,
<Rating
readOnly
value={2}
/>
),
onClick: () => handleUpdateRating(2), onClick: () => handleUpdateRating(2),
}, },
{ {
id: 'threeStar', id: 'threeStar',
label: ( label: <RatingIcon rating={3} />,
<Rating
readOnly
value={3}
/>
),
onClick: () => handleUpdateRating(3), onClick: () => handleUpdateRating(3),
}, },
{ {
id: 'fourStar', id: 'fourStar',
label: ( label: <RatingIcon rating={4} />,
<Rating
readOnly
value={4}
/>
),
onClick: () => handleUpdateRating(4), onClick: () => handleUpdateRating(4),
}, },
{ {
id: 'fiveStar', id: 'fiveStar',
label: ( label: <RatingIcon rating={5} />,
<Rating
readOnly
value={5}
/>
),
onClick: () => handleUpdateRating(5), onClick: () => handleUpdateRating(5),
}, },
], ],