|
|
|
@ -22,6 +22,7 @@ export default memo(({ addonId, type }) => {
|
|
|
|
|
const hasSettings = vizality.manager[toPlural(type)].hasSettings(addonId);
|
|
|
|
|
const hasScreenshots = vizality.manager[toPlural(type)].hasScreenshots(addonId);
|
|
|
|
|
const hasChangelog = vizality.manager[toPlural(type)].hasChangelog(addonId);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ContextMenu.Menu navId='vz-addon-context-menu' onClose={closeContextMenu}>
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
@ -29,33 +30,30 @@ export default memo(({ addonId, type }) => {
|
|
|
|
|
label='Overview'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}`)}
|
|
|
|
|
/>
|
|
|
|
|
{hasScreenshots && (
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='screenshots'
|
|
|
|
|
label='Screenshots'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/screenshots`)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{isInstalled && hasSettings && (
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='settings'
|
|
|
|
|
label='Settings'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/settings`)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='screenshots'
|
|
|
|
|
label='Screenshots'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/screenshots`)}
|
|
|
|
|
disabled={hasScreenshots}
|
|
|
|
|
/>
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='settings'
|
|
|
|
|
label='Settings'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/settings`)}
|
|
|
|
|
disabled={isInstalled && hasSettings}
|
|
|
|
|
/>
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='reviews'
|
|
|
|
|
label='Reviews'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/reviews`)}
|
|
|
|
|
disabled
|
|
|
|
|
/>
|
|
|
|
|
{hasChangelog && (
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='changelog'
|
|
|
|
|
label='Changelog'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/changelog`)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='changelog'
|
|
|
|
|
label='Changelog'
|
|
|
|
|
action={() => vizality.api.routes.navigateTo(`${type}/${addonId}/changelog`)}
|
|
|
|
|
disabled={hasChangelog}
|
|
|
|
|
/>
|
|
|
|
|
<ContextMenu.Separator />
|
|
|
|
|
{isInstalled && (
|
|
|
|
|
<ContextMenu.CheckboxItem
|
|
|
|
@ -69,24 +67,28 @@ export default memo(({ addonId, type }) => {
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{isInstalled
|
|
|
|
|
? <ContextMenu.Item
|
|
|
|
|
id='uninstall'
|
|
|
|
|
label='Uninstall'
|
|
|
|
|
color={ContextMenu.Item.Colors.DANGER}
|
|
|
|
|
action={async () => vizality.manager[toPlural(type)].uninstall(addonId)}
|
|
|
|
|
/>
|
|
|
|
|
: <ContextMenu.Item
|
|
|
|
|
id='install'
|
|
|
|
|
label='Install'
|
|
|
|
|
color={ContextMenu.Item.Colors.GREEN}
|
|
|
|
|
action={async () => vizality.manager[toPlural(type)].install(addonId)}
|
|
|
|
|
/>
|
|
|
|
|
? (
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='uninstall'
|
|
|
|
|
label='Uninstall'
|
|
|
|
|
color={ContextMenu.Item.Colors.DANGER}
|
|
|
|
|
action={async () => vizality.manager[toPlural(type)].uninstall(addonId)}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
: (
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='install'
|
|
|
|
|
label='Install'
|
|
|
|
|
color={ContextMenu.Item.Colors.GREEN}
|
|
|
|
|
action={async () => vizality.manager[toPlural(type)].install(addonId)}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
<ContextMenu.Separator />
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='copy-link'
|
|
|
|
|
label='Copy Link'
|
|
|
|
|
action={() => void 0}
|
|
|
|
|
action={() => DiscordNative.clipboard.copy(`<vizality://${toPlural(type)}/${addonId}>`)}
|
|
|
|
|
/>
|
|
|
|
|
<ContextMenu.Item
|
|
|
|
|
id='copy-id'
|
|
|
|
|