mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
addon details uses remote_addon
This commit is contained in:
parent
bfb6275b04
commit
74204374ff
2 changed files with 23 additions and 23 deletions
|
|
@ -12,7 +12,7 @@ const AddonDetailsModal = ({ transportUrl, onCloseRequest }) => {
|
|||
const { core } = useServices();
|
||||
const addonDetails = useAddonDetails(transportUrl);
|
||||
const modalButtons = React.useMemo(() => {
|
||||
if (addonDetails.addon === null || addonDetails.addon.content.type !== 'Ready') {
|
||||
if (addonDetails.remote_addon === null || addonDetails.remote_addon.content.type !== 'Ready') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ const AddonDetailsModal = ({ transportUrl, onCloseRequest }) => {
|
|||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'InstallAddon',
|
||||
args: addonDetails.addon.content.content
|
||||
args: addonDetails.remote_addon.content.content
|
||||
}
|
||||
});
|
||||
if (typeof onCloseRequest === 'function') {
|
||||
|
|
@ -46,7 +46,7 @@ const AddonDetailsModal = ({ transportUrl, onCloseRequest }) => {
|
|||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'UninstallAddon',
|
||||
args: addonDetails.addon.content.content.transportUrl
|
||||
args: addonDetails.remote_addon.content.content.transportUrl
|
||||
}
|
||||
});
|
||||
if (typeof onCloseRequest === 'function') {
|
||||
|
|
@ -65,7 +65,7 @@ const AddonDetailsModal = ({ transportUrl, onCloseRequest }) => {
|
|||
onClick: cancelOnClick
|
||||
}
|
||||
},
|
||||
addonDetails.addon.content.content.installed ?
|
||||
addonDetails.remote_addon.content.content.installed ?
|
||||
{
|
||||
className: styles['uninstall-button'],
|
||||
label: 'Uninstall',
|
||||
|
|
@ -92,27 +92,27 @@ const AddonDetailsModal = ({ transportUrl, onCloseRequest }) => {
|
|||
Loading addon manifest
|
||||
</div>
|
||||
:
|
||||
addonDetails.addon === null || addonDetails.addon.content.type === 'Loading' ?
|
||||
addonDetails.remote_addon === null || addonDetails.remote_addon.content.type === 'Loading' ?
|
||||
<div className={styles['addon-details-message-container']}>
|
||||
Loading addon manifest from {addonDetails.selected.transport_url}
|
||||
</div>
|
||||
:
|
||||
addonDetails.addon.content.type === 'Err' ?
|
||||
addonDetails.remote_addon.content.type === 'Err' ?
|
||||
<div className={styles['addon-details-message-container']}>
|
||||
Failed to get addon manifest from {addonDetails.selected.transport_url}.
|
||||
{addonDetails.addon.content.content}
|
||||
{addonDetails.remote_addon.content.content}
|
||||
</div>
|
||||
:
|
||||
<AddonDetails
|
||||
className={styles['addon-details-container']}
|
||||
id={addonDetails.addon.content.content.manifest.id}
|
||||
name={addonDetails.addon.content.content.manifest.name}
|
||||
version={addonDetails.addon.content.content.manifest.version}
|
||||
logo={addonDetails.addon.content.content.manifest.logo}
|
||||
description={addonDetails.addon.content.content.manifest.description}
|
||||
types={addonDetails.addon.content.content.manifest.types}
|
||||
transportUrl={addonDetails.addon.content.content.transportUrl}
|
||||
official={addonDetails.addon.content.content.flags.official}
|
||||
id={addonDetails.remote_addon.content.content.manifest.id}
|
||||
name={addonDetails.remote_addon.content.content.manifest.name}
|
||||
version={addonDetails.remote_addon.content.content.manifest.version}
|
||||
logo={addonDetails.remote_addon.content.content.manifest.logo}
|
||||
description={addonDetails.remote_addon.content.content.manifest.description}
|
||||
types={addonDetails.remote_addon.content.content.manifest.types}
|
||||
transportUrl={addonDetails.remote_addon.content.content.transportUrl}
|
||||
official={addonDetails.remote_addon.content.content.flags.official}
|
||||
/>
|
||||
}
|
||||
</ModalDialog>
|
||||
|
|
|
|||
|
|
@ -5,25 +5,25 @@ const useModelState = require('stremio/common/useModelState');
|
|||
|
||||
const initAddonDetailsState = () => ({
|
||||
selected: null,
|
||||
addon: null
|
||||
remote_addon: null
|
||||
});
|
||||
|
||||
const mapAddonDetailsStateWithCtx = (addonDetails, ctx) => {
|
||||
const selected = addonDetails.selected;
|
||||
const addon = addonDetails.addon !== null && addonDetails.addon.content.type === 'Ready' ?
|
||||
const remote_addon = addonDetails.remote_addon !== null && addonDetails.remote_addon.content.type === 'Ready' ?
|
||||
{
|
||||
transport_url: addonDetails.addon.transport_url,
|
||||
transport_url: addonDetails.remote_addon.transport_url,
|
||||
content: {
|
||||
type: addonDetails.addon.content.type,
|
||||
type: addonDetails.remote_addon.content.type,
|
||||
content: {
|
||||
...addonDetails.addon.content.content,
|
||||
installed: ctx.profile.addons.some(({ transportUrl }) => transportUrl === addonDetails.addon.transport_url),
|
||||
...addonDetails.remote_addon.content.content,
|
||||
installed: ctx.profile.addons.some(({ transportUrl }) => transportUrl === addonDetails.remote_addon.transport_url),
|
||||
}
|
||||
}
|
||||
}
|
||||
:
|
||||
addonDetails.addon;
|
||||
return { selected, addon };
|
||||
addonDetails.remote_addon;
|
||||
return { selected, remote_addon };
|
||||
};
|
||||
|
||||
const useAddonDetails = (transportUrl) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue