@asd20/ui-next 2.0.8 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.10](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.9...ui-next-v2.0.10) (2026-03-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* fix(media-section): wrap async child imports with defineAsyncComponent to prevent Promise text render ([65aa8f1](https://github.com/academydistrict20/asd20-ui-next/commit/65aa8f1b8b7db731d565a8996618d482fd59bc47))
|
|
9
|
+
|
|
10
|
+
## [2.0.9](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.8...ui-next-v2.0.9) (2026-03-30)
|
|
11
|
+
|
|
3
12
|
## [2.0.8](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.7...ui-next-v2.0.8) (2026-03-30)
|
|
4
13
|
|
|
5
14
|
|
package/package.json
CHANGED
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
+
import { defineAsyncComponent } from 'vue'
|
|
28
|
+
|
|
27
29
|
export default {
|
|
28
30
|
name: 'Asd20MediaSection',
|
|
29
31
|
components: {
|
|
30
|
-
Asd20ImageGallery: () =>
|
|
31
|
-
import('../../../components/organisms/Asd20ImageGallery')
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
Asd20ImageGallery: defineAsyncComponent(() =>
|
|
33
|
+
import('../../../components/organisms/Asd20ImageGallery')
|
|
34
|
+
),
|
|
35
|
+
Asd20VideosSection: defineAsyncComponent(() =>
|
|
36
|
+
import('../../../components/organisms/Asd20VideosSection')
|
|
37
|
+
),
|
|
34
38
|
},
|
|
35
39
|
props: {
|
|
36
40
|
images: { type: Array, default: () => [] },
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
></asd20-feeds-section> -->
|
|
95
95
|
|
|
96
96
|
<asd20-media-section
|
|
97
|
-
v-if="
|
|
98
|
-
:images="
|
|
97
|
+
v-if="shouldShowArticleMediaSection"
|
|
98
|
+
:images="articleGalleryImages || []"
|
|
99
99
|
:videos="combinedMessageVideos || []"
|
|
100
100
|
>
|
|
101
101
|
</asd20-media-section>
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import responsiveBreakpointMixin from './responsiveBreakpointMixin'
|
|
2
2
|
|
|
3
|
+
function getMessageBodyHtml(message) {
|
|
4
|
+
return (message && (message.bodyContent || message.bodyHtml)) || ''
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getImageUrls(image) {
|
|
8
|
+
const urls = []
|
|
9
|
+
const files = (image && image.files) || []
|
|
10
|
+
if (image && image.url) urls.push(image.url)
|
|
11
|
+
files.forEach(file => {
|
|
12
|
+
if (file && file.url) urls.push(file.url)
|
|
13
|
+
})
|
|
14
|
+
return urls
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function normalizeHtmlValue(value) {
|
|
18
|
+
return String(value || '').replace(/&/g, '&')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function imageAppearsInBody(image, bodyHtml) {
|
|
22
|
+
if (!bodyHtml) return false
|
|
23
|
+
const normalizedBodyHtml = normalizeHtmlValue(bodyHtml)
|
|
24
|
+
return getImageUrls(image).some(url =>
|
|
25
|
+
normalizedBodyHtml.includes(normalizeHtmlValue(url))
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
3
29
|
export default {
|
|
4
30
|
mixins: [responsiveBreakpointMixin],
|
|
5
31
|
|
|
@@ -212,6 +238,24 @@ export default {
|
|
|
212
238
|
}, [])
|
|
213
239
|
},
|
|
214
240
|
|
|
241
|
+
articleGalleryImages() {
|
|
242
|
+
const messageBodies = (this.primaryDetailMessages || [])
|
|
243
|
+
.map(getMessageBodyHtml)
|
|
244
|
+
.filter(Boolean)
|
|
245
|
+
|
|
246
|
+
return this.combinedMessageImages.filter(image => {
|
|
247
|
+
if (!image || image.isCover) return false
|
|
248
|
+
return !messageBodies.some(bodyHtml => imageAppearsInBody(image, bodyHtml))
|
|
249
|
+
})
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
shouldShowArticleMediaSection() {
|
|
253
|
+
return (
|
|
254
|
+
this.articleGalleryImages.length >= 3 ||
|
|
255
|
+
this.combinedMessageVideos.length > 0
|
|
256
|
+
)
|
|
257
|
+
},
|
|
258
|
+
|
|
215
259
|
combinedMessageVideos() {
|
|
216
260
|
return (this.messages || []).reduce((a, m) => {
|
|
217
261
|
const videos = m.videos || []
|