Skip to content

Commit

Permalink
refactor: Adjust some ux of export and drop dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Dec 30, 2023
1 parent a3211bd commit 90e97b8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
29 changes: 20 additions & 9 deletions xmcl-keystone-ui/src/composables/appDropHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,12 @@ export function useAppDropHandler() {
const { previewUrl } = useService(ImportServiceKey)

const iconMap: Record<string, string> = {
forge: '$vuetify.icons.package',
fabric: '$vuetify.icons.fabric',
mods: '$vuetify.icons.package',
unclassified: 'question_mark',
resourcepack: '$vuetify.icons.zip',
shaderpack: '$vuetify.icons.zip',
'curseforge-modpack': '$vuetify.icons.curseforge',
modpack: '$vuetify.icons.package',
'mcbbs-modpack': '$vuetify.icons.package',
save: '$vuetify.icons.zip',
'modrinth-modpack': '$vuetify.icons.modrinth',
resourcepacks: '$vuetify.icons.zip',
shaderpacks: '$vuetify.icons.zip',
modpacks: '$vuetify.icons.package',
saves: '$vuetify.icons.zip',
}

function getDescription(rsize: number | undefined, url: string) {
Expand Down Expand Up @@ -138,6 +134,21 @@ export function useAppDropHandler() {
}

function getIcon(resource: Resource | undefined) {
if (resource?.metadata['curseforge-modpack']) {
return '$vuetify.icons.curseforge'
}
if (resource?.metadata['modrinth-modpack']) {
return '$vuetify.icons.modrinth'
}
if (resource?.metadata['mcbbs-modpack']) {
return '$vuetify.icons.package'
}
if (resource?.metadata.forge) {
return '$vuetify.icons.forge'
}
if (resource?.metadata.fabric) {
return '$vuetify.icons.fabric'
}
return resource ? iconMap[resource.domain] ?? 'question_mark' : 'question_mark'
}

Expand Down
1 change: 0 additions & 1 deletion xmcl-keystone-ui/src/composables/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export function useInstances() {
}
watch(state, async (newVal, oldVal) => {
if (!newVal) return
debugger
if (!oldVal) {
// initialize
const instances = [...newVal.instances]
Expand Down
5 changes: 3 additions & 2 deletions xmcl-keystone-ui/src/views/AppExportDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
scrollable
width="800"
>
<v-card>
<v-card class="rounded-none">
<v-toolbar
class="moveable flex-1 flex-grow-0"
class="moveable flex-1 flex-grow-0 rounded-none"
tabs
color="green en"
>
Expand Down Expand Up @@ -268,6 +268,7 @@
</InstanceManifestFileTree>
</v-layout>
</div>
<div class="flex-grow" />
<v-card-actions class="items-baseline gap-5">
<v-btn
text
Expand Down

0 comments on commit 90e97b8

Please sign in to comment.