mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 06:32:11 +00:00
board addon names mapped from ctx
This commit is contained in:
parent
8542120fe3
commit
cfe4caa9a1
1 changed files with 9 additions and 2 deletions
|
|
@ -6,9 +6,16 @@ const initBoardState = () => ({
|
|||
catalog_resources: []
|
||||
});
|
||||
|
||||
const mapBoardState = (board) => {
|
||||
const mapBoardState = (board, ctx) => {
|
||||
const selected = board.selected;
|
||||
const catalog_resources = board.catalog_resources.map((catalog_resource) => {
|
||||
catalog_resource.addon_name = ctx.content.addons.reduce((addon_name, addon) => {
|
||||
if (addon.transportUrl === catalog_resource.request.base) {
|
||||
return addon.manifest.name;
|
||||
}
|
||||
|
||||
return addon_name;
|
||||
}, catalog_resource.request.base);
|
||||
catalog_resource.href = `#/discover/${encodeURIComponent(catalog_resource.request.base)}/${encodeURIComponent(catalog_resource.request.path.type_name)}/${encodeURIComponent(catalog_resource.request.path.id)}`;
|
||||
if (catalog_resource.content.type === 'Ready') {
|
||||
catalog_resource.content.content.map((metaItem) => {
|
||||
|
|
@ -34,7 +41,7 @@ const useBoard = () => {
|
|||
model: 'board',
|
||||
action: loadBoardAction,
|
||||
timeout: 1000,
|
||||
map: mapBoardState,
|
||||
mapWithCtx: mapBoardState,
|
||||
init: initBoardState
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue