1
0
Fork 0
forked from srxl/akkoma-fe

merged in compact notifs and improved upon it

This commit is contained in:
Henry Jameson 2021-06-18 02:27:32 +03:00
parent c1293c3afa
commit f35c090caa
6 changed files with 14 additions and 7 deletions

View file

@ -6,6 +6,7 @@ const Gallery = {
'attachments', 'attachments',
'limitRows', 'limitRows',
'descriptions', 'descriptions',
'limit',
'nsfw', 'nsfw',
'setMedia', 'setMedia',
'size', 'size',
@ -26,11 +27,14 @@ const Gallery = {
if (!this.attachments) { if (!this.attachments) {
return [] return []
} }
console.log(this.limit)
const attachments = this.limit > 0
? this.attachments.slice(0, this.limit)
: this.attachments
if (this.size === 'hide') { if (this.size === 'hide') {
return this.attachments.map(item => ({ minimal: true, items: [item] })) return attachments.map(item => ({ minimal: true, items: [item] }))
} }
const rows = this.attachments.reduce((acc, attachment, i) => { const rows = attachments.reduce((acc, attachment, i) => {
if (this.size === 'small' && acc.length === 2) return acc
if (attachment.mimetype.includes('audio')) { if (attachment.mimetype.includes('audio')) {
return [...acc, { audio: true, items: [attachment] }, { items: [] }] return [...acc, { audio: true, items: [attachment] }, { items: [] }]
} }

View file

@ -25,7 +25,7 @@
:remove="removeAttachment" :remove="removeAttachment"
:edit="editAttachment" :edit="editAttachment"
:description="descriptions && descriptions[attachment.id]" :description="descriptions && descriptions[attachment.id]"
:hideDescription="tooManyAttachments && hidingLong" :hideDescription="size === 'small' || tooManyAttachments && hidingLong"
:style="itemStyle(attachment.id, row.items)" :style="itemStyle(attachment.id, row.items)"
@setMedia="onMedia" @setMedia="onMedia"
@naturalSizeLoad="onNaturalSizeLoad" @naturalSizeLoad="onNaturalSizeLoad"

View file

@ -298,7 +298,6 @@
:editable="true" :editable="true"
:editAttachment="editAttachment" :editAttachment="editAttachment"
:removeAttachment="removeMediaFile" :removeAttachment="removeMediaFile"
size="small"
@play="$emit('mediaplay', attachment.id)" @play="$emit('mediaplay', attachment.id)"
@pause="$emit('mediapause', attachment.id)" @pause="$emit('mediapause', attachment.id)"
/> />

View file

@ -151,7 +151,7 @@
.attachments { .attachments {
margin-top: 0; margin-top: 0;
flex: 1 1 auto; flex: 1 1 0;
min-width: 5em; min-width: 5em;
height: 100%; height: 100%;
} }

View file

@ -1,5 +1,8 @@
<template> <template>
<div class="StatusBody"> <div
class="StatusBody"
:class="{ '-compact': compact }"
>
<div class="body"> <div class="body">
<div <div
v-if="status.summary_raw_html" v-if="status.summary_raw_html"

View file

@ -20,6 +20,7 @@
v-if="status.attachments.length !== 0" v-if="status.attachments.length !== 0"
:nsfw="nsfwClickthrough" :nsfw="nsfwClickthrough"
:attachments="status.attachments" :attachments="status.attachments"
:limit="this.compact ? 1 : 0"
:size="attachmentSize" :size="attachmentSize"
@setMedia="onMedia" @setMedia="onMedia"
@play="$emit('mediaplay', attachment.id)" @play="$emit('mediaplay', attachment.id)"