Skip to content

Commit 7110baf

Browse files
GermeyGermey
and
Germey
authored
Fix suno task experience (#86)
Co-authored-by: Germey <germey@acedata.cloud>
1 parent e6c273c commit 7110baf

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix suno task processing",
4+
"packageName": "@acedatacloud/nexior",
5+
"email": "germey@acedata.cloud",
6+
"dependentChangeType": "patch"
7+
}

src/components/suno/RecentPanel.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import { defineComponent } from 'vue';
3939
import TaskPreview from './task/Preview.vue';
4040
import Player from '@/components/suno/player/Player.vue';
4141
import { ElSkeleton, ElSkeletonItem } from 'element-plus';
42-
// import { ISunoAudio, ISunoAudioLyric, ISunoTask } from '@/models';
4342
4443
export default defineComponent({
4544
name: 'RecentPanel',

src/components/suno/task/Preview.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="task">
33
<div v-for="(audio, audioIndex) in audios" :key="audioIndex" class="audio" @click="onClick(audio)">
4-
<div v-loading="!audio?.audio_url" class="left">
4+
<div v-loading="!audio?.audio_url || !audio?.video_url" class="left">
55
<el-image :src="audio?.image_url" class="cover" fit="cover" />
66
<div
77
v-if="
@@ -41,7 +41,7 @@
4141
import { defineComponent } from 'vue';
4242
import { useFormatDuring } from '@/utils/number';
4343
import { ISunoAudio, ISunoTask } from '@/models';
44-
import { ElButton, ElImage, ElIcon } from 'element-plus';
44+
import { ElImage, ElIcon } from 'element-plus';
4545
import { VideoPlay, VideoPause } from '@element-plus/icons-vue';
4646
4747
export default defineComponent({

src/pages/suno/Index.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ export default defineComponent({
7979
},
8080
application() {
8181
return this.$store.state.suno.application;
82+
},
83+
tasks() {
84+
return this.$store.state.suno.tasks;
85+
}
86+
},
87+
watch: {
88+
tasks: {
89+
handler(value, oldValue) {
90+
// scroll down if new tasks are added
91+
if (value?.items?.length > oldValue?.items?.length) {
92+
console.debug('new tasks detected');
93+
this.onScrollDown();
94+
}
95+
},
96+
deep: true
8297
}
8398
},
8499
async mounted() {
@@ -125,12 +140,12 @@ export default defineComponent({
125140
},
126141
async onScrollDown() {
127142
setTimeout(() => {
128-
// scroll to bottom for `.tasks`
129-
const el = document.querySelector('.tasks');
143+
// scroll to bottom for `.recent`
144+
const el = document.querySelector('.recent');
130145
if (el) {
131146
el.scrollTop = el.scrollHeight;
132147
}
133-
}, 500);
148+
}, 1000);
134149
},
135150
async onGetTasks() {
136151
if (this.loading) {

0 commit comments

Comments
 (0)