refactor: chain the elements that are returned

This commit is contained in:
kKaskak 2024-03-14 20:56:38 +02:00
parent 81da07d231
commit 0547b1675e

View file

@ -16,15 +16,13 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
}, [_id, notifications]);
const options = React.useMemo(() => {
const optionsList = [
return [
{ label: 'LIBRARY_PLAY', value: 'play' },
{ label: 'LIBRARY_DETAILS', value: 'details' },
{ label: 'LIBRARY_RESUME_DISMISS', value: 'dismiss' },
{ label: watched ? 'CTX_MARK_UNWATCHED' : 'CTX_MARK_WATCHED', value: 'watched' },
{ label: 'LIBRARY_REMOVE', value: 'remove' },
];
return optionsList
.filter(({ value }) => {
].filter(({ value }) => {
switch (value) {
case 'play':
return props.deepLinks && typeof props.deepLinks.player === 'string';
@ -37,8 +35,7 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
case 'remove':
return typeof _id === 'string' && removable;
}
})
.map((option) => ({
}).map((option) => ({
...option,
label: t(option.label)
}));