diff --git a/components/Base/Video.vue b/components/Base/Video.vue index 869a5588..24003f81 100644 --- a/components/Base/Video.vue +++ b/components/Base/Video.vue @@ -1,14 +1,14 @@ + + + + diff --git a/components/Block/types.ts b/components/Block/types.ts new file mode 100644 index 00000000..cda47449 --- /dev/null +++ b/components/Block/types.ts @@ -0,0 +1,3 @@ +export interface BlockProps { + uuid: string; +} diff --git a/components/PageBuilder.vue b/components/PageBuilder.vue index 44d5f23d..59a15596 100644 --- a/components/PageBuilder.vue +++ b/components/PageBuilder.vue @@ -20,14 +20,14 @@ export interface PageBuilderSectionBlock { defineProps(); const components: Record> = { - block_hero_form: resolveComponent('BlockHeroForm'), + block_hero_form: 'div', block_cardgroup: 'div', block_columns: 'div', block_featuregrid: 'div', block_hero_headline: 'div', block_hero_rotator: 'div', block_logocloud: 'div', - block_media_fullwidth: 'div', + block_media_fullwidth: resolveComponent('BlockMediaFullWidth'), block_pageheader: 'div', block_separator: 'div', block_showcase: 'div', @@ -38,7 +38,7 @@ const components: Record> = {
- +
diff --git a/composables/useFiles.ts b/composables/useFiles.ts deleted file mode 100644 index a6d338bf..00000000 --- a/composables/useFiles.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { File } from '~/types/schema'; - -export default function useFiles() { - const config = useRuntimeConfig(); - - function fileUrl(fileId: string | File | null | undefined) { - if (typeof fileId === 'object') { - fileId = fileId?.id; - } - - return `${config.public.directusUrl}/assets/${fileId}?token=${config.public.directusToken}`; /** @TODO: Drop the token when we make assets public. */ - } - - return { - fileUrl, - }; -} diff --git a/pages/[...permalink].vue b/pages/[...permalink].vue index 695fbc94..4c8977a3 100644 --- a/pages/[...permalink].vue +++ b/pages/[...permalink].vue @@ -10,7 +10,6 @@ const pageFilter = computed(() => { }); const { data: page } = await useAsyncData( - path, () => { return $directus.request( readItems('pages', { diff --git a/types/schema/content/page/block/block-media-full-width.ts b/types/schema/content/page/block/block-media-full-width.ts index 77fea24f..61e3deb4 100644 --- a/types/schema/content/page/block/block-media-full-width.ts +++ b/types/schema/content/page/block/block-media-full-width.ts @@ -1,3 +1,4 @@ +import type { File } from '../../../system/file.js'; import type { Video } from '../../video.js'; export interface BlockMediaFullWidth { diff --git a/types/schema/schema.ts b/types/schema/schema.ts index 57a1cd64..0d76b657 100644 --- a/types/schema/schema.ts +++ b/types/schema/schema.ts @@ -1,4 +1,14 @@ -import type { Article, Career, CaseStudy, Form, Page, Report, SiteBanner, Video } from './content/index.js'; +import type { + Article, + BlockMediaFullWidth, + Career, + CaseStudy, + Form, + Page, + Report, + SiteBanner, + Video, +} from './content/index.js'; import type { Globals, Navigation, Redirect, Seo } from './meta/index.js'; import type { ContentType, Event, Partner, Team } from './routes/index.js'; import type { File, User } from './system/index.js'; @@ -21,6 +31,9 @@ export interface Schema { reports: Report[]; case_studies: CaseStudy[]; + // Blocks + block_media_fullwidth: BlockMediaFullWidth[]; + // Meta navigation: Navigation[]; globals: Globals; diff --git a/utils/getFileUrl.ts b/utils/getFileUrl.ts new file mode 100644 index 00000000..e3406884 --- /dev/null +++ b/utils/getFileUrl.ts @@ -0,0 +1,11 @@ +import { File } from '~/types/schema'; + +export const getFileUrl = (fileId: string | File | null | undefined) => { + const config = useRuntimeConfig(); + + if (typeof fileId === 'object') { + fileId = fileId?.id; + } + + return `${config.public.directusUrl}/assets/${fileId}?token=${config.public.directusToken}`; /* TODO Drop the token when we make assets public. */ +};