Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Apr 10, 2024
1 parent ad3fc85 commit 89bd40e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
12 changes: 10 additions & 2 deletions spx-gui/src/components/editor/EditorHomepage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<div v-else-if="error != null">
{{ _t(error.userMessage) }}
</div>
<EditorContextProvider v-else-if="project != null" :project="project" :user-info="userStore.userInfo">
<EditorContextProvider
v-else-if="project != null"
:project="project"
:user-info="userStore.userInfo"
>
<ProjectEditor />
</EditorContextProvider>
<div v-else>TODO</div>
Expand Down Expand Up @@ -56,7 +60,11 @@ const projectName = computed(
() => router.currentRoute.value.params.projectName as string | undefined
)
const { data: project, isFetching: isLoading, error } = useQuery(
const {
data: project,
isFetching: isLoading,
error
} = useQuery(
async () => {
if (userStore.userInfo == null) return null
if (projectName.value == null) return null
Expand Down
16 changes: 9 additions & 7 deletions spx-gui/src/models/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ export class Sound {

static async loadAll(files: Files) {
const soundNames = listDirs(files, soundAssetPath)
const sounds = (await Promise.all(
soundNames.map(async (soundName) => {
const sound = await Sound.load(soundName, files)
if (sound == null) console.warn('failed to load sound:', soundName)
return sound
})
)).filter(s => !!s) as Sound[]
const sounds = (
await Promise.all(
soundNames.map(async (soundName) => {
const sound = await Sound.load(soundName, files)
if (sound == null) console.warn('failed to load sound:', soundName)
return sound
})
)
).filter((s) => !!s) as Sound[]
return sounds
}

Expand Down
16 changes: 9 additions & 7 deletions spx-gui/src/models/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ export class Sprite extends Disposble {

static async loadAll(files: Files) {
const spriteNames = listDirs(files, spriteAssetPath)
const sprites = (await Promise.all(
spriteNames.map(async (spriteName) => {
const sprite = await Sprite.load(spriteName, files)
if (sprite == null) console.warn('failed to load sprite:', spriteName)
return sprite
})
)).filter(s => !!s) as Sprite[]
const sprites = (
await Promise.all(
spriteNames.map(async (spriteName) => {
const sprite = await Sprite.load(spriteName, files)
if (sprite == null) console.warn('failed to load sprite:', spriteName)
return sprite
})
)
).filter((s) => !!s) as Sprite[]
return sprites
}

Expand Down
6 changes: 4 additions & 2 deletions spx-gui/src/utils/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ describe('stripExt', () => {
})
it('should work well with url', () => {
expect(stripExt('https://test.com/abc.txt')).toBe('https://test.com/abc')
expect(stripExt('https://test.com/foo/%E4%B8%AD%E6%96%87.png')).toBe('https://test.com/foo/%E4%B8%AD%E6%96%87')
expect(stripExt('https://test.com/foo/%E4%B8%AD%E6%96%87.png')).toBe(
'https://test.com/foo/%E4%B8%AD%E6%96%87'
)
})
it('should work well with no ext', () => {
expect(stripExt('abc')).toBe('abc')
Expand All @@ -44,4 +46,4 @@ describe('stripExt', () => {
expect(stripExt('foo/.cache/abc.d.ts')).toBe('foo/.cache/abc.d')
expect(stripExt('/foo/bar/.gitignore')).toBe('/foo/bar/.gitignore')
})
})
})

0 comments on commit 89bd40e

Please sign in to comment.