Skip to content

Commit

Permalink
fix: Small updates for resource pack (#680)
Browse files Browse the repository at this point in the history
* Update ResourcePackActions.vue

* Update ResourcePackItem.vue

* Update en.yaml
  • Loading branch information
Zgoly committed Jul 8, 2024
1 parent 0942b56 commit e3c210a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion xmcl-keystone-ui/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ resourcepack:
selectSearchHint: Search and select resource pack
selected: Selected Resource Packs
shared: Instance use shared resource pack folder
showDirectory: Show resource packs directory
showFile: Show resource pack in folder {file}
showInCurseforge: Show {name} in curseforge
unselected: Unselected Resource Packs
Expand Down Expand Up @@ -1069,7 +1070,7 @@ save:
importTitle: Import a Save
manage: Manage Saves
name: Save | Saves
showDirectory: Show save directory
showDirectory: Show saves directory
screenshots:
empty: You don't have screenshots
goto: Open Folder
Expand Down
2 changes: 1 addition & 1 deletion xmcl-keystone-ui/src/views/ResourcePackActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<v-icon>{{ isInstanceLinked ? 'account_tree' : 'looks_one' }}</v-icon>
</v-btn>
<v-btn
v-shared-tooltip="_ => t('resourcepack.name', 2)"
v-shared-tooltip="_ => t('resourcepack.showDirectory')"
icon
large
@click="showDirectory(path)"
Expand Down
10 changes: 9 additions & 1 deletion xmcl-keystone-ui/src/views/ResourcePackItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { ResourcePackProject } from '@/composables/resourcePackSearch'
import { vSharedTooltip } from '@/directives/sharedTooltip'
import { injection } from '@/util/inject'
import { ProjectEntry } from '@/util/search'
import { ResourceServiceKey, isCompatible } from '@xmcl/runtime-api'
import { BaseServiceKey, ResourceServiceKey, isCompatible } from '@xmcl/runtime-api'
const props = defineProps<{
pack: ResourcePackProject
Expand Down Expand Up @@ -93,11 +93,19 @@ const tooltip = computed(() => compatible.value
const { t } = useI18n()
const { removeResources } = useService(ResourceServiceKey)
const { showItemInDirectory } = useService(BaseServiceKey)
const isBuiltIn = computed(() => props.pack.id === 'vanilla' || props.pack.id === 'fabric' || props.pack.id === 'file/mod_resources')
const getContextMenuItems = () => {
const all = [] as ContextMenuItem[]
if (props.pack.installed.length > 0) {
all.push({
text: t('resourcepack.showFile', { file: props.pack.installed[0].resource.path }),
onClick: () => {
showItemInDirectory(props.pack.installed[0].resource.path)
},
icon: 'folder',
})
all.push({
text: t('delete.name', { name: props.pack.title }),
onClick: () => {
Expand Down

0 comments on commit e3c210a

Please sign in to comment.