Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Apr 7, 2024
1 parent 54c12fd commit 47d0713
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
7 changes: 5 additions & 2 deletions spx-gui/src/components/library/AssetAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
</NSpace>
</NRadioGroup>
</NFormItem>
<NFormItem :label="_t({ en: 'Publish to public assets', zh: '发布到公共素材库' })" path="isPublic">
<NFormItem
:label="_t({ en: 'Publish to public assets', zh: '发布到公共素材库' })"
path="isPublic"
>
<NCheckbox v-model:checked="form.value.isPublic" />
</NFormItem>
<NFormItem>
Expand Down Expand Up @@ -77,7 +80,7 @@ async function handleSubmit() {
const assetData = await addAsset({
...params,
displayName: form.value.name,
isPublic: form.value.isPublic ? IsPublic.public: IsPublic.personal,
isPublic: form.value.isPublic ? IsPublic.public : IsPublic.personal,
category: form.value.category,
preview: 'TODO'
})
Expand Down
38 changes: 17 additions & 21 deletions spx-gui/src/components/library/AssetLibrary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,7 @@

<script lang="ts" setup>
import { defineProps, ref, computed, watch, reactive } from 'vue'
import {
NEmpty,
NInput,
NPagination,
NRadioGroup,
NRadio,
NSpace,
NSpin
} from 'naive-ui'
import { NEmpty, NInput, NPagination, NRadioGroup, NRadio, NSpace, NSpin } from 'naive-ui'
import { listAsset, AssetType, type AssetData, IsPublic } from '@/apis/asset'
import { useMessageHandle, useQuery } from '@/utils/exception'
import { categories as categoriesWithoutAll, categoryAll } from './category'
Expand Down Expand Up @@ -94,18 +86,22 @@ const {
data: assets,
error,
refetch
} = useQuery(() => listAsset({
pageSize,
pageIndex: pageIndex.value,
assetType: props.type,
keyword: keyword.value,
category: category.value === categoryAll.value ? undefined : category.value,
owner: ownerType.value === OwnerType.personal ? undefined : '*',
isPublic: ownerType.value === OwnerType.personal ? undefined : IsPublic.public
}), {
en: 'Failed to list',
zh: '获取列表失败'
})
} = useQuery(
() =>
listAsset({
pageSize,
pageIndex: pageIndex.value,
assetType: props.type,
keyword: keyword.value,
category: category.value === categoryAll.value ? undefined : category.value,
owner: ownerType.value === OwnerType.personal ? undefined : '*',
isPublic: ownerType.value === OwnerType.personal ? undefined : IsPublic.public
}),
{
en: 'Failed to list',
zh: '获取列表失败'
}
)
const pageCount = computed(() => {
const total = assets.value?.total ?? 0
Expand Down
2 changes: 1 addition & 1 deletion spx-gui/src/components/library/category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const categories = [
{ value: 'People', message: { en: 'People', zh: '人类' } },
{ value: 'Sports', message: { en: 'Sports', zh: '运动' } },
{ value: 'Food', message: { en: 'Food', zh: '食物' } },
{ value: 'Fantasy', message: { en: 'Fantasy', zh: '幻想' } },
{ value: 'Fantasy', message: { en: 'Fantasy', zh: '幻想' } }
]

export const categoryAll = { value: '*', message: { en: 'All', zh: '所有' } }
8 changes: 2 additions & 6 deletions spx-gui/src/components/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ export function useAddAssetFromLibrary() {
const modalCtrl = useModal()
const { t } = useI18n()

return function addAssetFromLibrary(
project: Project,
type: AssetType
): Promise<void> {
return function addAssetFromLibrary(project: Project, type: AssetType): Promise<void> {
return new Promise<void>((resolve) => {
const modal = modalCtrl.create({
title: t({ en: 'Asset Library', zh: '素材库' }),
content: () =>
h(AssetLibrary, { type, project }),
content: () => h(AssetLibrary, { type, project }),
preset: 'dialog',
onHide() {
resolve()
Expand Down

0 comments on commit 47d0713

Please sign in to comment.