Skip to content

Commit

Permalink
Fix suno task experience (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: Germey <germey@acedata.cloud>
  • Loading branch information
Germey and Germey authored Jul 27, 2024
1 parent e6c273c commit 7110baf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix suno task processing",
"packageName": "@acedatacloud/nexior",
"email": "germey@acedata.cloud",
"dependentChangeType": "patch"
}
1 change: 0 additions & 1 deletion src/components/suno/RecentPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { defineComponent } from 'vue';
import TaskPreview from './task/Preview.vue';
import Player from '@/components/suno/player/Player.vue';
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
// import { ISunoAudio, ISunoAudioLyric, ISunoTask } from '@/models';
export default defineComponent({
name: 'RecentPanel',
Expand Down
4 changes: 2 additions & 2 deletions src/components/suno/task/Preview.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="task">
<div v-for="(audio, audioIndex) in audios" :key="audioIndex" class="audio" @click="onClick(audio)">
<div v-loading="!audio?.audio_url" class="left">
<div v-loading="!audio?.audio_url || !audio?.video_url" class="left">
<el-image :src="audio?.image_url" class="cover" fit="cover" />
<div
v-if="
Expand Down Expand Up @@ -41,7 +41,7 @@
import { defineComponent } from 'vue';
import { useFormatDuring } from '@/utils/number';
import { ISunoAudio, ISunoTask } from '@/models';
import { ElButton, ElImage, ElIcon } from 'element-plus';
import { ElImage, ElIcon } from 'element-plus';
import { VideoPlay, VideoPause } from '@element-plus/icons-vue';
export default defineComponent({
Expand Down
21 changes: 18 additions & 3 deletions src/pages/suno/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ export default defineComponent({
},
application() {
return this.$store.state.suno.application;
},
tasks() {
return this.$store.state.suno.tasks;
}
},
watch: {
tasks: {
handler(value, oldValue) {
// scroll down if new tasks are added
if (value?.items?.length > oldValue?.items?.length) {
console.debug('new tasks detected');
this.onScrollDown();
}
},
deep: true
}
},
async mounted() {
Expand Down Expand Up @@ -125,12 +140,12 @@ export default defineComponent({
},
async onScrollDown() {
setTimeout(() => {
// scroll to bottom for `.tasks`
const el = document.querySelector('.tasks');
// scroll to bottom for `.recent`
const el = document.querySelector('.recent');
if (el) {
el.scrollTop = el.scrollHeight;
}
}, 500);
}, 1000);
},
async onGetTasks() {
if (this.loading) {
Expand Down

0 comments on commit 7110baf

Please sign in to comment.