collapse notifications and also allow expand on click anywhere

This commit is contained in:
Henry Jameson 2025-08-14 12:53:19 +03:00
commit 0b9b7a51a6
5 changed files with 23 additions and 3 deletions

View file

@ -64,6 +64,7 @@ const Notification = {
}, },
methods: { methods: {
toggleStatusExpanded () { toggleStatusExpanded () {
if (!this.expandable) return
this.statusExpanded = !this.statusExpanded this.statusExpanded = !this.statusExpanded
}, },
generateUserProfileLink (user) { generateUserProfileLink (user) {
@ -136,6 +137,9 @@ const Notification = {
const user = this.notification.from_profile const user = this.notification.from_profile
return highlightStyle(highlight[user.screen_name]) return highlightStyle(highlight[user.screen_name])
}, },
expandable () {
return (new Set(['like', '-pleroma:emoji_reaction', 'repeat'])).has(this.notification.type)
},
user () { user () {
return this.$store.getters.findUser(this.notification.from_profile.id) return this.$store.getters.findUser(this.notification.from_profile.id)
}, },

View file

@ -1,10 +1,17 @@
// TODO Copypaste from Status, should unify it somehow // TODO Copypaste from Status, should unify it somehow
.NotificationParent {
&.-expandable {
cursor: pointer;
}
}
.Notification { .Notification {
border-bottom: 1px solid; border-bottom: 1px solid;
border-color: var(--border); border-color: var(--border);
overflow-wrap: break-word; overflow-wrap: break-word;
text-wrap: pretty; text-wrap: pretty;
&.Status { &.Status {
/* stylelint-disable-next-line declaration-no-important */ /* stylelint-disable-next-line declaration-no-important */
background-color: transparent !important; background-color: transparent !important;

View file

@ -9,9 +9,17 @@
@interacted="interacted" @interacted="interacted"
/> />
</article> </article>
<article v-else> <article
class="NotificationParent"
:class="{ '-expandable': expandable }"
:aria-controls="'notif-' +notification.id"
@click="toggleStatusExpanded()"
v-else
>
<div <div
v-if="needMute && !unmuted" v-if="needMute && !unmuted"
:id="'notif-' +notification.id"
:aria-expanded="statusExpanded"
class="Notification container -muted" class="Notification container -muted"
> >
<small> <small>
@ -247,7 +255,7 @@
<StatusContent <StatusContent
:compact="!statusExpanded" :compact="!statusExpanded"
:status="notification.status" :status="notification.status"
:collapse="true" :collapse="statusExpanded"
/> />
</template> </template>
</div> </div>

View file

@ -53,6 +53,7 @@ const StatusContent = {
props: [ props: [
'status', 'status',
'compact', 'compact',
'collapse',
'focused', 'focused',
'noHeading', 'noHeading',
'fullContent', 'fullContent',

View file

@ -14,7 +14,7 @@
:toggle-showing-tall="toggleShowingTall" :toggle-showing-tall="toggleShowingTall"
:toggle-expanding-subject="toggleExpandingSubject" :toggle-expanding-subject="toggleExpandingSubject"
:toggle-showing-long-subject="toggleShowingLongSubject" :toggle-showing-long-subject="toggleShowingLongSubject"
:collapse="true" :collapse="collapse"
@parse-ready="$emit('parseReady', $event)" @parse-ready="$emit('parseReady', $event)"
> >
<div v-if="status.poll && status.poll.options && !compact"> <div v-if="status.poll && status.poll.options && !compact">