aboutsummaryrefslogtreecommitdiff
path: root/src/components/gallery
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-06-18 02:27:32 +0300
committerHenry Jameson <me@hjkos.com>2021-06-18 02:27:32 +0300
commitf35c090caaccf272c12358a2a02df71b9212d16c (patch)
treeb4c15b7ef707e17248e7330309c52d7c5510f975 /src/components/gallery
parentc1293c3afa9b9a057008026a9d988c6a5b9f516c (diff)
merged in compact notifs and improved upon it
Diffstat (limited to 'src/components/gallery')
-rw-r--r--src/components/gallery/gallery.js10
-rw-r--r--src/components/gallery/gallery.vue2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/components/gallery/gallery.js b/src/components/gallery/gallery.js
index cca67dbd..ab13f698 100644
--- a/src/components/gallery/gallery.js
+++ b/src/components/gallery/gallery.js
@@ -6,6 +6,7 @@ const Gallery = {
'attachments',
'limitRows',
'descriptions',
+ 'limit',
'nsfw',
'setMedia',
'size',
@@ -26,11 +27,14 @@ const Gallery = {
if (!this.attachments) {
return []
}
+ console.log(this.limit)
+ const attachments = this.limit > 0
+ ? this.attachments.slice(0, this.limit)
+ : this.attachments
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) => {
- if (this.size === 'small' && acc.length === 2) return acc
+ const rows = attachments.reduce((acc, attachment, i) => {
if (attachment.mimetype.includes('audio')) {
return [...acc, { audio: true, items: [attachment] }, { items: [] }]
}
diff --git a/src/components/gallery/gallery.vue b/src/components/gallery/gallery.vue
index cedf64d3..a1f1c26c 100644
--- a/src/components/gallery/gallery.vue
+++ b/src/components/gallery/gallery.vue
@@ -25,7 +25,7 @@
:remove="removeAttachment"
:edit="editAttachment"
:description="descriptions && descriptions[attachment.id]"
- :hideDescription="tooManyAttachments && hidingLong"
+ :hideDescription="size === 'small' || tooManyAttachments && hidingLong"
:style="itemStyle(attachment.id, row.items)"
@setMedia="onMedia"
@naturalSizeLoad="onNaturalSizeLoad"