mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-22 19:27:47 +00:00
override tabel text for all select that are not required
This commit is contained in:
parent
608cc8e726
commit
0b2ead0d43
1 changed files with 13 additions and 8 deletions
|
|
@ -55,15 +55,15 @@ const useCatalog = (urlParams, queryParams) => {
|
|||
}
|
||||
},
|
||||
...state.discover.selectable_extra
|
||||
.map((extra) => ({
|
||||
title: `Select ${extra.name}`,
|
||||
options: (extra.isRequired ? [] : [NONE_EXTRA_VALUE])
|
||||
.map((extra) => {
|
||||
const title = `Select ${extra.name}`;
|
||||
const options = (extra.isRequired ? [] : [NONE_EXTRA_VALUE])
|
||||
.concat(extra.options)
|
||||
.map((option) => ({
|
||||
value: option,
|
||||
label: option
|
||||
})),
|
||||
selected: state.discover.selected.path.extra
|
||||
}));
|
||||
const selected = state.discover.selected.path.extra
|
||||
.reduce((selected, [name, value]) => {
|
||||
if (name === extra.name) {
|
||||
selected = selected.filter(value => value !== NONE_EXTRA_VALUE)
|
||||
|
|
@ -71,8 +71,12 @@ const useCatalog = (urlParams, queryParams) => {
|
|||
}
|
||||
|
||||
return selected;
|
||||
}, extra.isRequired ? [] : [NONE_EXTRA_VALUE]),
|
||||
onSelect: (event) => {
|
||||
}, extra.isRequired ? [] : [NONE_EXTRA_VALUE]);
|
||||
const renderLabelText = selected.includes(NONE_EXTRA_VALUE) ?
|
||||
() => title
|
||||
:
|
||||
null;
|
||||
const onSelect = (event) => {
|
||||
navigateWithLoad({
|
||||
base: addonTransportUrl,
|
||||
path: {
|
||||
|
|
@ -115,7 +119,8 @@ const useCatalog = (urlParams, queryParams) => {
|
|||
}
|
||||
});
|
||||
}
|
||||
}))
|
||||
return { title, options, selected, renderLabelText, onSelect };
|
||||
})
|
||||
];
|
||||
const items = state.discover.content.type === 'Ready' ? state.discover.content.content : null;
|
||||
const error = state.discover.content.type === 'Err' ? JSON.stringify(state.discover.content.content) : null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue