Skip to content

Commit

Permalink
feat(review): add loading indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
ZTL-UwU committed Dec 9, 2023
1 parent 55b2aae commit 1ef8d89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions pages/manage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ onMounted(async () => {
</UiScrollArea>
</UiTabsContent>
<UiTabsContent value="unset">
<UiScrollArea class="h-[calc(100vh-17rem)]">
<ContentLoading v-if="listLoading" />
<UiScrollArea v-else class="h-[calc(100vh-17rem)]">
<TransitionGroup name="list" tag="ul">
<li v-for="song in unsetList.slice(0, showLength.unset)" :key="song.id">
<UiContextMenu>
Expand Down Expand Up @@ -710,7 +711,8 @@ onMounted(async () => {
</div>
</UiTabsContent>
<UiTabsContent value="rejected">
<UiScrollArea class="h-[calc(100vh-14rem)]">
<ContentLoading v-if="listLoading" />
<UiScrollArea v-else class="h-[calc(100vh-14rem)]">
<TransitionGroup name="list" tag="ul">
<li v-for="song in rejectedList.slice(0, showLength.rejected)" :key="song.id">
<UiContextMenu>
Expand Down
12 changes: 9 additions & 3 deletions pages/manage/review.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ async function reviewSong(song: TSong, status: TStatus) {
selectedSong.value = unsetList.value[unsetList.value.indexOf(song) + 1];
}
const listLoading = ref(false);
onMounted(async () => {
try {
await $api.user.tokenValidity.query();
Expand All @@ -137,7 +138,9 @@ onMounted(async () => {
}
try {
listLoading.value = true;
songList.value = await $api.song.listUnused.query();
listLoading.value = false;
} catch (err) {
useErrorHandler(err);
}
Expand All @@ -160,7 +163,8 @@ onMounted(async () => {
</UiCardTitle>
</UiCardHeader>
<UiCardContent>
<UiScrollArea class="h-[calc(100vh-13rem)]">
<ContentLoading v-if="listLoading" class="h-[calc(100vh-13rem)]" />
<UiScrollArea v-else class="h-[calc(100vh-13rem)]">
<TransitionGroup name="list" tag="ul">
<li v-for="song in unsetList.slice(0, showLength.unset)" :key="song.id">
<UiContextMenu>
Expand Down Expand Up @@ -276,7 +280,8 @@ onMounted(async () => {
</UiTabsTrigger>
</UiTabsList>
<UiTabsContent value="approved">
<UiScrollArea class="h-[calc(100vh-14rem)]">
<ContentLoading v-if="listLoading" />
<UiScrollArea v-else class="h-[calc(100vh-14rem)]">
<TransitionGroup name="list" tag="ul">
<li v-for="song in approvedList.slice(0, showLength.approved)" :key="song.id">
<UiContextMenu>
Expand Down Expand Up @@ -313,7 +318,8 @@ onMounted(async () => {
</UiScrollArea>
</UiTabsContent>
<UiTabsContent value="rejected">
<UiScrollArea class="h-[calc(100vh-14rem)]">
<ContentLoading v-if="listLoading" />
<UiScrollArea v-else class="h-[calc(100vh-14rem)]">
<TransitionGroup name="list" tag="ul">
<li v-for="song in rejectedList.slice(0, showLength.rejected)" :key="song.id">
<UiContextMenu>
Expand Down

0 comments on commit 1ef8d89

Please sign in to comment.