Fix being able to add mods to paired instances (#630)

* Fix being able to add mods to paired instances

* Remove debugging output.
This commit is contained in:
chaos
2023-08-19 04:30:07 +03:00
committed by GitHub
parent f7f73b8163
commit abb02ad624
3 changed files with 119 additions and 88 deletions

View File

@@ -11,7 +11,11 @@
>
<div v-for="(option, index) in options" :key="index" @click.stop="optionClicked(option.name)">
<hr v-if="option.type === 'divider'" class="divider" />
<div v-else class="item clickable" :class="[option.color ?? 'base']">
<div
v-else-if="!(isLinkedData(item) && option.name === `add_content`)"
class="item clickable"
:class="[option.color ?? 'base']"
>
<slot :name="option.name" />
</div>
</div>
@@ -55,6 +59,15 @@ defineExpose({
},
})
const isLinkedData = (item) => {
if (item.instance != undefined && item.instance.metadata.linked_data) {
return true
} else if (item.metadata != undefined && item.metadata.linked_data) {
return true
}
return false
}
const hideContextMenu = () => {
shown.value = false
emit('menu-closed')

View File

@@ -245,13 +245,30 @@ const check_valid = computed(() => {
/>
{{ profile.metadata.name }}
</Button>
<Button :disabled="profile.installedMod || profile.installing" @click="install(profile)">
<DownloadIcon v-if="!profile.installedMod && !profile.installing" />
<CheckIcon v-else-if="profile.installedMod" />
{{
profile.installing ? 'Installing...' : profile.installedMod ? 'Installed' : 'Install'
}}
</Button>
<div
v-tooltip="
profile.metadata.linked_data && !profile.installedMod
? 'Unpair an instance to add mods.'
: ''
"
>
<Button
:disabled="profile.installedMod || profile.installing || profile.metadata.linked_data"
@click="install(profile)"
>
<DownloadIcon v-if="!profile.installedMod && !profile.installing" />
<CheckIcon v-else-if="profile.installedMod" />
{{
profile.installing
? 'Installing...'
: profile.installedMod
? 'Installed'
: profile.metadata.linked_data
? 'Paired'
: 'Install'
}}
</Button>
</div>
</div>
</div>
<Card v-if="showCreation" class="creation-card">