pleroma-fe/src/components/notification/notification.vue

219 lines
6.5 KiB
Vue
Raw Normal View History

<template>
<Status
2019-03-31 20:50:34 +02:00
v-if="notification.type === 'mention'"
class="Notification"
2019-03-31 20:50:34 +02:00
:compact="true"
:statusoid="notification.status"
2019-07-05 09:17:44 +02:00
/>
<div v-else>
<div
v-if="needMute && !unmuted"
2020-08-17 23:26:02 +02:00
class="Notification container -muted"
2019-07-05 09:17:44 +02:00
>
<small>
<router-link :to="userProfileLink">
{{ notification.from_profile.screen_name_ui }}
</router-link>
</small>
<button
class="button-unstyled unmute"
@click.prevent="toggleMute"
>
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="eye-slash"
/>
</button>
</div>
<div
v-else
class="Notification non-mention"
:class="[userClass, { highlighted: userStyle }, '-type--' + notification.type]"
:style="[ userStyle ]"
>
<a
class="avatar-container"
:href="$router.resolve(userProfileLink).href"
@click.stop.prevent.capture="toggleUserExpanded"
>
<UserAvatar
:compact="true"
:better-shadow="betterShadow"
:user="notification.from_profile"
/>
</a>
<div class="notification-right">
<UserCard
v-if="userExpanded"
2020-04-21 22:27:51 +02:00
:user-id="getUser(notification).id"
:rounded="true"
:bordered="true"
/>
<span class="notification-details">
<div class="name-and-action">
<!-- eslint-disable vue/no-v-html -->
<bdi v-if="!!notification.from_profile.name_html">
<RichContent
class="username"
:title="'@'+notification.from_profile.screen_name_ui"
:html="notification.from_profile.name_html"
:emoji="notification.from_profile.emoji"
/>
</bdi>
<!-- eslint-enable vue/no-v-html -->
<span
v-else
class="username"
:title="'@'+notification.from_profile.screen_name_ui"
>
{{ notification.from_profile.name }}
</span>
{{ ' ' }}
<span v-if="notification.type === 'like'">
2020-10-20 23:31:16 +02:00
<FAIcon
class="type-icon"
icon="star"
/>
{{ ' ' }}
<small>{{ $t('notifications.favorited_you') }}</small>
</span>
<span v-if="notification.type === 'repeat'">
<FAIcon
2020-10-20 23:31:16 +02:00
class="type-icon"
icon="retweet"
:title="$t('tool_tip.repeat')"
/>
{{ ' ' }}
<small>{{ $t('notifications.repeated_you') }}</small>
</span>
<span v-if="notification.type === 'follow'">
2020-10-20 23:31:16 +02:00
<FAIcon
class="type-icon"
icon="user-plus"
/>
{{ ' ' }}
<small>{{ $t('notifications.followed_you') }}</small>
</span>
<span v-if="notification.type === 'follow_request'">
2020-10-20 23:31:16 +02:00
<FAIcon
class="type-icon"
icon="user"
/>
{{ ' ' }}
<small>{{ $t('notifications.follow_request') }}</small>
</span>
2019-12-10 16:00:10 +01:00
<span v-if="notification.type === 'move'">
2020-10-20 23:31:16 +02:00
<FAIcon
class="type-icon"
icon="suitcase-rolling"
/>
{{ ' ' }}
2019-12-11 10:20:23 +01:00
<small>{{ $t('notifications.migrated_to') }}</small>
2019-12-10 16:00:10 +01:00
</span>
<span v-if="notification.type === 'pleroma:emoji_reaction'">
<small>
<i18n-t
scope="global"
keypath="notifications.reacted_with"
>
<span class="emoji-reaction-emoji">{{ notification.emoji }}</span>
</i18n-t>
</small>
</span>
</div>
<div
v-if="isStatusNotification"
class="timeago"
>
<router-link
v-if="notification.status"
:to="{ name: 'conversation', params: { id: notification.status.id } }"
class="faint-link"
>
<Timeago
:time="notification.created_at"
:auto-update="240"
/>
</router-link>
</div>
<div
v-else
class="timeago"
>
<span class="faint">
<Timeago
:time="notification.created_at"
:auto-update="240"
/>
</span>
</div>
<button
v-if="needMute"
class="button-unstyled"
@click.prevent="toggleMute"
2020-11-24 15:10:03 +01:00
>
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="eye-slash"
/>
</button>
</span>
2019-07-05 09:17:44 +02:00
<div
v-if="notification.type === 'follow' || notification.type === 'follow_request'"
class="follow-text"
2019-07-05 09:17:44 +02:00
>
<router-link
:to="userProfileLink"
class="follow-name"
>
@{{ notification.from_profile.screen_name_ui }}
</router-link>
<div
v-if="notification.type === 'follow_request'"
style="white-space: nowrap;"
>
<button
class="button-unstyled"
:title="$t('tool_tip.accept_follow_request')"
@click="approveUser()"
>
<FAIcon
icon="check"
class="fa-scale-110 fa-old-padding follow-request-accept"
/>
</button>
<button
class="button-unstyled"
:title="$t('tool_tip.reject_follow_request')"
@click="denyUser()"
>
<FAIcon
icon="times"
class="fa-scale-110 fa-old-padding follow-request-reject"
/>
</button>
</div>
</div>
2019-12-10 16:00:10 +01:00
<div
v-else-if="notification.type === 'move'"
class="move-text"
>
2019-12-10 20:02:25 +01:00
<router-link :to="targetUserProfileLink">
@{{ notification.target.screen_name_ui }}
2019-12-10 16:00:10 +01:00
</router-link>
</div>
<template v-else>
2021-06-14 01:52:41 +02:00
<StatusContent
class="faint"
2021-06-14 01:52:41 +02:00
:compact="true"
2020-05-26 00:01:25 +02:00
:status="notification.action"
/>
</template>
</div>
</div>
</div>
</template>
<script src="./notification.js"></script>
2020-08-17 23:26:02 +02:00
<style src="./notification.scss" lang="scss"></style>