feat: enhancements to profile account notifications (#1127)

zio/stable
Jeff Sikes 2023-01-17 06:57:24 -06:00 committed by GitHub
parent 85e163a0ad
commit fd662b8864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 12 deletions

View File

@ -25,6 +25,10 @@ function getFieldIconTitle(fieldName: string) {
return fieldName === 'Joined' ? t('account.joined') : fieldName return fieldName === 'Joined' ? t('account.joined') : fieldName
} }
function getNotificationIconTitle() {
return relationship?.notifying ? t('account.notifications_on_post_disable', { username: `@${account.username}` }) : t('account.notifications_on_post_enable', { username: `@${account.username}` })
}
function previewHeader() { function previewHeader() {
openMediaPreview([{ openMediaPreview([{
id: `${account.acct}:header`, id: `${account.acct}:header`,
@ -100,17 +104,18 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
</div> </div>
<div absolute top-18 inset-ie-0 flex gap-2 items-center> <div absolute top-18 inset-ie-0 flex gap-2 items-center>
<AccountMoreButton :account="account" :command="command" /> <AccountMoreButton :account="account" :command="command" />
<CommonTooltip v-if="!isSelf && relationship?.following" :content="getNotificationIconTitle()">
<button <button
v-if="!isSelf && relationship?.following"
:aria-pressed="isNotifiedOnPost" :aria-pressed="isNotifiedOnPost"
:aria-label="t('account.notify_on_post', { username: `@${account.username}` })" :aria-label="t('account.notifications_on_post_enable', { username: `@${account.username}` })"
rounded-full p2 border-1 transition-colors rounded-full p2 border-1 transition-colors
:class="isNotifiedOnPost ? 'text-primary border-primary hover:bg-red/20 hover:text-red hover:border-red' : 'border-base hover:text-primary'" :class="isNotifiedOnPost ? 'text-primary border-primary hover:bg-red/20 hover:text-red hover:border-red' : 'border-base hover:text-primary'"
@click="toggleNotifications" @click="toggleNotifications"
> >
<span v-if="isNotifiedOnPost" i-ri:bell-fill block text-current /> <span v-if="isNotifiedOnPost" i-ri:notification-4-fill block text-current />
<span v-else i-ri-bell-line block text-current /> <span v-else i-ri-notification-4-line block text-current />
</button> </button>
</CommonTooltip>
<AccountFollowButton :account="account" :command="command" /> <AccountFollowButton :account="account" :command="command" />
<!-- Edit profile --> <!-- Edit profile -->
<NuxtLink <NuxtLink

View File

@ -28,7 +28,8 @@
"muted_users": "Muted users", "muted_users": "Muted users",
"muting": "Muted", "muting": "Muted",
"mutuals": "Mutuals", "mutuals": "Mutuals",
"notify_on_post": "Notify me when {username} posts", "notifications_on_post_disable": "Stop notifying me when {username} posts",
"notifications_on_post_enable": "Notify me when {username} posts",
"pinned": "Pinned", "pinned": "Pinned",
"posts": "Posts", "posts": "Posts",
"posts_count": "{0} Posts|{0} Post|{0} Posts", "posts_count": "{0} Posts|{0} Post|{0} Posts",