💄 Improvements and adjustments in new UI
This commit is contained in:
@@ -1,52 +1,51 @@
|
||||
<template>
|
||||
<div class="post-list">
|
||||
<!-- Error State -->
|
||||
<v-alert
|
||||
<n-alert
|
||||
v-if="hasError"
|
||||
type="error"
|
||||
class="mb-4"
|
||||
closable
|
||||
@click:close="refresh"
|
||||
@close="refresh"
|
||||
class="mb-4"
|
||||
>
|
||||
{{ error }}
|
||||
</v-alert>
|
||||
</n-alert>
|
||||
|
||||
<!-- Posts List -->
|
||||
<v-infinite-scroll
|
||||
height="auto"
|
||||
class="space-y-4 overflow-y-hidden"
|
||||
side="end"
|
||||
@load="loadMore"
|
||||
>
|
||||
<n-infinite-scroll :distance="0" @load="loadMore" style="overflow: auto">
|
||||
<template v-for="item in posts" :key="item.id">
|
||||
<post-item
|
||||
class="mb-4"
|
||||
:item="item"
|
||||
@react="(symbol, attitude, delta) => $emit('react', item.id, symbol, attitude, delta)"
|
||||
@react="
|
||||
(symbol, attitude, delta) =>
|
||||
$emit('react', item.id, symbol, attitude, delta)
|
||||
"
|
||||
@click="router.push('/posts/' + item.id)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<!-- Loading State -->
|
||||
<template #loading>
|
||||
<div class="flex justify-center py-4">
|
||||
<v-progress-circular indeterminate size="32" />
|
||||
</div>
|
||||
</template>
|
||||
<div v-if="loading" class="flex justify-center py-4">
|
||||
<n-spin size="medium" />
|
||||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<template #empty>
|
||||
<div v-if="!posts" class="text-center py-8 text-muted-foreground">
|
||||
<v-icon icon="mdi-post-outline" size="48" class="mb-2 opacity-50" />
|
||||
<p>No posts found</p>
|
||||
</div>
|
||||
</template>
|
||||
</v-infinite-scroll>
|
||||
<div
|
||||
v-if="!loading && posts.length === 0 && !hasError"
|
||||
class="text-center py-8 text-muted-foreground"
|
||||
>
|
||||
<n-icon :component="FileText" size="48" class="mb-2 opacity-50" />
|
||||
<p>No posts found</p>
|
||||
</div>
|
||||
</n-infinite-scroll>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { usePostList } from "~/composables/usePostList"
|
||||
import type { PostListParams } from "~/composables/usePostList"
|
||||
import { FileText } from "lucide-vue-next"
|
||||
|
||||
import PostItem from "./PostItem.vue"
|
||||
|
||||
@@ -60,12 +59,7 @@ defineEmits<{
|
||||
react: [postId: string, symbol: string, attitude: number, delta: number]
|
||||
}>()
|
||||
|
||||
const { posts, hasError, error, loadMore, refresh } =
|
||||
usePostList(props.params)
|
||||
const { posts, hasError, error, loading, loadMore, refresh } = usePostList(
|
||||
props.params
|
||||
)
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.post-list .v-infinite-scroll .v-infinite-scroll__side:first-child {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -28,13 +28,13 @@
|
||||
</template>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div
|
||||
<n-empty
|
||||
v-if="!replies || replies.length === 0"
|
||||
class="text-center py-8 text-muted-foreground"
|
||||
size="small"
|
||||
>
|
||||
<v-icon icon="mdi-comment-outline" size="48" class="mb-2 opacity-50" />
|
||||
<p>No replies yet</p>
|
||||
</div>
|
||||
No Replies
|
||||
</n-empty>
|
||||
</div>
|
||||
</n-card>
|
||||
</template>
|
||||
|
||||
@@ -33,15 +33,13 @@
|
||||
</template>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div
|
||||
<n-empty
|
||||
v-if="!replies || replies.length === 0"
|
||||
class="text-center py-8 text-muted-foreground"
|
||||
size="small"
|
||||
>
|
||||
<n-icon size="48" class="mb-2 opacity-50">
|
||||
<i class="mdi mdi-comment-outline"></i>
|
||||
</n-icon>
|
||||
<p>No replies yet</p>
|
||||
</div>
|
||||
No Replies
|
||||
</n-empty>
|
||||
</n-infinite-scroll>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user