mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-22 12:42:09 +00:00
refactor: chain the elements that are returned
This commit is contained in:
parent
81da07d231
commit
0547b1675e
1 changed files with 18 additions and 21 deletions
|
|
@ -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)
|
||||
}));
|
||||
|
|
|
|||
Loading…
Reference in a new issue