- {typeof item.price === 'number' ? `${item.price},-` : item.price}
- {typeof item.duration === 'number' ? `/${convertMinutesToHours(item.duration)}` : ''}
+ {typeof service.price === 'number' ? `${service.price},-` : service.price}
+ {typeof service.duration === 'number' ? `/${convertMinutesToHours(service.duration)}` : ''}
Rezervace
diff --git a/src/lib/components/services/ServicesLayout.svelte b/src/lib/components/services/ServicesLayout.svelte
index 12fc421..1859885 100644
--- a/src/lib/components/services/ServicesLayout.svelte
+++ b/src/lib/components/services/ServicesLayout.svelte
@@ -1,43 +1,30 @@
-
-
+
- {#each services as service}
+ {#each category as c}
-
+
+ {c.title}
- {service.category}
+ {c.description}
- {#each service.items as item}
-
+ {#each c.services as service}
+
{/each}
{/each}
-
-
-
-
+
diff --git a/src/lib/components/services/Testimonial.svelte b/src/lib/components/services/Testimonial.svelte
deleted file mode 100644
index d6ec587..0000000
--- a/src/lib/components/services/Testimonial.svelte
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
Edison bulb retro cloud bread echo park, helvetica stumptown taiyaki taxidermy 90's cronut +1 kinfolk. Single-origin coffee ennui shaman taiyaki vape DIY tote bag drinking vinegar cronut adaptogen squid fanny pack vaporware.
-
-
HOLDEN CAULFIELD
-
Senior Product Designer
-
-
-
-
-
-
Edison bulb retro cloud bread echo park, helvetica stumptown taiyaki taxidermy 90's cronut +1 kinfolk. Single-origin coffee ennui shaman taiyaki vape DIY tote bag drinking vinegar cronut adaptogen squid fanny pack vaporware.
-
-
ALPER KAMU
-
UI Develeoper
-
-
-
-
-
-
Edison bulb retro cloud bread echo park, helvetica stumptown taiyaki taxidermy 90's cronut +1 kinfolk. Single-origin coffee ennui shaman taiyaki vape DIY tote bag drinking vinegar cronut adaptogen squid fanny pack vaporware.
-
-
HENRY LETHAM
-
CTO
-
-
-
-
-
\ No newline at end of file
diff --git a/src/lib/types/ogMetadata.d.ts b/src/lib/types/ogMetadata.d.ts
index fdbc228..c6e810f 100644
--- a/src/lib/types/ogMetadata.d.ts
+++ b/src/lib/types/ogMetadata.d.ts
@@ -10,5 +10,5 @@ export interface OpenGraphMetadata {
imageType: OGImageType;
imageWidth: OGImageWidth;
imageHeight: OGImageHeight;
- url: string;
+ canonical: string;
};
diff --git a/src/lib/types/service.d.ts b/src/lib/types/service.d.ts
index bd656e2..5a3eeb3 100644
--- a/src/lib/types/service.d.ts
+++ b/src/lib/types/service.d.ts
@@ -2,7 +2,7 @@ import type { MarkdownMetadata } from '$lib/types/mdMetadata';
import type { OpenGraphMetadata } from '$lib/types/ogMetadata';
// Base service item type
-export interface Service {
+export type Service = {
title: string;
description: string;
id: string;
diff --git a/src/lib/utils/formatParse.ts b/src/lib/utils/formatParse.ts
index bcb752c..cc60cdc 100644
--- a/src/lib/utils/formatParse.ts
+++ b/src/lib/utils/formatParse.ts
@@ -40,30 +40,3 @@ export const readJsonFile = async (filePath: string) => {
const jsonData = await fs.readFileSync(path.join(process.cwd(), 'src', 'content', filePath), 'utf-8');
return JSON.parse(jsonData);
}
-
-// ======= MARKDOWN PARSER ========
-
-// https://github.com/jonschlinkert/gray-matter
-import * as matter from 'gray-matter';
-// https://github.com/markedjs/marked
-// import marked from 'marked';
-
-export const parseMarkdownFile = async (filePath: string) => {
- const markdownData = await fs.readFileSync(path.join(process.cwd(), 'src', 'content', filePath), 'utf-8');
- const { data, content } = matter(markdownData);
- return { frontmatter: data, content };
-}
-// export function parseMarkdown
(filePath: string): { frontmatter: T; content: string } {
-// const data = matter.read(filePath).data;
-// return {
-// frontmatter: data as T,
-// };
-// }
-// export function parseMarkdownFile(filePath: string) {
-// const markdownData = fs.readFileSync(path.join(process.cwd(), filePath), 'utf-8');
-// const { data, content } = grayMatter(markdownData);
-
-// return { frontmatter: data, content };
-// }
-
-console.log(parseMarkdownFile('../../content/permanentni-make-up/pmu/pmu.md'))
diff --git a/src/lib/utils/getMetadata.ts b/src/lib/utils/getMetadata.ts
new file mode 100644
index 0000000..d8dcb9e
--- /dev/null
+++ b/src/lib/utils/getMetadata.ts
@@ -0,0 +1,21 @@
+// ======= MARKDOWN PARSER ========
+
+// https://github.com/jonschlinkert/gray-matter
+import matter from 'gray-matter';
+// https://github.com/markedjs/marked;- unused
+// import marked from 'marked';
+import fs from 'fs';
+import path from 'path'
+
+export const parseMarkdownFile = async (filePath: string) => {
+ const markdownData = fs.readFileSync(path.join(process.cwd(), 'src', 'content', filePath), 'utf-8');
+ const { data, content } = matter(markdownData);
+ return { frontmatter: data, content };
+}
+// export function parseMarkdown(filePath: string): { frontmatter: T; content: string } {
+// const data = matter.read(filePath).data;
+// return {
+// frontmatter: data as T,
+// };
+// }
+console.log(parseMarkdownFile('../../content/permanentni-make-up/pmu/pmu.md'))
diff --git a/src/lib/utils/imageService.ts b/src/lib/utils/imageService.ts
new file mode 100644
index 0000000..64d8a39
--- /dev/null
+++ b/src/lib/utils/imageService.ts
@@ -0,0 +1,21 @@
+// imageService.ts
+import cloudinary from 'cloudinary';
+import imagesData from '$content/images.json';
+
+cloudinary.v2.config({
+ cloud_name: import.meta.env.VITE_CLOUDINARY_CLOUD_NAME,
+});
+
+export const getCloudinaryImageUrl = (publicId: string, options: cloudinary.UploadApiOptions = {}) => {
+ const imageData = imagesData[publicId];
+ if (!imageData) {
+ throw new Error(`Image with public ID ${publicId} not found in images.json`);
+ }
+
+ const transformationOptions = {
+ ...options,
+ ...imageData.transformations,
+ };
+
+ return cloudinary.v2.url(publicId, transformationOptions);
+};
diff --git a/src/lib/utils/uploadImages.ts b/src/lib/utils/uploadImages.ts
new file mode 100644
index 0000000..53dd7fe
--- /dev/null
+++ b/src/lib/utils/uploadImages.ts
@@ -0,0 +1,49 @@
+// uploadImages.ts
+import fs from 'fs';
+import path from 'path';
+import cloudinary from 'cloudinary';
+import matter from 'gray-matter';
+
+cloudinary.v2.config({
+ cloud_name: import.meta.env.VITE_CLOUDINARY_CLOUD_NAME,
+ api_key: import.meta.env.VITE_CLOUDINARY_API_KEY,
+ api_secret: import.meta.env.VITE_CLOUDINARY_API_SECRET,
+});
+
+const contentDir = 'src/content';
+const imagesJsonPath = 'src/content/images.json';
+
+async function uploadImages() {
+ const imagesData = {};
+
+ // Read all Markdown files in the content directory
+ const mdFiles = fs.readdirSync(contentDir).filter((file) => file.endsWith('.md'));
+
+ for (const mdFile of mdFiles) {
+ const mdFilePath = path.join(contentDir, mdFile);
+ const mdContent = fs.readFileSync(mdFilePath, 'utf-8');
+ const { data, content } = matter(mdContent);
+
+ // Extract relative image paths from the Markdown content
+ const imagePaths = content.match(/\!\[.*?\]\((.*?)\)/g) || [];
+
+ for (const imagePath of imagePaths) {
+ const relativeImagePath = imagePath.match(/\((.*?)\)/)[1];
+ const imageFilePath = path.join(contentDir, relativeImagePath);
+
+ // Upload the image to Cloudinary
+ const uploadResult = await cloudinary.v2.uploader.upload(imageFilePath);
+
+ // Add the image metadata to the imagesData object
+ imagesData[uploadResult.public_id] = {
+ publicId: uploadResult.public_id,
+ // Add any desired transformation options here
+ };
+ }
+ }
+
+ // Write the imagesData to the images.json file
+ fs.writeFileSync(imagesJsonPath, JSON.stringify(imagesData, null, 2));
+}
+
+uploadImages();
diff --git a/src/routes/o-mne/+page.svelte b/src/routes/o-mne/+page.svelte
index e69de29..220a4ef 100644
--- a/src/routes/o-mne/+page.svelte
+++ b/src/routes/o-mne/+page.svelte
@@ -0,0 +1,3 @@
+
diff --git a/src/routes/sluzby/+page.svelte b/src/routes/sluzby/+page.svelte
index a693eba..9afa9d9 100644
--- a/src/routes/sluzby/+page.svelte
+++ b/src/routes/sluzby/+page.svelte
@@ -1,73 +1,17 @@
+{#if props.services.length === 0}
+
+ Loading services...
+{:else}
Ceník služeb
Koukněte se jak vás mohu zkrášlit a rezervujte si termín
-
\ No newline at end of file
+
+{/if}
diff --git a/src/lib/components/services/3Testimonials.svelte b/src/routes/sluzby/[categoryId]/+page.svelte
similarity index 100%
rename from src/lib/components/services/3Testimonials.svelte
rename to src/routes/sluzby/[categoryId]/+page.svelte
diff --git a/src/routes/sluzby/[categoryId]/[serviceId]/+page.svelte b/src/routes/sluzby/[categoryId]/[serviceId]/+page.svelte
new file mode 100644
index 0000000..ab9e9eb
--- /dev/null
+++ b/src/routes/sluzby/[categoryId]/[serviceId]/+page.svelte
@@ -0,0 +1,12 @@
+
+
+
+