Skip to content

Commit

Permalink
Fix: notification desktop header
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Aug 10, 2019
1 parent 30e8bf9 commit 8baff81
Showing 1 changed file with 66 additions and 46 deletions.
112 changes: 66 additions & 46 deletions src/client/app/desktop/views/components/notifications.vue
Expand Up @@ -11,17 +11,17 @@
<component :is="!$store.state.device.reduceMotion ? 'transition-group' : 'div'" name="mk-notifications" class="transition" tag="div">
<template v-for="(notification, i) in _notifications">
<div v-if="notification" class="notification" :class="notification.type" :key="notification.id">
<mk-time :time="notification.createdAt"/>

<template v-if="notification.type == 'reaction'">
<mk-avatar class="avatar" :user="notification.user"/>
<div class="text">
<p>
<mk-reaction-icon :reaction="notification.reaction"/>
<router-link :to="notification.user | userPage" v-user-preview="notification.user.id">
<header>
<mk-reaction-icon :reaction="notification.reaction" class="icon"/>
<router-link :to="notification.user | userPage" v-user-preview="notification.user.id" class="name">
<mk-user-name :user="notification.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
<router-link class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note)">
<fa icon="quote-left"/>
<mfm :text="getNoteSummary(notification.note)" :plain="true" :nowrap="true" :custom-emojis="notification.note.emojis"/>
Expand All @@ -33,13 +33,15 @@
<template v-if="notification.type == 'renote' && notification.note">
<mk-avatar class="avatar" :user="notification.note.user"/>
<div class="text">
<p><fa icon="retweet"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId">
<header>
<fa icon="retweet" class="icon"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId" class="name">
<mk-user-name :user="notification.note.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
<router-link v-if="notification.note.renote" class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<fa icon="quote-left"/>
<fa icon="quote-left" class="icon"/>
<mfm :text="getNoteSummary(notification.note.renote)" :plain="true" :nowrap="true" :custom-emojis="notification.note.renote.emojis"/>
<fa icon="quote-right"/>
</router-link>
Expand All @@ -49,11 +51,13 @@
<template v-if="notification.type == 'quote'">
<mk-avatar class="avatar" :user="notification.note.user"/>
<div class="text">
<p><fa icon="quote-left"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId">
<header>
<fa icon="quote-left" class="icon"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId" class="name">
<mk-user-name :user="notification.note.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
<router-link class="note-preview" :to="notification.note | notePage" :title="getNoteSummary(notification.note)">
<mfm :text="getNoteSummary(notification.note)" :plain="true" :custom-emojis="notification.note.emojis"/>
</router-link>
Expand All @@ -63,33 +67,39 @@
<template v-if="notification.type == 'follow'">
<mk-avatar class="avatar" :user="notification.user"/>
<div class="text">
<p><fa icon="user-plus"/>
<router-link :to="notification.user | userPage" v-user-preview="notification.user.id">
<header>
<fa icon="user-plus" class="icon"/>
<router-link :to="notification.user | userPage" v-user-preview="notification.user.id" class="name">
<mk-user-name :user="notification.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
</div>
</template>

<template v-if="notification.type == 'receiveFollowRequest'">
<mk-avatar class="avatar" :user="notification.user"/>
<div class="text">
<p><fa icon="user-clock"/>
<router-link :to="notification.user | userPage" v-user-preview="notification.user.id">
<header>
<fa icon="user-clock" class="icon"/>
<router-link :to="notification.user | userPage" v-user-preview="notification.user.id" class="name">
<mk-user-name :user="notification.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
</div>
</template>

<template v-if="notification.type == 'reply'">
<mk-avatar class="avatar" :user="notification.note.user"/>
<div class="text">
<p><fa icon="reply"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId">
<header>
<fa icon="reply" class="icon"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId" class="name">
<mk-user-name :user="notification.note.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
<router-link class="note-preview" :to="notification.note | notePage" :title="getNoteSummary(notification.note)">
<mfm :text="getNoteSummary(notification.note)" :plain="true" :custom-emojis="notification.note.emojis"/>
</router-link>
Expand All @@ -99,11 +109,13 @@
<template v-if="notification.type == 'mention'">
<mk-avatar class="avatar" :user="notification.note.user"/>
<div class="text">
<p><fa icon="at"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId">
<header>
<fa icon="at" class="icon"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId" class="name">
<mk-user-name :user="notification.note.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
<a class="note-preview" :href="notification.note | notePage" :title="getNoteSummary(notification.note)">
<mfm :text="getNoteSummary(notification.note)" :plain="true" :custom-emojis="notification.note.emojis"/>
</a>
Expand All @@ -113,9 +125,13 @@
<template v-if="notification.type == 'poll_vote'">
<mk-avatar class="avatar" :user="notification.user"/>
<div class="text">
<p><fa icon="chart-pie"/><a :href="notification.user | userPage" v-user-preview="notification.user.id">
<mk-user-name :user="notification.user"/>
</a></p>
<header>
<fa icon="chart-pie" class="icon"/>
<a :href="notification.user | userPage" v-user-preview="notification.user.id" class="name">
<mk-user-name :user="notification.user"/>
</a>
<mk-time :time="notification.createdAt"/>
</header>
<router-link class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note)">
<fa icon="quote-left"/>
<mfm :text="getNoteSummary(notification.note)" :plain="true" :nowrap="true" :custom-emojis="notification.note.emojis"/>
Expand All @@ -127,11 +143,13 @@
<template v-if="notification.type == 'highlight'">
<mk-avatar class="avatar" :user="notification.note.user"/>
<div class="text">
<p><fa :icon="faLightbulb"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId">
<header>
<fa :icon="faLightbulb" class="icon"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId" class="name">
<mk-user-name :user="notification.note.user"/>
</router-link>
</p>
<mk-time :time="notification.createdAt"/>
</header>
<a class="note-preview" :href="notification.note | notePage" :title="getNoteSummary(notification.note)">
<mfm :text="getNoteSummary(notification.note)" :plain="true" :custom-emojis="notification.note.emojis"/>
</a>
Expand Down Expand Up @@ -286,15 +304,6 @@ export default Vue.extend({
&:last-child
border-bottom none
> .mk-time
display inline
position absolute
top 16px
right 12px
vertical-align top
color var(--noteHeaderInfo)
font-size small
&:after
content ""
display block
Expand All @@ -315,12 +324,23 @@ export default Vue.extend({
width calc(100% - 36px)
padding-left 8px
p
margin 0
> header
display flex
align-items baseline
white-space nowrap
[data-icon], .mk-reaction-icon
> .icon
margin-right 4px
> .name
overflow hidden
text-overflow ellipsis
> .mk-time
margin-left auto
color var(--noteHeaderInfo)
font-size 0.9em
.note-preview
color var(--noteText)
display inline-block
Expand All @@ -342,19 +362,19 @@ export default Vue.extend({
margin-right 3px
&.renote, &.quote
.text p [data-icon]
.text header [data-icon]
color #77B255
&.follow
.text p [data-icon]
.text header [data-icon]
color #53c7ce
&.receiveFollowRequest
.text p [data-icon]
.text header [data-icon]
color #888
&.reply, &.mention, &.highlight
.text p [data-icon]
.text header [data-icon]
color #555
> .date
Expand Down

0 comments on commit 8baff81

Please sign in to comment.