Skip to content

Commit 02e4c10

Browse files
committed
feat: enhance media tab with user-specific no media messages and loading states
1 parent 69d1b96 commit 02e4c10

2 files changed

Lines changed: 37 additions & 13 deletions

File tree

app/pages/profile/[username]/media.vue

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ definePageMeta({
1010
1111
const user = inject<ComputedRef<User>>('user-data');
1212
const isBlockedBy = computed(() => user?.value.relationship.blockedBy || false);
13+
const userStore = useUserStore();
14+
15+
const isCurrentUser = computed(() => {
16+
return userStore.user?.username === user?.value.username;
17+
});
1318
1419
const {
1520
data: response,
@@ -71,21 +76,30 @@ onServerPrefetch(async () => {
7176
</div>
7277
</template>
7378
</VirtualInfiniteScroller>
74-
</ClientOnly>
75-
</div>
7679

77-
<div
78-
v-if="(hasNextPage && isFetchingNextPage) || isLoading"
79-
class="text-primary flex shrink-0 items-center justify-center py-4"
80-
>
81-
<UiSpinner />
80+
<div
81+
v-if="(hasNextPage && isFetchingNextPage) || isLoading"
82+
class="text-primary flex shrink-0 items-center justify-center py-4"
83+
>
84+
<UiSpinner />
85+
</div>
86+
</ClientOnly>
8287
</div>
83-
<div
84-
v-if="tweets.length === 0 && !isFetchingNextPage && !isLoading"
85-
data-testid="empty-state"
86-
class="text-muted-foreground mt-10 text-center"
87-
>
88-
<h1 class="text-xl font-semibold">{{ $t('testing.tweets.tweet-not-found') }}</h1>
88+
<div v-if="!isLoading && tweets.length === 0" class="mx-auto my-10 max-w-90 px-8 text-start">
89+
<h2 class="text-[2rem] leading-tight font-black">
90+
{{
91+
isCurrentUser
92+
? $t('profile.media.current-user-no-media.title')
93+
: $t('profile.media.no-media.title', { username: user?.username || '' })
94+
}}
95+
</h2>
96+
<p class="text-muted-foreground leading-tight">
97+
{{
98+
isCurrentUser
99+
? $t('profile.media.current-user-no-media.description')
100+
: $t('profile.media.no-media.description')
101+
}}
102+
</p>
89103
</div>
90104
</div>
91105
</template>

i18n/locales/en.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@
106106
"description": "When someone follows this account, they'll show up here. Posting and interacting with others helps boost followers."
107107
}
108108
}
109+
},
110+
"media": {
111+
"no-media": {
112+
"title": "{'@'}{username} hasn't posted media",
113+
"description": "Once they do, those posts will show up here."
114+
},
115+
"current-user-no-media": {
116+
"title": "Lights, camera … attachments!",
117+
"description": "When you post photos or videos, they will show up here."
118+
}
109119
}
110120
},
111121
"home": {

0 commit comments

Comments
 (0)