Skip to content

Commit

Permalink
Merge pull request #50 from hayden-fr/feature-optimize-ui
Browse files Browse the repository at this point in the history
Feature optimize UI
  • Loading branch information
hayden-fr authored Nov 11, 2024
2 parents f2e1774 + 3b25d3e commit d4922f5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
32 changes: 17 additions & 15 deletions src/components/DialogCreateTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,23 @@

<ResponseScroll class="-mx-5 h-full">
<div class="px-5">
<ModelContent
v-if="currentModel"
:key="currentModel.id"
:model="currentModel"
:editable="true"
@submit="createDownTask"
>
<template #action>
<Button
icon="pi pi-download"
:label="$t('download')"
type="submit"
></Button>
</template>
</ModelContent>
<KeepAlive>
<ModelContent
v-if="currentModel"
:key="currentModel.id"
:model="currentModel"
:editable="true"
@submit="createDownTask"
>
<template #action>
<Button
icon="pi pi-download"
:label="$t('download')"
type="submit"
></Button>
</template>
</ModelContent>
</KeepAlive>

<div v-show="data.length === 0">
<div class="flex flex-col items-center gap-4 py-8">
Expand Down
9 changes: 8 additions & 1 deletion src/components/DialogManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
</div>

<ResponseScroll
ref="responseScroll"
:items="list"
:itemSize="itemSize"
:row-key="(item) => item.map(genModelKey).join(',')"
Expand Down Expand Up @@ -80,7 +81,7 @@ import ModelCard from 'components/ModelCard.vue'
import ResponseInput from 'components/ResponseInput.vue'
import ResponseSelect from 'components/ResponseSelect.vue'
import ResponseScroll from 'components/ResponseScroll.vue'
import { computed, ref } from 'vue'
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { chunk } from 'lodash'
import { defineResizeCallback } from 'hooks/resize'
Expand All @@ -91,6 +92,8 @@ const { isMobile, cardWidth, gutter, aspect, modelFolders } = useConfig()
const { data } = useModels()
const { t } = useI18n()
const responseScroll = ref()
const searchContent = ref<string>()
const currentType = ref('all')
Expand Down Expand Up @@ -120,6 +123,10 @@ const sortOrderOptions = ref(
}),
)
watch([searchContent, currentType], () => {
responseScroll.value.init()
})
const itemSize = computed(() => {
let itemWidth = cardWidth
let itemGutter = gutter
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResponseScroll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ const startDragThumb = (event: MouseEvent) => {
watch(
() => props.items,
() => {
init()
setSpacerSize()
calculateScrollThumbSize()
calculateLoadItems()
Expand All @@ -311,5 +310,6 @@ onUnmounted(() => {
defineExpose({
viewport,
init,
})
</script>

0 comments on commit d4922f5

Please sign in to comment.