1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-07-05 22:16:49 +01:00

feat: enhancements to profile account notifications (#1127)

This commit is contained in:
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
}
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() {
openMediaPreview([{
id: `${account.acct}:header`,
@ -100,17 +104,18 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
</div>
<div absolute top-18 inset-ie-0 flex gap-2 items-center>
<AccountMoreButton :account="account" :command="command" />
<button
v-if="!isSelf && relationship?.following"
:aria-pressed="isNotifiedOnPost"
:aria-label="t('account.notify_on_post', { username: `@${account.username}` })"
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'"
@click="toggleNotifications"
>
<span v-if="isNotifiedOnPost" i-ri:bell-fill block text-current />
<span v-else i-ri-bell-line block text-current />
</button>
<CommonTooltip v-if="!isSelf && relationship?.following" :content="getNotificationIconTitle()">
<button
:aria-pressed="isNotifiedOnPost"
:aria-label="t('account.notifications_on_post_enable', { username: `@${account.username}` })"
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'"
@click="toggleNotifications"
>
<span v-if="isNotifiedOnPost" i-ri:notification-4-fill block text-current />
<span v-else i-ri-notification-4-line block text-current />
</button>
</CommonTooltip>
<AccountFollowButton :account="account" :command="command" />
<!-- Edit profile -->
<NuxtLink

View file

@ -28,7 +28,8 @@
"muted_users": "Muted users",
"muting": "Muted",
"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",
"posts": "Posts",
"posts_count": "{0} Posts|{0} Post|{0} Posts",