File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 class="overflow-hidden data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp "
3232 >
3333 <div class =" pb-4 type-body" >
34- <RichTextRenderer :json =" item .copy ?.json " />
34+ <RichTextRenderer
35+ :json =" item .copy ?.json "
36+ :assets =" getEmbeddedAssets (item .copy ?.links )"
37+ />
3538 </div >
3639 </AccordionContent >
3740 </AccordionItem >
Original file line number Diff line number Diff line change 1212</template >
1313
1414<script setup lang="ts">
15- import type { EmbeddedAsset } from " ~/components/render/RichTextRenderer.vue" ;
1615import type { ModuleProps } from " ~/types/module" ;
1716import type { CenterTextFragment } from " ~~/shared/types/graphql" ;
1817
1918const { data } = defineProps <ModuleProps <CenterTextFragment >>();
2019
21- const embeddedAssets = computed ((): EmbeddedAsset [] => {
22- const blockAssets = data ?.text ?.links ?.assets ?.block ;
23- if (! blockAssets ?.length ) return [];
24- return blockAssets .filter (
25- (asset ): asset is EmbeddedAsset => asset !== null && asset .sys ?.id != null ,
26- );
20+ const embeddedAssets = computed (() => {
21+ return getEmbeddedAssets (data ?.text ?.links );
2722});
2823 </script >
Original file line number Diff line number Diff line change 1+ import type { EmbeddedAsset } from "~/components/render/RichTextRenderer.vue" ;
12import type { Pagination } from "~~/shared/types/Pagination" ;
23
34export const ariaCurrent = ( route : string , currentRoute : string ) => {
@@ -36,3 +37,12 @@ export const formatRelationshipType = (type: string) => {
3637 return type ;
3738 }
3839} ;
40+
41+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42+ export const getEmbeddedAssets = ( links : any ) : EmbeddedAsset [ ] => {
43+ const blockAssets = ( links ?. assets ?. block ?? [ ] ) as ( EmbeddedAsset | null ) [ ] ;
44+ if ( ! blockAssets ?. length ) return [ ] ;
45+ return blockAssets . filter (
46+ ( asset ) : asset is EmbeddedAsset => asset !== null && asset . sys ?. id != null ,
47+ ) ;
48+ } ;
Original file line number Diff line number Diff line change @@ -5,6 +5,16 @@ export const TITLE_COPY_FRAGMENT = gql`
55 title
66 copy {
77 json
8+ links {
9+ assets {
10+ block {
11+ sys {
12+ id
13+ }
14+ ...Image
15+ }
16+ }
17+ }
818 }
919 }
1020` ;
You can’t perform that action at this time.
0 commit comments