Skip to content

Commit

Permalink
fix: Make mod item grey when it's disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Oct 19, 2023
1 parent fca73fd commit b952432
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
3 changes: 3 additions & 0 deletions xmcl-keystone-ui/src/composables/modSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ export function useLocalModsSearch(keyword: Ref<string>, modLoaderFilters: Ref<M
obj.files?.push(m)
if (instanceFile) {
obj.installed?.push(m)
obj.disabled = !obj.installed[0].enabled
}
} else {
const mod: Mod = markRaw({
id: name,
author: m.authors[0] ?? '',
icon: m.icon,
title: name,
disabled: false,
description: m.description,
forge: m.modLoaders.indexOf('forge') !== -1,
fabric: m.modLoaders.indexOf('fabric') !== -1,
Expand All @@ -258,6 +260,7 @@ export function useLocalModsSearch(keyword: Ref<string>, modLoaderFilters: Ref<M
}
if (instanceFile) {
mod.installed.push(m)
mod.disabled = !mod.installed[0].enabled
}
return mod
}
Expand Down
2 changes: 2 additions & 0 deletions xmcl-keystone-ui/src/util/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export interface Mod {
description: string
author: string

disabled?: boolean

downloadCount?: number
followerCount?: number

Expand Down
21 changes: 0 additions & 21 deletions xmcl-keystone-ui/src/views/Mod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,6 @@
{{ t('modInstall.upgrade') }}
</span>
</v-btn>
<!-- <v-divider
vertical
class="mx-2"
/> -->
<!-- <span class="search-text">
{{ t('modInstall.search') }}
</span>
<span
v-if="counts.searched > 0"
class="ml-2"
>
{{ t('items.count', { count: counts.searched }) }}
<span v-if="total">
/
{{ t('items.total', { total: total }) }}
</span>
</span> -->
</v-subheader>
</div>
<v-virtual-scroll
Expand Down Expand Up @@ -216,17 +199,13 @@ const { minecraft } = injection(kInstanceVersion)
const { runtime } = injection(kInstance)
const { provideRuntime } = injection(kInstanceModsContext)
watch(provideRuntime, v => console.log(v), { immediate: true })
const {
modrinth, modrinthError,
curseforge, curseforgeError,
loading,
loadMoreCurseforge,
loadMoreModrinth,
keyword,
loadingCurseforge,
loadingModrinth,
} = injection(kModsSearch)
const { search, installed, tab } = injection(kMods)
Expand Down
5 changes: 5 additions & 0 deletions xmcl-keystone-ui/src/views/ModItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<v-list-item
v-context-menu="getContextMenuItems"
v-shared-tooltip="[tooltip, hasUpdate ? 'primary' : 'black']"
class="pointer-events-auto"
:class="{
'v-list-item--disabled': item.disabled
}"
:input-value="selected"
link
@click="emit('click')"
Expand Down Expand Up @@ -51,6 +55,7 @@
<v-list-item-subtitle class="invisible-scroll flex flex-grow-0 gap-2">
<template v-if="item.installed && (item.installed?.[0]?.tags.length + compatibility.length) > 0">
<ModLabels
:disabled="item.disabled"
:compatibility="compatibility"
:tags="item.installed[0].tags"
/>
Expand Down
4 changes: 4 additions & 0 deletions xmcl-keystone-ui/src/views/ModLabels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class="mod-tag"
:outlined="darkTheme"
color="orange en-1"
:disabled="disabled"
label
style="margin-left: 1px;"
@mousedown.stop
Expand All @@ -21,6 +22,7 @@
:key="com.modId + ' ' + i"
v-shared-tooltip="getTooltip(com)"
class="mod-tag"
:disabled="disabled"
small
label
outlined
Expand Down Expand Up @@ -48,6 +50,7 @@
class="mod-tag"
small
label
:disabled="disabled"
:color="getColor(tag)"
style="margin-left: 1px;"
close
Expand Down Expand Up @@ -79,6 +82,7 @@ import { kInstanceModsContext } from '@/composables/instanceMods'
const props = defineProps<{
modid?: string
tags: string[]
disabled?: boolean
compatibility: CompatibleDetail[]
}>()
Expand Down

0 comments on commit b952432

Please sign in to comment.