From fdb2b9b4edc841d190cac0f40b214548d88c24a5 Mon Sep 17 00:00:00 2001 From: matthieu42morin Date: Sat, 30 Mar 2024 05:04:43 +0100 Subject: [PATCH] type changes --- src/lib/types/images.d.ts | 6 ++++++ src/lib/types/instagram.d.ts | 4 ++-- src/lib/types/mdMetadata.d.ts | 21 +++++++++++++++++++++ src/lib/types/ogMetadata.d.ts | 14 ++++++++++++++ src/lib/types/product.d.ts | 8 -------- src/lib/types/service.d.ts | 34 ++++++++++++++++++++++++---------- 6 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 src/lib/types/images.d.ts create mode 100644 src/lib/types/mdMetadata.d.ts create mode 100644 src/lib/types/ogMetadata.d.ts delete mode 100644 src/lib/types/product.d.ts diff --git a/src/lib/types/images.d.ts b/src/lib/types/images.d.ts new file mode 100644 index 0000000..cd65ac1 --- /dev/null +++ b/src/lib/types/images.d.ts @@ -0,0 +1,6 @@ +export type ImageLinkArgs = { + urlOrPublicId: string; + h: number; + w: number; + max?: boolean; +}; diff --git a/src/lib/types/instagram.d.ts b/src/lib/types/instagram.d.ts index 4b5843c..2fa7341 100644 --- a/src/lib/types/instagram.d.ts +++ b/src/lib/types/instagram.d.ts @@ -1,7 +1,7 @@ -export type InstagramPost = { +export interface InstagramPost { id: string; media_type: string; media_url: string; caption: string; timestamp: string; -} \ No newline at end of file +} diff --git a/src/lib/types/mdMetadata.d.ts b/src/lib/types/mdMetadata.d.ts new file mode 100644 index 0000000..b7789de --- /dev/null +++ b/src/lib/types/mdMetadata.d.ts @@ -0,0 +1,21 @@ +export interface MarkdownHeading { + title: string; + slug: string; + level: number; + children: MarkdownHeading[]; +} + +export interface MarkdownMetadata { + headings: MarkdownHeading[]; + frontmatter: MarkdownFrontmatter; +} + +// Type for markdown frontmatter +export interface MarkdownFrontmatter { + title: string; + date: string; + tags: Tag[]; + published?: boolean; +}; + +export type Tag = 'PMU' | 'permanentní makeup' | 'vizáž' | 'depilace' | 'vakuslim' | 'ošetření' | 'makeup' | 'pleť' | 'péče' | 'beauty' | 'salon' | 'salón' | 'kosmetika' | ''; diff --git a/src/lib/types/ogMetadata.d.ts b/src/lib/types/ogMetadata.d.ts new file mode 100644 index 0000000..fdbc228 --- /dev/null +++ b/src/lib/types/ogMetadata.d.ts @@ -0,0 +1,14 @@ +export type OGType = "Article" | "Website"; +export type OGImageType = "image/png" | "image/jpg" | "image/webp" | "image/gif" // fill this out and correct it please +export type OGImageHeight = 512 +export type OGImageWidth = 1024 +// make the logic so that we have either a image width and heigh a 2:1 or 16:9 ratio , ie choose one or the other +// should I declare other properties when they will be defined outside of this type in the component? I guess url will be gotten conditionally +export interface OpenGraphMetadata { + type: OGType; + image: string; + imageType: OGImageType; + imageWidth: OGImageWidth; + imageHeight: OGImageHeight; + url: string; +}; diff --git a/src/lib/types/product.d.ts b/src/lib/types/product.d.ts deleted file mode 100644 index bb1ec3b..0000000 --- a/src/lib/types/product.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type Product = { - id: string; - name: string; - price: number; - description: string; - image: string; - url: string; -} \ No newline at end of file diff --git a/src/lib/types/service.d.ts b/src/lib/types/service.d.ts index 16d0e52..bd656e2 100644 --- a/src/lib/types/service.d.ts +++ b/src/lib/types/service.d.ts @@ -1,10 +1,24 @@ -export type Service = { - category: string; - items: { - name: string; - description: string; - id: string; - price: number | string; - duration: number | string; - }[]; -}; \ No newline at end of file +import type { MarkdownMetadata } from '$lib/types/mdMetadata'; +import type { OpenGraphMetadata } from '$lib/types/ogMetadata'; + +// Base service item type +export interface Service { + title: string; + description: string; + id: string; + image: string; + price: number | string; + duration: number | string; +}; + +export interface Category { + title: string; + description: string; + id: string; + image: string; + services: Service[]; +} + +// Extended service item type with OpenGraph metadata +export type ExtendedService = Service & OpenGraphMetadata & MarkdownMetadata; +export type ExtendedCategory = Category & OpenGraphMetadata & MarkdownMetadata;