Compare commits
78 Commits
231131cc41
...
astro/buil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b13935c7c5 | ||
|
|
0ef04d5f3e | ||
|
|
d9430335d5 | ||
|
|
9a92b1939c | ||
|
|
b304cc400c | ||
|
|
79e343dbdc | ||
|
|
7116aa2348 | ||
|
|
c112a69f0e | ||
|
|
4a9d0fb273 | ||
|
|
29c47ab72d | ||
|
|
27b8dc4118 | ||
|
|
45a2627ec6 | ||
|
|
eba518ccc2 | ||
|
|
3cfe6697a9 | ||
|
|
07716dae17 | ||
|
|
db65ac52a3 | ||
|
|
fdc8a0aae6 | ||
|
|
092d2a4458 | ||
|
|
760281f7a4 | ||
|
|
157cb9389c | ||
|
|
be02d749dd | ||
|
|
feac162baa | ||
|
|
f86630bcb0 | ||
|
|
abaea70c7b | ||
|
|
1fde3d4f69 | ||
|
|
7b5a8bc705 | ||
|
|
d284010e28 | ||
|
|
66409ab859 | ||
|
|
46e705f6ea | ||
|
|
3bd4de2f30 | ||
|
|
00e4826744 | ||
|
|
2744e6173c | ||
|
|
915879beac | ||
|
|
6d4a62fae7 | ||
|
|
506a5ed14e | ||
|
|
2374a6bd22 | ||
|
|
8bc95d0f50 | ||
|
|
3485c4583d | ||
|
|
ee949aa76f | ||
|
|
07d2c8628f | ||
|
|
d39a98a42f | ||
|
|
525422105c | ||
|
|
a0473094cf | ||
|
|
36004bddb0 | ||
|
|
89bbbf5595 | ||
|
|
4ccbc9d9a8 | ||
|
|
b73066352e | ||
|
|
f95f792775 | ||
|
|
5c161b8381 | ||
|
|
47e50a3ba4 | ||
|
|
cf12428f98 | ||
|
|
67362dad96 | ||
|
|
82587a6211 | ||
|
|
c05b50877b | ||
|
|
9bf417478a | ||
|
|
4f955a9ec6 | ||
|
|
f1b0d269bf | ||
|
|
32c698c39a | ||
|
|
aa93600c79 | ||
|
|
0b45967d30 | ||
|
|
39c26e73c6 | ||
|
|
abd98ff21b | ||
|
|
3435819f79 | ||
|
|
cabdbd51cc | ||
|
|
1e3243aac3 | ||
|
|
54e53d278e | ||
|
|
f4319c4165 | ||
|
|
e6977ec7dd | ||
|
|
7e501c399b | ||
|
|
5cbc906d65 | ||
|
|
a6e3a48313 | ||
|
|
8afacdbe7a | ||
|
|
ad25836de7 | ||
|
|
5476783e0c | ||
|
|
56cdc5257d | ||
|
|
e841c4f433 | ||
|
|
0bb52c6818 | ||
|
|
e2598c58cf |
@@ -1,14 +1,45 @@
|
||||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import preact from '@astrojs/preact';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import graphql from '@rollup/plugin-graphql';
|
||||
import { defineConfig } from "astro/config";
|
||||
import preact from "@astrojs/preact";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import graphql from "@rollup/plugin-graphql";
|
||||
import playformCompress from "@playform/compress";
|
||||
import { getFiles } from "./src/build/files.ts";
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
integrations: [preact()],
|
||||
|
||||
integrations: [preact(), playformCompress({
|
||||
CSS: true,
|
||||
Image: false,
|
||||
JSON: true,
|
||||
JavaScript: false,
|
||||
HTML: true
|
||||
}), {
|
||||
name: "download-files",
|
||||
hooks: {
|
||||
"astro:build:start": async ({ }) => {
|
||||
await getFiles();
|
||||
}
|
||||
}
|
||||
}],
|
||||
output: "static",
|
||||
prefetch: true,
|
||||
build: {
|
||||
assets: "assets"
|
||||
},
|
||||
image: {
|
||||
domains: ["development.directus.itsfinniii.com"]
|
||||
},
|
||||
vite: {
|
||||
plugins: [tailwindcss(), graphql()]
|
||||
plugins: [graphql(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
react: "preact/compat",
|
||||
"react-dom": "preact/compat",
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ["@immich/justified-layout-wasm"]
|
||||
}
|
||||
}
|
||||
});
|
||||
20
astro/changelogs.md
Normal file
20
astro/changelogs.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# 1.0.0.0 - Release
|
||||
**Release date: **
|
||||
|
||||
- Add web pages with the following components:
|
||||
- Contact
|
||||
- Equipment Table
|
||||
- Frequently Asked Questions
|
||||
- Hero
|
||||
- Last Albums
|
||||
- Last Blogs
|
||||
- Last Projects
|
||||
- Reviews
|
||||
- Text with Side Image
|
||||
- Upcoming Events
|
||||
- Wall of Text
|
||||
- Add blogs
|
||||
- Add projects
|
||||
- Add photo categories, photo albums and photos
|
||||
- Add sitemaps
|
||||
- Add robots.txt
|
||||
3418
astro/package-lock.json
generated
3418
astro/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,11 +9,14 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/preact": "^4.1.3",
|
||||
"@astrojs/preact": "^5.1.2",
|
||||
"@directus/sdk": "^21.2.0",
|
||||
"@immich/justified-layout-wasm": "^0.4.3",
|
||||
"@playform/compress": "^0.2.3",
|
||||
"@rollup/plugin-graphql": "^2.0.5",
|
||||
"@tailwindcss/vite": "^4.2.1",
|
||||
"astro": "^5.17.1",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@tailwindcss/vite": "^4.2.4",
|
||||
"astro": "^6.1.9",
|
||||
"highlight.js": "^11.11.1",
|
||||
"markdown-it": "^14.1.1",
|
||||
"markdown-it-highlightjs": "^4.3.0",
|
||||
@@ -21,10 +24,14 @@
|
||||
"mdast-util-to-string": "^4.0.0",
|
||||
"minify-xml": "^4.5.2",
|
||||
"preact": "^10.28.4",
|
||||
"react-responsive-masonry": "^2.7.2",
|
||||
"reading-time": "^1.5.0",
|
||||
"tailwindcss": "^4.2.1",
|
||||
"tailwindcss": "^4.2.4",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"overrides": {
|
||||
"vite": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/markdown-it": "^14.1.2",
|
||||
"@types/md5": "^2.3.6"
|
||||
|
||||
3
astro/src/build/files.ts
Normal file
3
astro/src/build/files.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// This file gets files, and puts them in the public folder before starting the build.
|
||||
export async function getFiles() {
|
||||
}
|
||||
@@ -1,9 +1,57 @@
|
||||
---
|
||||
import { getAllPaginatedBlogs } from "@/content/blogs/blogs";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { getBlogRoute } from "@/lib/routing";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
page: BlogIndex;
|
||||
}
|
||||
|
||||
const { page } = Astro.props;
|
||||
const { pageNumber } = page;
|
||||
|
||||
const settings = await getSettings();
|
||||
const blogs = await getAllPaginatedBlogs(settings, pageNumber);
|
||||
---
|
||||
|
||||
<div>Blog Index</div>
|
||||
<div
|
||||
id={`blogindex-${pageNumber}`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-8 gap-x-18 w-full"
|
||||
>
|
||||
<div class="flex flex-col justify-center items-center gap-2.5">
|
||||
<h1 class="text-5xl font-bold">{ settings.blog.title }</h1>
|
||||
{ settings.blog.subtext !== null && (
|
||||
<div set:html={markdownToHtml(settings.blog.subtext)}></div>
|
||||
) }
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-6">
|
||||
{ blogs.map((blog) => {
|
||||
const imageSize = getImageSize(blog.searchEngine.thumbnail.width, blog.searchEngine.thumbnail.height, 0.5);
|
||||
|
||||
return (
|
||||
<a href={getBlogRoute(settings.blog, blog)} class={`flex flex-col gap-2`}>
|
||||
<Image
|
||||
src={getImageUrl(blog.searchEngine.thumbnail.url)}
|
||||
alt={blog.title}
|
||||
class="flex rounded-2xl shadow-md w-full"
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
/>
|
||||
<div class="flex flex-col gap-1">
|
||||
<h4 class="font-semibold text-[28px]">{blog.title}</h4>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
<CalendarIcon width={20} height={20} />
|
||||
<div>{blog.date}</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
)
|
||||
|
||||
}) }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
41
astro/src/components/blogs/BlogPost.astro
Normal file
41
astro/src/components/blogs/BlogPost.astro
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { getTypographyClasses } from "@/styles/markdownClasses";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
blog: BlogPost;
|
||||
}
|
||||
|
||||
const { blog } = Astro.props;
|
||||
---
|
||||
|
||||
<div
|
||||
id={`blog-${blog.id}`}
|
||||
class="flex flex-row justify-center items-center"
|
||||
>
|
||||
<div class="flex lg:flex-col flex-col py-12 px-12 gap-y-8 gap-x-18 lg:max-w-[50%]">
|
||||
<div class="flex flex-col gap-3">
|
||||
<h1 class="font-semibold text-5xl">{blog.title}</h1>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
<CalendarIcon width={20} height={20} />
|
||||
<div>{blog.date}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="aspect-1200/630 w-full max-w-full overflow-hidden">
|
||||
<div class="w-full h-full rounded-2xl shadow-md object-cover">
|
||||
<Image
|
||||
src={blog.searchEngine.thumbnail.url}
|
||||
width={blog.searchEngine.thumbnail.width}
|
||||
height={blog.searchEngine.thumbnail.height}
|
||||
alt={blog.title}
|
||||
class="rounded-2xl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div set:html={markdownToHtml(blog.content)} class={`${getTypographyClasses()} min-w-full`}></div>
|
||||
</div>
|
||||
</div>
|
||||
24
astro/src/components/common/Pagination.astro
Normal file
24
astro/src/components/common/Pagination.astro
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
interface Props {
|
||||
page: number;
|
||||
totalPages: number;
|
||||
urlTemplate: string;
|
||||
}
|
||||
|
||||
const { page, totalPages, urlTemplate } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="flex flex-row gap-2">
|
||||
{ totalPages < 7 && (
|
||||
<>
|
||||
{ [...Array(totalPages)].map((_: number, i: number) => (
|
||||
<a
|
||||
href={`${i + 1 === 1 ? urlTemplate : `${urlTemplate}/${i + 1}`}`}
|
||||
class={`flex select-none hover:cursor-pointer text-lg justify-center items-center
|
||||
${(i + 1 === page) ? "bg-(--ptc) text-(--ptt)" : "bg-neutral-200"} hover:bg-(--stc) hover:text-(--stt) duration-300 shadow-md rounded-full w-12 h-12`.trim()}>
|
||||
<span>{i + 1}</span>
|
||||
</a>
|
||||
)) }
|
||||
</>
|
||||
) }
|
||||
</div>
|
||||
72
astro/src/components/footer/Footer.astro
Normal file
72
astro/src/components/footer/Footer.astro
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
import { getFooter } from "@/content/footer/footer";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
const footer = await getFooter();
|
||||
---
|
||||
|
||||
<footer class="w-full mt-4">
|
||||
<div class="flex flex-col pt-12 pb-8 px-12 lg:container mx-auto">
|
||||
<div class="flex md:flex-row flex-col justify-center pt-12 pb-8 md:px-1 px-0 lg:container md:mx-auto md:gap-y-8 gap-y-12 md:gap-x-24 gap-x-0">
|
||||
{ (footer.title !== null || footer.logo !== null) && (
|
||||
<div class="flex flex-col gap-3">
|
||||
{ footer.title !== null && <h2 class="text-5xl font-bold">{footer.title}</h2>}
|
||||
{ footer.logo !== null && (
|
||||
<Image
|
||||
src={footer.logo.url}
|
||||
width={footer.logo.width}
|
||||
height={footer.logo.height}
|
||||
alt={footer.title ?? ""}
|
||||
class="md:w-50 w-[50%] h-auto"
|
||||
/>
|
||||
) }
|
||||
</div>
|
||||
) }
|
||||
|
||||
{ footer.columns.map((column) => (
|
||||
<div class="flex flex-col gap-3 w-fit">
|
||||
<h2 class="text-4xl font-bold">{column.title}</h2>
|
||||
<div class="flex flex-col gap-3 w-fit">
|
||||
{column.links.map((link) => (
|
||||
<a class="text-lg text-neutral-800 hover:text-(--ptc) duration-300" href={link.url}>
|
||||
<span class="w-fit">{link.text}</span>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
|
||||
{ footer.socials !== null && (
|
||||
<div class="flex flex-row gap-3 justify-center">
|
||||
{ footer.socials.map((social) => (
|
||||
<a href={social.url} target="_blank" class="bg-neutral-300 hover:bg-neutral-200 duration-300 shadow-sm rounded-full">
|
||||
<div class="p-2">
|
||||
<Image
|
||||
src={social.icon.url}
|
||||
width={32}
|
||||
height={32}
|
||||
alt={social.name}
|
||||
/>
|
||||
</div>
|
||||
</a>
|
||||
)) }
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
|
||||
{ (footer.copyright !== null || footer.secondaryLinks !== null) && (
|
||||
<div class="border-t border-t-neutral-200 w-full bg-neutral-50">
|
||||
<div class="flex md:flex-row flex-col justify-between py-8 px-12 lg:container mx-auto gap-y-8 gap-x-24">
|
||||
{ footer.copyright !== null && (<div class="text-neutral-600">{footer.copyright}</div>) }
|
||||
{ footer.secondaryLinks !== null && (
|
||||
<div class="flex flex-row gap-1.5">
|
||||
{ footer.secondaryLinks.map((link) => (
|
||||
<a class="text-neutral-600 hover:text-(--ptc) duration-300 w-fit" href={link.url}>{link.text}</a>
|
||||
)) }
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
</footer>
|
||||
55
astro/src/components/photos/Album.astro
Normal file
55
astro/src/components/photos/Album.astro
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
import { getAlbumRoute, getPhotoRoute } from "@/lib/routing";
|
||||
import { AlbumPhotos } from "./Album.tsx";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import Pagination from "@/components/common/Pagination.astro";
|
||||
|
||||
interface Props {
|
||||
page: PhotoAlbumPage;
|
||||
}
|
||||
|
||||
const settings = await getSettings();
|
||||
const album = Astro.props.page;
|
||||
const pageNumber = Astro.props.page.pageNumber;
|
||||
|
||||
const totalAlbumPages = Math.ceil(album.photos.length / settings.photo.album.perPage);
|
||||
const sliceStartNumber = (pageNumber - 1) * settings.photo.album.perPage;
|
||||
const sliceEndNumber = pageNumber * settings.photo.album.perPage;
|
||||
|
||||
const remappedPhotos: PhotoAlbumGalleryItem[] = [];
|
||||
|
||||
album.photos.slice(sliceStartNumber, sliceEndNumber).forEach((photo) => {
|
||||
const resizedImage = getImageSize(photo.photo.width, photo.photo.height, 0.756);
|
||||
|
||||
remappedPhotos.push({
|
||||
id: photo.id,
|
||||
url: getPhotoRoute(settings.photo, album, photo),
|
||||
photo: {
|
||||
url: getImageUrl(photo.photo.url),
|
||||
width: resizedImage.width,
|
||||
height: resizedImage.height
|
||||
},
|
||||
text: photo.text
|
||||
});
|
||||
});
|
||||
---
|
||||
|
||||
<div
|
||||
id={`album-${album.id}`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-10 gap-x-18 w-full"
|
||||
>
|
||||
<div class="flex flex-col gap-7">
|
||||
<h1 class="text-5xl font-bold">{album.title}</h1>
|
||||
|
||||
<AlbumPhotos client:only photos={remappedPhotos} />
|
||||
|
||||
{ totalAlbumPages > 1 && (
|
||||
<Pagination
|
||||
page={pageNumber}
|
||||
totalPages={totalAlbumPages}
|
||||
urlTemplate={getAlbumRoute(settings.photo, album)}
|
||||
/>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
87
astro/src/components/photos/Album.tsx
Normal file
87
astro/src/components/photos/Album.tsx
Normal file
@@ -0,0 +1,87 @@
|
||||
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
|
||||
import { JustifiedLayout } from "@immich/justified-layout-wasm";
|
||||
import { LoadingSpinner } from "@/icons/jsx/loadingSpinner";
|
||||
|
||||
export function AlbumPhotos(props: { photos: PhotoAlbumGalleryItem[] }) {
|
||||
const containerRef = useRef(null);
|
||||
|
||||
const [ hasMounted, setHasMounted ] = useState<boolean>(false);
|
||||
const [ layout, setLayout ] = useState<JustifiedLayout | null>(null);
|
||||
const [ containerWidth, setContainerWidth ] = useState<number | null>(null);
|
||||
const [ containerHeight, setContainerHeight ] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setHasMounted(true);
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (!hasMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
const observer = new ResizeObserver((entries) => {
|
||||
setContainerWidth(entries[0].contentRect.width);
|
||||
});
|
||||
|
||||
if (containerRef.current) {
|
||||
observer.observe(containerRef.current);
|
||||
}
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, [ hasMounted ]);
|
||||
|
||||
useEffect(() => {
|
||||
if (containerWidth === null || !hasMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
const aspectRatios = new Float32Array(props.photos.map((photo => photo.photo.width / photo.photo.height)));
|
||||
|
||||
const justifiedLayout = new JustifiedLayout(aspectRatios, {
|
||||
rowHeight: 265,
|
||||
rowWidth: containerWidth,
|
||||
spacing: 10,
|
||||
heightTolerance: 0.11
|
||||
});
|
||||
|
||||
setContainerHeight(justifiedLayout.containerHeight);
|
||||
setLayout(justifiedLayout);
|
||||
}, [ containerWidth, hasMounted ])
|
||||
|
||||
return (
|
||||
<div ref={containerRef} id={`albumgallery`}>
|
||||
{ layout !== null ? (
|
||||
<div class="relative w-full" style={{ height: containerHeight }}>
|
||||
{ props.photos.map((photo, index: number) => {
|
||||
const layoutPosition = layout.getPosition(index);
|
||||
|
||||
return (
|
||||
<a
|
||||
href={photo.url}
|
||||
key={`photo-${index}`}
|
||||
class="group absolute overflow-hidden bg-neutral-200"
|
||||
style={{
|
||||
top: layoutPosition.top,
|
||||
left: layoutPosition.left,
|
||||
width: layoutPosition.width,
|
||||
height: layoutPosition.height
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={photo.photo.url}
|
||||
alt={photo.text ?? ""}
|
||||
class="group-hover:scale-[101.5%] duration-200 w-full h-full"
|
||||
loading="lazy"
|
||||
/>
|
||||
</a>
|
||||
)
|
||||
}) }
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex ">
|
||||
<LoadingSpinner width={50} height={50} />
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
)
|
||||
}
|
||||
49
astro/src/components/photos/Category.astro
Normal file
49
astro/src/components/photos/Category.astro
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
import { getCategoryAlbums } from "@/content/photos/albums";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import { getImageUrl } from "@/lib/images";
|
||||
import { getAlbumRoute } from "@/lib/routing";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
category: PhotoCategory;
|
||||
}
|
||||
|
||||
const category = Astro.props.category;
|
||||
const settings = await getSettings();
|
||||
const categoryAlbums = await getCategoryAlbums(settings, category.category.url);
|
||||
---
|
||||
|
||||
<div
|
||||
id={`categoryindex`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-10 gap-x-18 w-full"
|
||||
>
|
||||
<div class="flex flex-col justify-center items-center gap-2.5">
|
||||
<h1 class="text-5xl font-bold">{categoryAlbums[0].category.title}</h1>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-5">
|
||||
{ categoryAlbums.map((album) => (
|
||||
<div class="flex flex-row justify-center items-center">
|
||||
<a href={getAlbumRoute(settings.photo, album)} class="group relative block w-[70%] overflow-hidden rounded-2xl shadow-md">
|
||||
<div>
|
||||
<Image
|
||||
src={getImageUrl(album.thumbnail.url)}
|
||||
alt={album.title}
|
||||
width={album.thumbnail.width}
|
||||
height={album.thumbnail.height}
|
||||
class="rounded-2xl transition-transform duration-300 group-hover:scale-102"
|
||||
/>
|
||||
|
||||
<div class="absolute inset-0 bg-black/70 flex items-center justify-center p-6 opacity-0 transition-opacity duration-300 group-hover:opacity-100">
|
||||
<h3 class="text-white text-5xl font-bold text-center tracking-tight">
|
||||
{album.title}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
42
astro/src/components/photos/CategoryIndex.astro
Normal file
42
astro/src/components/photos/CategoryIndex.astro
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
import { getAllCategories } from "@/content/photos/categories";
|
||||
import { getSettings } from "@/content/settings/settings"
|
||||
import { getCategoryRoute } from "@/lib/routing";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
const settings = await getSettings();
|
||||
const categories = await getAllCategories(settings);
|
||||
---
|
||||
|
||||
<div
|
||||
id={`categoryindex`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-10 gap-x-18 w-full"
|
||||
>
|
||||
<div class="flex flex-col justify-center items-center gap-2.5">
|
||||
<h1 class="text-5xl font-bold">Categories</h1>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-5">
|
||||
{ categories.map((category) => (
|
||||
<div class="flex flex-row justify-center items-center">
|
||||
<a href={getCategoryRoute(settings.photo, category)} class="group relative block w-[70%] overflow-hidden rounded-2xl shadow-md">
|
||||
<div>
|
||||
<Image
|
||||
src={category.thumbnail.url}
|
||||
alt={category.title}
|
||||
width={category.thumbnail.width}
|
||||
height={category.thumbnail.height}
|
||||
class="rounded-2xl transition-transform duration-300 group-hover:scale-102"
|
||||
/>
|
||||
|
||||
<div class="absolute inset-0 bg-black/70 flex items-center justify-center p-6 opacity-0 transition-opacity duration-300 group-hover:opacity-100">
|
||||
<h3 class="text-white text-5xl font-bold text-center tracking-tight">
|
||||
{category.title}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
</div>
|
||||
100
astro/src/components/photos/Photo.astro
Normal file
100
astro/src/components/photos/Photo.astro
Normal file
@@ -0,0 +1,100 @@
|
||||
---
|
||||
import { getAlbum } from "@/content/photos/albums";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import ChevronUp from "@/icons/ChevronUp.astro";
|
||||
import Download from "@/icons/Download.astro";
|
||||
import Close from "@/icons/Close.astro";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getAlbumRoute, getPhotoRoute } from "@/lib/routing";
|
||||
import { getImage } from "astro:assets";
|
||||
import { Image } from "astro:assets";
|
||||
import { getPhotoHash } from "@/lib/hash";
|
||||
|
||||
interface Props {
|
||||
page: PhotoPage;
|
||||
}
|
||||
|
||||
const photo = Astro.props.page;
|
||||
|
||||
const settings = await getSettings();
|
||||
const album = await getAlbum(settings, photo.album.url);
|
||||
|
||||
const photoIndex = album.photos.findIndex(p => p.id === photo.id);
|
||||
|
||||
let previousUrl: string | null = null;
|
||||
let nextUrl: string | null = null;
|
||||
|
||||
// Check for previous photo
|
||||
if (photoIndex > 0) {
|
||||
previousUrl = getPhotoRoute(settings.photo, album, album.photos[photoIndex - 1]);
|
||||
}
|
||||
|
||||
// Check for next photo
|
||||
if (photoIndex + 1 < album.photos.length) {
|
||||
nextUrl = getPhotoRoute(settings.photo, album, album.photos[photoIndex + 1]);
|
||||
}
|
||||
|
||||
const albumPageNumber = Math.ceil((photoIndex + 1) / settings.photo.album.perPage);
|
||||
const returnUrl = albumPageNumber > 1
|
||||
? `${getAlbumRoute(settings.photo, album)}/${albumPageNumber}`
|
||||
: getAlbumRoute(settings.photo, album);
|
||||
|
||||
|
||||
const resizedImageSize = getImageSize(photo.photo.width, photo.photo.height, 1);
|
||||
const downloadImageSize = getImageSize(photo.photo.width, photo.photo.height, 5);
|
||||
|
||||
const downloadUrl = await getImage({
|
||||
src: getImageUrl(photo.photo.url),
|
||||
width: downloadImageSize.width,
|
||||
height: downloadImageSize.height,
|
||||
format: "jpeg",
|
||||
quality: 100
|
||||
});
|
||||
|
||||
const downloadFileName = `${album.url.replaceAll("/", "")}-${getPhotoHash(photo)}.jpeg`;
|
||||
---
|
||||
|
||||
<div class="h-screen flex flex-col justify-center items-center">
|
||||
<div class="flex flex-col justify-center items-center h-full">
|
||||
<Image
|
||||
src={getImageUrl(photo.photo.url)}
|
||||
width={resizedImageSize.width}
|
||||
height={resizedImageSize.height}
|
||||
alt={photo.text ?? ""}
|
||||
class="h-full w-full object-contain"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row gap-6 absolute top-8 right-8 text-white py-2.5 px-5 bg-[#000000aa] rounded-full z-10">
|
||||
<a data-astro-prefetch href={downloadUrl.src} download={downloadFileName}>
|
||||
<Download width={36} height={36} />
|
||||
</a>
|
||||
<a data-astro-prefetch href={returnUrl}>
|
||||
<Close width={36} height={36} />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{ photo.text !== null && (
|
||||
<div class="absolute bottom-0 text-white text-xl bg-[#000000aa] w-full px-20 py-8">{photo.text.trim()}</div>
|
||||
) }
|
||||
|
||||
{ previousUrl !== null && (
|
||||
<a
|
||||
data-astro-prefetch
|
||||
href={previousUrl}
|
||||
class="absolute left-8 text-white p-3 bg-[#000000aa] rounded-full z-10 rotate-270"
|
||||
>
|
||||
<ChevronUp width={28} height={28} />
|
||||
</a>
|
||||
) }
|
||||
|
||||
{ nextUrl !== null && (
|
||||
<a
|
||||
data-astro-prefetch
|
||||
href={nextUrl}
|
||||
class="absolute right-8 text-white p-3 bg-[#000000aa] rounded-full z-10 rotate-90"
|
||||
>
|
||||
<ChevronUp width={28} height={28} />
|
||||
</a>
|
||||
) }
|
||||
</div>
|
||||
@@ -1,9 +1,56 @@
|
||||
---
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import { getAllPaginatedProjects } from "@/content/projects/projects";
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { Image } from "astro:assets";
|
||||
import { getProjectRoute } from "@/lib/routing";
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
|
||||
interface Props {
|
||||
page: ProjectIndex;
|
||||
}
|
||||
|
||||
const { page } = Astro.props;
|
||||
const { pageNumber } = page;
|
||||
|
||||
const settings = await getSettings();
|
||||
const projects = await getAllPaginatedProjects(settings, pageNumber);
|
||||
---
|
||||
|
||||
<div>Project Index</div>
|
||||
<div
|
||||
id={`projectindex-${pageNumber}`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-8 gap-x-18 w-full"
|
||||
>
|
||||
<div class="flex flex-col justify-center items-center gap-2.5">
|
||||
<h1 class="text-5xl font-bold">{ settings.project.title }</h1>
|
||||
{ settings.project.subtext !== null && (
|
||||
<div set:html={markdownToHtml(settings.project.subtext)}></div>
|
||||
) }
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-6">
|
||||
{ projects.map((project) => {
|
||||
const imageSize = getImageSize(project.searchEngine.thumbnail.width, project.searchEngine.thumbnail.height, 0.5);
|
||||
|
||||
return (
|
||||
<a href={getProjectRoute(settings.project, project)} class={`flex flex-col gap-2`}>
|
||||
<Image
|
||||
src={getImageUrl(project.searchEngine.thumbnail.url)}
|
||||
alt={project.title}
|
||||
class="flex rounded-2xl shadow-md w-full"
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
/>
|
||||
<div class="flex flex-col gap-1">
|
||||
<h4 class="font-semibold text-[28px]">{project.title}</h4>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
<CalendarIcon width={20} height={20} />
|
||||
<div>{project.date}</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
)
|
||||
}) }
|
||||
</div>
|
||||
</div>
|
||||
|
||||
44
astro/src/components/projects/ProjectPost.astro
Normal file
44
astro/src/components/projects/ProjectPost.astro
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { getImageSize } from "@/lib/images";
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { getTypographyClasses } from "@/styles/markdownClasses";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
project: ProjectPost;
|
||||
}
|
||||
|
||||
const { project } = Astro.props;
|
||||
|
||||
const imageSize = getImageSize(project.searchEngine.thumbnail.width, project.searchEngine.thumbnail.height, 1);
|
||||
---
|
||||
|
||||
<div
|
||||
id={`project-${project.id}`}
|
||||
class="flex flex-row justify-center items-center"
|
||||
>
|
||||
<div class="flex lg:flex-col flex-col py-12 px-12 gap-y-8 gap-x-18 lg:max-w-[50%]">
|
||||
<div class="flex flex-col gap-3">
|
||||
<h1 class="font-semibold text-5xl">{project.title}</h1>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
<CalendarIcon width={20} height={20} />
|
||||
<div>{project.date}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="aspect-1200/630 w-full max-w-full overflow-hidden">
|
||||
<div class="w-full h-full rounded-2xl shadow-md object-cover">
|
||||
<Image
|
||||
src={project.searchEngine.thumbnail.url}
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
alt={project.title}
|
||||
class="rounded-2xl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div set:html={markdownToHtml(project.content)} class={`${getTypographyClasses()} min-w-full`}></div>
|
||||
</div>
|
||||
</div>
|
||||
34
astro/src/components/web/Contact.astro
Normal file
34
astro/src/components/web/Contact.astro
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
contact: ContactComponent;
|
||||
}
|
||||
|
||||
const contact = Astro.props.contact;
|
||||
---
|
||||
|
||||
<div
|
||||
id={`contact-${contact.id}`}
|
||||
class="flex lg:flex-row flex-col lg:justify-center justify-center items-center py-12 px-12 lg:container mx-auto gap-y-8 lg:gap-x-28 gap-x-18 lg:text-left text-center"
|
||||
>
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<h2 class="text-5xl font-bold">{contact.title}</h2>
|
||||
<div set:html={markdownToHtml(contact.text)}></div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
{ contact.methods.map((method) => (
|
||||
<a href={method.url} target="_blank" style={{ "--sc": method.color }} class="flex flex-row items-center gap-2 text-lg hover:text-(--sc) duration-200">
|
||||
<Image
|
||||
src={method.icon.url}
|
||||
alt={method.title}
|
||||
width="30"
|
||||
height="30"
|
||||
/>
|
||||
<span>{method.title}</span>
|
||||
</a>
|
||||
)) }
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import { markdownToHtml } from '@/lib/markdown';
|
||||
import { Image } from 'astro:assets';
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
equipment: EquipmentTableComponent;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import { markdownToHtml } from '@/lib/markdown';
|
||||
import { QuestionList } from '@/components/web/subcomponents/QuestionList.tsx';
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { QuestionList } from "@/components/web/subcomponents/QuestionList.tsx";
|
||||
|
||||
interface Props {
|
||||
faq: FrequentlyAskedQuestionsComponent;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import { Image } from 'astro:assets';
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
hero: HeroComponent;
|
||||
|
||||
95
astro/src/components/web/LastAlbums.astro
Normal file
95
astro/src/components/web/LastAlbums.astro
Normal file
@@ -0,0 +1,95 @@
|
||||
---
|
||||
import { getLastAlbums } from "@/content/photos/albums";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getAlbumRoute } from "@/lib/routing";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
albums: LastGalleriesComponent;
|
||||
}
|
||||
|
||||
function calculateSizeClasses(amount: number, length: number) {
|
||||
if (amount === 2 || length <= 2) {
|
||||
return "lg:w-[45%] w-full";
|
||||
}
|
||||
else {
|
||||
return "lg:w-[31%] w-full";
|
||||
}
|
||||
}
|
||||
|
||||
const albums = Astro.props.albums;
|
||||
const settings = await getSettings();
|
||||
const lastAlbums = await getLastAlbums(albums.amount);
|
||||
const size = calculateSizeClasses(albums.amount, lastAlbums.length);
|
||||
---
|
||||
|
||||
{ (settings.photo.enabled && lastAlbums.length > 0) && (
|
||||
<div
|
||||
id={`lastalbums-${albums.id}`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-8 gap-x-18 w-full"
|
||||
>
|
||||
<div class="flex flex-row justify-between items-center w-full">
|
||||
<h2 class="text-4xl font-bold">{albums.title}</h2>
|
||||
<div>
|
||||
<a
|
||||
href={settings.photo.categoryIndex.indexRouteTemplate}
|
||||
class="text-(--ptt) bg-(--ptc) hover:text-(--stt) hover:bg-(--stc) duration-200 py-3 px-5 rounded-full text-lg"
|
||||
>
|
||||
{albums.readMoreButtonText}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{ lastAlbums.length >= 4 ? (
|
||||
<div class="grid lg:grid-cols-2 lg:grid-rows-2 grid-cols-1 grid-rows-4 gap-x-10 gap-y-8">
|
||||
{ lastAlbums.map((album) => {
|
||||
const imageSize = getImageSize(album.thumbnail.width, album.thumbnail.height, 0.5);
|
||||
|
||||
return (
|
||||
<a href={getAlbumRoute(settings.photo, album)} class={`w-full flex flex-col gap-2`}>
|
||||
<Image
|
||||
src={getImageUrl(album.thumbnail.url)}
|
||||
alt={album.title}
|
||||
class="flex rounded-2xl shadow-md w-full"
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
/>
|
||||
<h4 class="font-semibold text-[28px]">{album.title}</h4>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
<CalendarIcon width={20} height={20} />
|
||||
<div>{album.startDate}</div>
|
||||
</div>
|
||||
</a>
|
||||
)
|
||||
}) }
|
||||
</div>
|
||||
|
||||
) : (
|
||||
<div class="flex flex-col lg:flex-row lg:justify-between gap-y-6">
|
||||
{ lastAlbums.map((album) => {
|
||||
const imageSize = getImageSize(album.thumbnail.width, album.thumbnail.height, 0.5);
|
||||
|
||||
return (
|
||||
<a href={getAlbumRoute(settings.photo, album)} class={`${size} flex flex-col gap-2`}>
|
||||
<Image
|
||||
src={getImageUrl(album.thumbnail.url)}
|
||||
alt={album.title}
|
||||
class="flex rounded-2xl shadow-md w-full"
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
/>
|
||||
<h4 class="font-semibold text-[28px]">{album.title}</h4>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
<CalendarIcon width={20} height={20} />
|
||||
<div>{album.startDate}</div>
|
||||
</div>
|
||||
</a>
|
||||
)
|
||||
|
||||
}) }
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
) }
|
||||
@@ -1,11 +1,10 @@
|
||||
---
|
||||
import { getLastBlogs } from '@/content/blogs/blogs';
|
||||
import { getSettings } from '@/content/settings/settings';
|
||||
import CalendarIcon from '@/icons/CalendarIcon.astro';
|
||||
import { getImageUrl } from '@/lib/images';
|
||||
import { getBlogRoute } from '@/lib/routing';
|
||||
import type { ACTION_ERROR_CODES } from 'astro:actions';
|
||||
import { Image } from 'astro:assets';
|
||||
import { getLastBlogs } from "@/content/blogs/blogs";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getBlogRoute } from "@/lib/routing";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
blogs: LastBlogsComponent;
|
||||
@@ -26,7 +25,7 @@ const lastBlogs = await getLastBlogs(blogs.amount);
|
||||
const size = calculateSizeClasses(blogs.amount, lastBlogs.length);
|
||||
---
|
||||
|
||||
{ settings.blog.enabled && (
|
||||
{ (settings.blog.enabled && lastBlogs.length > 0) && (
|
||||
<div
|
||||
id={`lastblogs-${blogs.id}`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-8 gap-x-18 w-full"
|
||||
@@ -36,7 +35,7 @@ const size = calculateSizeClasses(blogs.amount, lastBlogs.length);
|
||||
<div>
|
||||
<a
|
||||
href={settings.blog.indexRouteTemplate}
|
||||
class="text-(--ptt) bg-(--ptc) hover:text-(--stt) hover:bg-(--stc) duration-200 py-3 px-4 rounded-full"
|
||||
class="text-(--ptt) bg-(--ptc) hover:text-(--stt) hover:bg-(--stc) duration-200 py-3 px-5 rounded-full text-lg"
|
||||
>
|
||||
{blogs.readMoreButtonText}
|
||||
</a>
|
||||
@@ -44,14 +43,17 @@ const size = calculateSizeClasses(blogs.amount, lastBlogs.length);
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col lg:flex-row lg:justify-between gap-y-6">
|
||||
{ lastBlogs.map((blog) => (
|
||||
{ lastBlogs.map((blog) => {
|
||||
const imageSize = getImageSize(blog.searchEngine.thumbnail.width, blog.searchEngine.thumbnail.height, 0.5);
|
||||
|
||||
return (
|
||||
<a href={getBlogRoute(settings.blog, blog)} class={`${size} flex flex-col gap-2`}>
|
||||
<Image
|
||||
src={getImageUrl(blog.searchEngine.thumbnail.url)}
|
||||
alt={blog.title}
|
||||
class="flex rounded-2xl shadow-md"
|
||||
width={600}
|
||||
height={315}
|
||||
class="flex rounded-2xl shadow-md w-full"
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
/>
|
||||
<h4 class="font-semibold text-[28px]">{blog.title}</h4>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
@@ -59,7 +61,8 @@ const size = calculateSizeClasses(blogs.amount, lastBlogs.length);
|
||||
<div>{blog.date}</div>
|
||||
</div>
|
||||
</a>
|
||||
)) }
|
||||
)
|
||||
}) }
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
import { getLastProjects } from '@/content/projects/projects';
|
||||
import { getSettings } from '@/content/settings/settings';
|
||||
import CalendarIcon from '@/icons/CalendarIcon.astro';
|
||||
import { getImageUrl } from '@/lib/images';
|
||||
import { getProjectRoute } from '@/lib/routing';
|
||||
import { Image } from 'astro:assets';
|
||||
import { getLastProjects } from "@/content/projects/projects";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getProjectRoute } from "@/lib/routing";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
projects: LastProjectsComponent;
|
||||
@@ -23,11 +23,9 @@ const projects = Astro.props.projects;
|
||||
const settings = await getSettings();
|
||||
const lastProjects = await getLastProjects(projects.amount);
|
||||
const size = calculateSizeClasses(projects.amount, lastProjects.length);
|
||||
|
||||
console.log(lastProjects[0].searchEngine);
|
||||
---
|
||||
|
||||
{ settings.project.enabled && (
|
||||
{ (settings.project.enabled && lastProjects.length > 0) && (
|
||||
<div
|
||||
id={`lastprojects-${projects.id}`}
|
||||
class="flex lg:flex-col flex-col py-12 px-12 lg:container mx-auto gap-y-8 gap-x-18 w-full"
|
||||
@@ -37,7 +35,7 @@ console.log(lastProjects[0].searchEngine);
|
||||
<div>
|
||||
<a
|
||||
href={settings.project.indexRouteTemplate}
|
||||
class="text-(--ptt) bg-(--ptc) hover:text-(--stt) hover:bg-(--stc) duration-200 py-3 px-4 rounded-full"
|
||||
class="text-(--ptt) bg-(--ptc) hover:text-(--stt) hover:bg-(--stc) duration-200 py-3 px-5 rounded-full text-lg"
|
||||
>
|
||||
{projects.readMoreButtonText}
|
||||
</a>
|
||||
@@ -45,14 +43,17 @@ console.log(lastProjects[0].searchEngine);
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col lg:flex-row lg:justify-between gap-y-6">
|
||||
{ lastProjects.map((project) => (
|
||||
{ lastProjects.map((project) => {
|
||||
const imageSize = getImageSize(project.searchEngine.thumbnail.width, project.searchEngine.thumbnail.height, 0.5);
|
||||
|
||||
return (
|
||||
<a href={getProjectRoute(settings.project, project)} class={`${size} flex flex-col gap-2`}>
|
||||
<Image
|
||||
src={getImageUrl(project.searchEngine.thumbnail.url)}
|
||||
alt={project.title}
|
||||
class="flex rounded-2xl shadow-md"
|
||||
width={600}
|
||||
height={315}
|
||||
class="flex rounded-2xl shadow-md w-full"
|
||||
width={imageSize.width}
|
||||
height={imageSize.height}
|
||||
/>
|
||||
<h4 class="font-semibold text-[28px]">{project.title}</h4>
|
||||
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
|
||||
@@ -60,8 +61,8 @@ console.log(lastProjects[0].searchEngine);
|
||||
<div>{project.date}</div>
|
||||
</div>
|
||||
</a>
|
||||
)) }
|
||||
)
|
||||
}) }
|
||||
</div>
|
||||
</div>
|
||||
) }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import { markdownToHtml } from '@/lib/markdown';
|
||||
import StarRating from './subcomponents/StarRating.astro';
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import StarRating from "./subcomponents/StarRating.astro";
|
||||
|
||||
interface Props {
|
||||
reviews: ReviewListComponent;
|
||||
@@ -37,7 +37,7 @@ const reviewsToShow = reviews.reviews.slice(0, 5);
|
||||
|
||||
<div class="flex flex-col gap-6.5">
|
||||
{ reviewsToShow.map((review) => (
|
||||
<div class="flex flex-col justify-center gap-3 bg-neutral-50 py-4 px-5.5 rounded-2xl shadow-sm">
|
||||
<div class="flex flex-col justify-center gap-3 bg-neutral-100 py-4 px-5.5 rounded-2xl shadow-sm">
|
||||
<div class="flex flex-col justify-center gap-1.25">
|
||||
<h4 class="text-2xl font-semibold">{review.name}</h4>
|
||||
<div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
import { markdownToHtml } from '@/lib/markdown';
|
||||
import { Image } from 'astro:assets';
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
import { Image } from "astro:assets";
|
||||
|
||||
interface Props {
|
||||
textWithImage: TextWithImageComponent;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
import CalendarIcon from '@/icons/CalendarIcon.astro';
|
||||
import { Image } from 'astro:assets';
|
||||
import { upcomingEvent as UpcomingEvent } from './subcomponents/UpcomingEvent';
|
||||
import { markdownToHtml } from '@/lib/markdown';
|
||||
import CalendarIcon from "@/icons/CalendarIcon.astro";
|
||||
import { Image } from "astro:assets";
|
||||
import { upcomingEvent as UpcomingEvent } from "./subcomponents/UpcomingEvent";
|
||||
import { markdownToHtml } from "@/lib/markdown";
|
||||
|
||||
interface Props {
|
||||
upcomingEvents: UpcomingEventsComponent;
|
||||
|
||||
@@ -8,21 +8,24 @@ export function QuestionList(props: { questions: FrequentlyAskedQuestion[]; }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<div class="w-full">
|
||||
<div className="w-full">
|
||||
{props.questions.map((question, index: number) => (
|
||||
<div
|
||||
onClick={() => toggle(index)}
|
||||
key={index}
|
||||
className={`w-full overflow-hidden border-l border-r border-t ${open === index && "bg-amber-200"} ${index !== 0 && (index + 1 !== props.questions.length) && "border-amber-300"} ${index === 0 && "rounded-t-2xl border-t border-amber-300"} ${(index + 1) === props.questions.length && "rounded-b-2xl border-b border-amber-300 shadow-md"}`}
|
||||
onClick={() => toggle(index)}
|
||||
className={`w-full overflow-hidden border-l border-r border-t cursor-pointer ${open === index ? "bg-(--ptc) text-(--ptt)" : "bg-white"} ${index === 0 ? "rounded-t-2xl border-t border-(--ptc)" : ""} ${(index + 1) === props.questions.length ? "rounded-b-2xl border-b border-(--ptc) shadow-md" : "border-(--ptc)"}`}
|
||||
>
|
||||
<h4 class={`text-lg font-semibold transition py-3 px-5 select-none cursor-pointer`}>{ question.question }</h4>
|
||||
<h4 className="text-lg font-semibold py-3 px-5 select-none">
|
||||
{question.question}
|
||||
</h4>
|
||||
|
||||
<div
|
||||
className={`grid transition-all duration-300 ease-in-out ${
|
||||
className={`grid transition-[grid-template-rows,opacity] duration-300 ease-in-out ${
|
||||
open === index ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
||||
}`}
|
||||
>
|
||||
<div className="overflow-hidden">
|
||||
<div className="px-5 py-3 bg-white text-sm text-gray-700">
|
||||
<div className="px-5 pb-5 text-sm text-gray-700">
|
||||
{question.answer}
|
||||
</div>
|
||||
</div>
|
||||
@@ -30,5 +33,5 @@ export function QuestionList(props: { questions: FrequentlyAskedQuestion[]; }) {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
---
|
||||
import FrequentlyAskedQuestions from '../web/FrequentlyAskedQuestions.astro';
|
||||
import Hero from '../web/Hero.astro';
|
||||
import TextWithImage from '../web/TextWithImage.astro';
|
||||
import UpcomingEvents from '../web/UpcomingEvents.astro';
|
||||
import WallOfText from '../web/WallOfText.astro';
|
||||
import EquipmentTable from '../web/EquipmentTable.astro';
|
||||
import Reviews from '../web/Reviews.astro';
|
||||
import LastBlogs from '../web/LastBlogs.astro';
|
||||
import LastProjects from '../web/LastProjects.astro';
|
||||
import FrequentlyAskedQuestions from '@/components/web/FrequentlyAskedQuestions.astro';
|
||||
import Hero from '@/components/web/Hero.astro';
|
||||
import TextWithImage from '@/components/web/TextWithImage.astro';
|
||||
import UpcomingEvents from '@/components/web/UpcomingEvents.astro';
|
||||
import WallOfText from '@/components/web/WallOfText.astro';
|
||||
import EquipmentTable from '@/components/web/EquipmentTable.astro';
|
||||
import Reviews from '@/components/web/Reviews.astro';
|
||||
import LastBlogs from '@/components/web/LastBlogs.astro';
|
||||
import LastProjects from '@/components/web/LastProjects.astro';
|
||||
import LastAlbums from '@/components/web/LastAlbums.astro';
|
||||
import Contact from '@/components/web/Contact.astro';
|
||||
|
||||
interface Props {
|
||||
webpage: WebpageComponent[];
|
||||
}
|
||||
|
||||
const components = Astro.props.webpage;
|
||||
|
||||
console.log(Astro.props.webpage);
|
||||
---
|
||||
|
||||
<div class="flex flex-col">
|
||||
@@ -28,8 +28,10 @@ console.log(Astro.props.webpage);
|
||||
{ component.component === "FrequentlyAskedQuestions" && <FrequentlyAskedQuestions faq={component} /> }
|
||||
{ component.component === "EquipmentTable" && <EquipmentTable equipment={component} /> }
|
||||
{ component.component === "Reviews" && <Reviews reviews={component} /> }
|
||||
{ component.component === "Contact" && <Contact contact={component} /> }
|
||||
{ component.component === "LastBlogs" && <LastBlogs blogs={component} /> }
|
||||
{ component.component === "LastProjects" && <LastProjects projects={component} /> }
|
||||
{ component.component === "LastGalleries" && <LastAlbums albums={component} /> }
|
||||
</Fragment>
|
||||
)) }
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from 'graphql';
|
||||
import getBlogs from '@/graphql/blogs/getBlogs.graphql';
|
||||
import getBlogPost from '@/graphql/blogs/getBlog.graphql';
|
||||
import getLastBlogPosts from '@/graphql/blogs/getLastBlogPosts.graphql';
|
||||
import { print } from "graphql";
|
||||
import getBlogs from "@/graphql/blogs/getBlogs.graphql";
|
||||
import getBlogPost from "@/graphql/blogs/getBlog.graphql";
|
||||
import getLastBlogPosts from "@/graphql/blogs/getLastBlogPosts.graphql";
|
||||
import getPaginatedBlogs from "@/graphql/blogs/getPaginatedBlogs.graphql";
|
||||
import { formatDate } from "@/lib/dates";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getImage } from "astro:assets";
|
||||
|
||||
export async function getAllBlogs(settings: GlobalSettings): Promise<BlogPost[]> {
|
||||
const client = await createDirectusConnection();
|
||||
@@ -24,6 +27,9 @@ export async function getAllBlogs(settings: GlobalSettings): Promise<BlogPost[]>
|
||||
blogRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const blogThumbnailImage =
|
||||
getImageSize(blogRecord["search_engine"][0]["thumbnail"]["width"], blogRecord["search_engine"][0]["thumbnail"]["height"], 0.756);
|
||||
|
||||
const blog: BlogPost = {
|
||||
exists: true,
|
||||
type: "BlogPost",
|
||||
@@ -33,6 +39,11 @@ export async function getAllBlogs(settings: GlobalSettings): Promise<BlogPost[]>
|
||||
content: blogRecord["content"],
|
||||
date: blogRecord["date"],
|
||||
url: blogRecord["url"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: blogRecord["search_engine"][0]["title"],
|
||||
description: blogRecord["search_engine"][0]["description"],
|
||||
@@ -41,8 +52,8 @@ export async function getAllBlogs(settings: GlobalSettings): Promise<BlogPost[]>
|
||||
priority: blogRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"]
|
||||
width: blogThumbnailImage.width,
|
||||
height: blogThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
@@ -94,6 +105,16 @@ export async function getBlog(settings: GlobalSettings, route: string): Promise<
|
||||
blogRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const blogThumbnailImage = getImageSize(blogRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
blogRecord["search_engine"][0]["thumbnail"]["height"], 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: getImageUrl(blogRecord["search_engine"][0]["thumbnail"]["filename_disk"]),
|
||||
width: blogThumbnailImage.width,
|
||||
height: blogThumbnailImage.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
|
||||
const blog: BlogPost = {
|
||||
exists: true,
|
||||
type: "BlogPost",
|
||||
@@ -103,6 +124,11 @@ export async function getBlog(settings: GlobalSettings, route: string): Promise<
|
||||
content: blogRecord["content"],
|
||||
date: blogRecord["date"],
|
||||
url: blogRecord["url"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: blogRecord["search_engine"][0]["title"],
|
||||
description: blogRecord["search_engine"][0]["description"],
|
||||
@@ -110,9 +136,9 @@ export async function getBlog(settings: GlobalSettings, route: string): Promise<
|
||||
canonical: blogRecord["search_engine"][0]["canonical"],
|
||||
priority: blogRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"]
|
||||
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||
width: blogThumbnailImage.width,
|
||||
height: blogThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
@@ -161,6 +187,9 @@ export async function getLastBlogs(amount: number): Promise<BlogPost[]> {
|
||||
blogRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const blogThumbnailImage =
|
||||
getImageSize(blogRecord["search_engine"][0]["thumbnail"]["width"], blogRecord["search_engine"][0]["thumbnail"]["height"], 0.756);
|
||||
|
||||
const blog: BlogPost = {
|
||||
exists: true,
|
||||
type: "BlogPost",
|
||||
@@ -170,6 +199,11 @@ export async function getLastBlogs(amount: number): Promise<BlogPost[]> {
|
||||
content: blogRecord["content"],
|
||||
date: blogRecord["date"],
|
||||
url: blogRecord["url"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: blogRecord["search_engine"][0]["title"],
|
||||
description: blogRecord["search_engine"][0]["description"],
|
||||
@@ -178,8 +212,89 @@ export async function getLastBlogs(amount: number): Promise<BlogPost[]> {
|
||||
priority: blogRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"]
|
||||
width: blogThumbnailImage.width,
|
||||
height: blogThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
};
|
||||
|
||||
blogRecord["tags"].forEach((tagRecord: any) => {
|
||||
blog["tags"].push({
|
||||
text: tagRecord["Tags_id"]["text"],
|
||||
code: tagRecord["Tags_id"]["code"],
|
||||
color: tagRecord["Tags_id"]["color"]
|
||||
});
|
||||
|
||||
dates.push(tagRecord["Tags_id"]["date_created"]);
|
||||
dates.push(tagRecord["Tags_id"]["date_updated"]);
|
||||
});
|
||||
|
||||
if (dates.filter(e => e !== null).length === 0) {
|
||||
blog.lastModified = new Date();
|
||||
}
|
||||
else {
|
||||
const sortedDates: string[] = dates.sort((a: string, b: string) => {
|
||||
return new Date(b).getTime() - new Date(a).getTime();
|
||||
});
|
||||
|
||||
blog.lastModified = new Date(sortedDates[0]);
|
||||
}
|
||||
|
||||
blogs.push(blog);
|
||||
});
|
||||
|
||||
return blogs;
|
||||
}
|
||||
|
||||
export async function getAllPaginatedBlogs(settings: GlobalSettings, page: number): Promise<BlogPost[]> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getPaginatedBlogs), {
|
||||
date: formatDate(new Date(), "%Y-%M-%D"),
|
||||
limit: 8,
|
||||
pageNumber: page
|
||||
});
|
||||
|
||||
let blogs: BlogPost[] = [];
|
||||
|
||||
result["Blogs"].forEach((blogRecord: any) => {
|
||||
let dates: string[] = [
|
||||
settings.blog.lastModified.toISOString(),
|
||||
settings.website.lastModified.toISOString(),
|
||||
blogRecord["date_created"],
|
||||
blogRecord["date_updated"],
|
||||
blogRecord["search_engine"][0]["date_created"],
|
||||
blogRecord["search_engine"][0]["date_updated"],
|
||||
blogRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const blogThumbnailImage =
|
||||
getImageSize(blogRecord["search_engine"][0]["thumbnail"]["width"], blogRecord["search_engine"][0]["thumbnail"]["height"], 0.756);
|
||||
|
||||
const blog: BlogPost = {
|
||||
exists: true,
|
||||
type: "BlogPost",
|
||||
id: blogRecord["id"],
|
||||
lastModified: new Date(),
|
||||
title: blogRecord["title"],
|
||||
content: blogRecord["content"],
|
||||
date: blogRecord["date"],
|
||||
url: blogRecord["url"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: blogRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: blogRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: blogRecord["search_engine"][0]["title"],
|
||||
description: blogRecord["search_engine"][0]["description"],
|
||||
allowCrawlers: blogRecord["search_engine"][0]["allow_crawler"],
|
||||
canonical: blogRecord["search_engine"][0]["canonical"],
|
||||
priority: blogRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: blogRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: blogThumbnailImage.width,
|
||||
height: blogThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
|
||||
110
astro/src/content/footer/footer.ts
Normal file
110
astro/src/content/footer/footer.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import type { Footer, FooterColumn, FooterSecondaryLink, FooterSocial } from "@/types/footers/footer";
|
||||
import getFooterQuery from "@/graphql/footer/getFooter.graphql";
|
||||
import { getImageUrl } from "@/lib/images";
|
||||
|
||||
export async function getFooter(): Promise<Footer> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getFooterQuery));
|
||||
|
||||
const footerRecord = result["Footer"];
|
||||
|
||||
let dates: string[] = [
|
||||
footerRecord["date_created"],
|
||||
footerRecord["date_updated"]
|
||||
];
|
||||
|
||||
let footer: Footer = {
|
||||
id: footerRecord["id"],
|
||||
title: footerRecord["title"],
|
||||
logo: {
|
||||
url: getImageUrl(footerRecord["logo"]["filename_disk"]),
|
||||
width: footerRecord["logo"]["width"],
|
||||
height: footerRecord["logo"]["height"]
|
||||
},
|
||||
copyright: footerRecord["copyright"],
|
||||
columns: [],
|
||||
socials: null,
|
||||
secondaryLinks: null,
|
||||
lastModified: new Date()
|
||||
};
|
||||
|
||||
if (footerRecord["columns"] !== null) {
|
||||
footerRecord["columns"].forEach((footerColumn: any) => {
|
||||
const column: FooterColumn = {
|
||||
id: footerColumn["id"],
|
||||
title: footerColumn["title"],
|
||||
links: []
|
||||
};
|
||||
|
||||
footerColumn["links"].forEach((columnLink: any) => {
|
||||
column.links.push({
|
||||
id: columnLink["id"],
|
||||
text: columnLink["text"],
|
||||
url: columnLink["url"]
|
||||
});
|
||||
|
||||
dates.push(columnLink["date_created"]);
|
||||
dates.push(columnLink["date_updated"]);
|
||||
});
|
||||
|
||||
footer.columns.push(column);
|
||||
|
||||
dates.push(footerColumn["date_created"]);
|
||||
dates.push(footerColumn["date_updated"]);
|
||||
});
|
||||
}
|
||||
|
||||
if (footerRecord["socials"] !== null) {
|
||||
let socials: FooterSocial[] = [];
|
||||
|
||||
footerRecord["socials"].forEach((footerSocial: any) => {
|
||||
socials.push({
|
||||
id: footerSocial["id"],
|
||||
name: footerSocial["name"],
|
||||
url: footerSocial["url"],
|
||||
icon: {
|
||||
url: getImageUrl(footerSocial["icon"]["filename_disk"]),
|
||||
width: footerSocial["icon"]["width"],
|
||||
height: footerSocial["icon"]["height"]
|
||||
}
|
||||
});
|
||||
|
||||
dates.push(footerSocial["date_created"]);
|
||||
dates.push(footerSocial["date_updated"]);
|
||||
});
|
||||
|
||||
footer.socials = socials;
|
||||
}
|
||||
|
||||
if (footerRecord["secondary_links"] !== null) {
|
||||
let secondaryLinks: FooterSecondaryLink[] = [];
|
||||
|
||||
footerRecord["secondary_links"].forEach((footerSecondaryLink: any) => {
|
||||
secondaryLinks.push({
|
||||
id: footerSecondaryLink["id"],
|
||||
text: footerSecondaryLink["text"],
|
||||
url: footerSecondaryLink["url"]
|
||||
});
|
||||
|
||||
dates.push(footerSecondaryLink["date_created"]);
|
||||
dates.push(footerSecondaryLink["date_updated"]);
|
||||
});
|
||||
|
||||
footer.secondaryLinks = secondaryLinks;
|
||||
}
|
||||
|
||||
if (dates.filter(e => e !== null).length === 0) {
|
||||
footer.lastModified = new Date();
|
||||
}
|
||||
else {
|
||||
const sortedDates: string[] = dates.sort((a: string, b: string) => {
|
||||
return new Date(b).getTime() - new Date(a).getTime();
|
||||
});
|
||||
|
||||
footer.lastModified = new Date(sortedDates[0]);
|
||||
}
|
||||
|
||||
return footer;
|
||||
}
|
||||
39
astro/src/content/menu/menu.ts
Normal file
39
astro/src/content/menu/menu.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import getMenuQuery from "@/graphql/menu/getMenu.graphql";
|
||||
|
||||
export async function getMenu(): Promise<Menu> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getMenuQuery));
|
||||
|
||||
const menuRecord = result["Menu"];
|
||||
|
||||
let menu: Menu = {
|
||||
id: menuRecord["id"],
|
||||
items: []
|
||||
};
|
||||
|
||||
menuRecord["items"].forEach((menuItem: any) => {
|
||||
if (menuItem["collection"] === "Menu_Column") {
|
||||
let menuColumnItem: MenuColumn = {
|
||||
id: menuItem["item"]["id"],
|
||||
type: "Column",
|
||||
title: menuItem["item"]["title"],
|
||||
links: []
|
||||
};
|
||||
|
||||
menuItem["item"]["links"].forEach((menuItemLink: any) => {
|
||||
menuColumnItem.links.push({
|
||||
id: menuItemLink["id"],
|
||||
type: "Link",
|
||||
text: menuItemLink["text"],
|
||||
url: menuItemLink["url"]
|
||||
});
|
||||
});
|
||||
|
||||
menu.items.push(menuColumnItem);
|
||||
}
|
||||
});
|
||||
|
||||
return menu;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from 'graphql';
|
||||
import { print } from "graphql";
|
||||
import { formatDate } from "@/lib/dates";
|
||||
import getAllPages from "@/graphql/pages/getAllPages.graphql";
|
||||
import getPage from "@/graphql/pages/getPage.graphql";
|
||||
import { getImageUrl } from "@/lib/images";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
|
||||
export function dataToPage(pageRecord: any): WebPage {
|
||||
let dates: string[] = [
|
||||
@@ -22,6 +22,9 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
|
||||
switch (componentRecord["item"]["__typename"]) {
|
||||
case "Hero":
|
||||
const resizedHeroImage =
|
||||
getImageSize(component["background_image"]["width"], component["background_image"]["height"], 2.5);
|
||||
|
||||
let heroComponent: HeroComponent = {
|
||||
component: "Hero",
|
||||
id: component["hero_id"],
|
||||
@@ -29,8 +32,8 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
text: component["hero_text"],
|
||||
backgroundImage: {
|
||||
url: getImageUrl(component["background_image"]["filename_disk"]),
|
||||
width: component["background_image"]["width"],
|
||||
height: component["background_image"]["height"]
|
||||
width: resizedHeroImage.width,
|
||||
height: resizedHeroImage.height
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,6 +44,9 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
|
||||
break;
|
||||
case "Text_With_Side_Image":
|
||||
const resizedTextWithSideImage =
|
||||
getImageSize(component["image"]["width"], component["image"]["height"], 1.5);
|
||||
|
||||
let textWithImageComponent: TextWithImageComponent = {
|
||||
component: "TextWithImage",
|
||||
id: component["twsi_id"],
|
||||
@@ -50,8 +56,8 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
imageSize: component["twsi_image_size"],
|
||||
image: {
|
||||
url: getImageUrl(component["image"]["filename_disk"]),
|
||||
width: component["image"]["width"],
|
||||
height: component["image"]["height"]
|
||||
width: resizedTextWithSideImage.width,
|
||||
height: resizedTextWithSideImage.height
|
||||
}
|
||||
};
|
||||
|
||||
@@ -109,6 +115,9 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
};
|
||||
|
||||
component["events"].forEach((eventRecord: any) => {
|
||||
const resizedThumbnailImage =
|
||||
getImageSize(eventRecord["thumbnail"]["width"], eventRecord["thumbnail"]["height"], 1);
|
||||
|
||||
upcomingEventsComponent.events.push({
|
||||
id: eventRecord["id"],
|
||||
title: eventRecord["title"],
|
||||
@@ -120,8 +129,8 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
],
|
||||
thumbnail: {
|
||||
url: getImageUrl(eventRecord["thumbnail"]["filename_disk"]),
|
||||
width: eventRecord["thumbnail"]["width"],
|
||||
height: eventRecord["thumbnail"]["height"]
|
||||
width: resizedThumbnailImage.width,
|
||||
height: resizedThumbnailImage.height
|
||||
},
|
||||
startDate: eventRecord["start_date"],
|
||||
endDate: eventRecord["end_date"]
|
||||
@@ -177,6 +186,9 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
};
|
||||
|
||||
component["reviews"].forEach((reviewRecord: any) => {
|
||||
const reviewThumbnailImage =
|
||||
getImageSize(reviewRecord["thumbnail"]["width"], reviewRecord["thumbnail"]["height"], 1);
|
||||
|
||||
reviewsComponent.reviews.push({
|
||||
id: reviewRecord["id"],
|
||||
name: reviewRecord["name"],
|
||||
@@ -185,8 +197,8 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
date: reviewRecord["date"],
|
||||
thumbnail: {
|
||||
url: getImageUrl(reviewRecord["thumbnail"]["filename_disk"]),
|
||||
width: reviewRecord["thumbnail"]["width"],
|
||||
height: reviewRecord["thumbnail"]["height"]
|
||||
width: reviewThumbnailImage.width,
|
||||
height: reviewThumbnailImage.height
|
||||
}
|
||||
});
|
||||
|
||||
@@ -213,7 +225,7 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
contactComponent.methods.push({
|
||||
id: contactMethodRecord["id"],
|
||||
title: contactMethodRecord["title"],
|
||||
text: contactMethodRecord["text"],
|
||||
url: contactMethodRecord["url"],
|
||||
color: contactMethodRecord["color"],
|
||||
icon: {
|
||||
url: getImageUrl(contactMethodRecord["icon"]["filename_disk"]),
|
||||
@@ -292,6 +304,9 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
lastModified = new Date(sortedDates[0]);
|
||||
}
|
||||
|
||||
const thumbnailImage =
|
||||
getImageSize(searchEngine["thumbnail"]["width"], searchEngine["thumbnail"]["width"], 0.756);
|
||||
|
||||
let page: WebPage = {
|
||||
type: "Webpage",
|
||||
exists: true,
|
||||
@@ -306,8 +321,8 @@ export function dataToPage(pageRecord: any): WebPage {
|
||||
priority: searchEngine["priority"],
|
||||
thumbnail: {
|
||||
url: getImageUrl(searchEngine["thumbnail"]["filename_disk"]),
|
||||
height: searchEngine["thumbnail"]["height"],
|
||||
width: searchEngine["thumbnail"]["width"]
|
||||
height: thumbnailImage.height,
|
||||
width: thumbnailImage.width
|
||||
}
|
||||
},
|
||||
components: components
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import getAlbums from '@/graphql/photos/getAlbums.graphql';
|
||||
import getAlbumItem from '@/graphql/photos/getAlbum.graphql';
|
||||
import getAlbums from "@/graphql/photos/getAlbums.graphql";
|
||||
import getAlbumItem from "@/graphql/photos/getAlbum.graphql";
|
||||
import getLastAlbumsQuery from "@/graphql/photos/getLastAlbums.graphql";
|
||||
import getCategoryAlbumQuery from "@/graphql/photos/getCategoryAlbum.graphql";
|
||||
import { formatDate } from "@/lib/dates";
|
||||
import { getImageSize } from "@/lib/images";
|
||||
|
||||
export async function getAllAlbums(settings: GlobalSettings): Promise<PhotoAlbum[]> {
|
||||
const client = await createDirectusConnection();
|
||||
@@ -21,8 +24,16 @@ export async function getAllAlbums(settings: GlobalSettings): Promise<PhotoAlbum
|
||||
albumRecord["thumbnail"]["created_on"],
|
||||
];
|
||||
|
||||
const categoryThumbnailImage =
|
||||
getImageSize(albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["width"], albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["height"], 1.5);
|
||||
|
||||
const thumbnailImage =
|
||||
getImageSize(albumRecord["thumbnail"]["width"], albumRecord["thumbnail"]["height"], 0.756);
|
||||
|
||||
const album: PhotoAlbum = {
|
||||
exists: true,
|
||||
type: "PhotoAlbum",
|
||||
id: albumRecord["id"],
|
||||
title: albumRecord["title"],
|
||||
description: albumRecord["description"],
|
||||
url: albumRecord["url"],
|
||||
@@ -35,14 +46,14 @@ export async function getAllAlbums(settings: GlobalSettings): Promise<PhotoAlbum
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["url"],
|
||||
thumbnail: {
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["filename_disk"],
|
||||
height: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["height"],
|
||||
width: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["width"]
|
||||
width: categoryThumbnailImage.width,
|
||||
height: categoryThumbnailImage.height
|
||||
}
|
||||
},
|
||||
thumbnail: {
|
||||
url: albumRecord["thumbnail"]["filename_download"],
|
||||
height: albumRecord["thumbnail"]["height"],
|
||||
width: albumRecord["thumbnail"]["width"]
|
||||
url: albumRecord["thumbnail"]["filename_disk"],
|
||||
width: thumbnailImage.width,
|
||||
height: thumbnailImage.height
|
||||
},
|
||||
photos: [],
|
||||
lastModified: new Date()
|
||||
@@ -97,8 +108,16 @@ export async function getAlbum(settings: GlobalSettings, route: string): Promise
|
||||
albumRecord["thumbnail"]["created_on"],
|
||||
];
|
||||
|
||||
const categoryThumbnailImage =
|
||||
getImageSize(albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["width"], albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["height"], 1.5);
|
||||
|
||||
const thumbnailImage =
|
||||
getImageSize(albumRecord["thumbnail"]["width"], albumRecord["thumbnail"]["height"], 0.756);
|
||||
|
||||
const album: PhotoAlbum = {
|
||||
exists: true,
|
||||
type: "PhotoAlbum",
|
||||
id: albumRecord["id"],
|
||||
title: albumRecord["title"],
|
||||
description: albumRecord["description"],
|
||||
url: albumRecord["url"],
|
||||
@@ -111,14 +130,14 @@ export async function getAlbum(settings: GlobalSettings, route: string): Promise
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["url"],
|
||||
thumbnail: {
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["filename_disk"],
|
||||
height: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["height"],
|
||||
width: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["width"]
|
||||
width: categoryThumbnailImage.width,
|
||||
height: categoryThumbnailImage.height
|
||||
}
|
||||
},
|
||||
thumbnail: {
|
||||
url: albumRecord["thumbnail"]["filename_download"],
|
||||
height: albumRecord["thumbnail"]["height"],
|
||||
width: albumRecord["thumbnail"]["width"]
|
||||
url: albumRecord["thumbnail"]["filename_disk"],
|
||||
width: thumbnailImage.width,
|
||||
height: thumbnailImage.height
|
||||
},
|
||||
photos: [],
|
||||
lastModified: new Date()
|
||||
@@ -153,3 +172,176 @@ export async function getAlbum(settings: GlobalSettings, route: string): Promise
|
||||
|
||||
return album;
|
||||
}
|
||||
|
||||
export async function getLastAlbums(amount: number) {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getLastAlbumsQuery), {
|
||||
date: formatDate(new Date(), "%Y-%M-%D"),
|
||||
limit: amount
|
||||
});
|
||||
|
||||
let albums: PhotoAlbum[] = [];
|
||||
|
||||
result["Photo_Albums"].forEach((albumRecord: any) => {
|
||||
let dates: string[] = [
|
||||
albumRecord["date_created"],
|
||||
albumRecord["date_updated"],
|
||||
albumRecord["thumbnail"]["created_on"],
|
||||
];
|
||||
|
||||
const categoryThumbnailImage =
|
||||
getImageSize(albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["width"], albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["height"], 1.5);
|
||||
|
||||
const thumbnailImage =
|
||||
getImageSize(albumRecord["thumbnail"]["width"], albumRecord["thumbnail"]["height"], 0.756);
|
||||
|
||||
const album: PhotoAlbum = {
|
||||
exists: true,
|
||||
type: "PhotoAlbum",
|
||||
id: albumRecord["id"],
|
||||
title: albumRecord["title"],
|
||||
description: albumRecord["description"],
|
||||
url: albumRecord["url"],
|
||||
startDate: albumRecord["start_date"],
|
||||
endDate: albumRecord["end_date"],
|
||||
location: albumRecord["location"],
|
||||
category: {
|
||||
id: albumRecord["category"][0]["Photo_Categories_id"]["id"],
|
||||
title: albumRecord["category"][0]["Photo_Categories_id"]["title"],
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["url"],
|
||||
thumbnail: {
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["filename_disk"],
|
||||
width: categoryThumbnailImage.width,
|
||||
height: categoryThumbnailImage.height
|
||||
}
|
||||
},
|
||||
thumbnail: {
|
||||
url: albumRecord["thumbnail"]["filename_disk"],
|
||||
width: thumbnailImage.width,
|
||||
height: thumbnailImage.height
|
||||
},
|
||||
photos: [],
|
||||
lastModified: new Date()
|
||||
};
|
||||
|
||||
albumRecord["photos"].forEach((photoRecord: any) => {
|
||||
album.photos.push({
|
||||
id: photoRecord["id"],
|
||||
photo: {
|
||||
url: photoRecord["photo"]["filename_disk"],
|
||||
width: photoRecord["photo"]["width"],
|
||||
height: photoRecord["photo"]["height"]
|
||||
},
|
||||
text: photoRecord["text"]
|
||||
});
|
||||
|
||||
dates.push(photoRecord["date_created"]);
|
||||
dates.push(photoRecord["date_updated"]);
|
||||
dates.push(photoRecord["photo"]["created_on"]);
|
||||
});
|
||||
|
||||
if (dates.filter(e => e !== null).length === 0) {
|
||||
album.lastModified = new Date();
|
||||
}
|
||||
else {
|
||||
const sortedDates: string[] = dates.sort((a: string, b: string) => {
|
||||
return new Date(b).getTime() - new Date(a).getTime();
|
||||
});
|
||||
|
||||
album.lastModified = new Date(sortedDates[0]);
|
||||
}
|
||||
|
||||
albums.push(album);
|
||||
});
|
||||
|
||||
return albums;
|
||||
}
|
||||
|
||||
export async function getCategoryAlbums(settings: GlobalSettings, route: string): Promise<PhotoAlbum[]> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getCategoryAlbumQuery), {
|
||||
date: formatDate(new Date(), "%Y-%M-%D"),
|
||||
categoryUrl: route
|
||||
});
|
||||
|
||||
let albums: PhotoAlbum[] = [];
|
||||
|
||||
result["Photo_Albums"].forEach((albumRecord: any) => {
|
||||
let dates: string[] = [
|
||||
settings.website.lastModified.toISOString(),
|
||||
settings.photo.lastModified.toISOString(),
|
||||
albumRecord["date_created"],
|
||||
albumRecord["date_updated"],
|
||||
albumRecord["thumbnail"]["created_on"],
|
||||
];
|
||||
|
||||
const categoryThumbnailImage =
|
||||
getImageSize(albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["width"], albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["height"], 1.5);
|
||||
|
||||
const thumbnailImage =
|
||||
getImageSize(albumRecord["thumbnail"]["width"], albumRecord["thumbnail"]["height"], 0.756);
|
||||
|
||||
const album: PhotoAlbum = {
|
||||
exists: true,
|
||||
type: "PhotoAlbum",
|
||||
id: albumRecord["id"],
|
||||
title: albumRecord["title"],
|
||||
description: albumRecord["description"],
|
||||
url: albumRecord["url"],
|
||||
startDate: albumRecord["start_date"],
|
||||
endDate: albumRecord["end_date"],
|
||||
location: albumRecord["location"],
|
||||
category: {
|
||||
id: albumRecord["category"][0]["Photo_Categories_id"]["id"],
|
||||
title: albumRecord["category"][0]["Photo_Categories_id"]["title"],
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["url"],
|
||||
thumbnail: {
|
||||
url: albumRecord["category"][0]["Photo_Categories_id"]["thumbnail"]["filename_disk"],
|
||||
width: categoryThumbnailImage.width,
|
||||
height: categoryThumbnailImage.height
|
||||
}
|
||||
},
|
||||
thumbnail: {
|
||||
url: albumRecord["thumbnail"]["filename_disk"],
|
||||
width: thumbnailImage.width,
|
||||
height: thumbnailImage.height
|
||||
},
|
||||
photos: [],
|
||||
lastModified: new Date()
|
||||
};
|
||||
|
||||
albumRecord["photos"].forEach((photoRecord: any) => {
|
||||
const imageSize =
|
||||
getImageSize(photoRecord["photo"]["width"], photoRecord["photo"]["height"], 0.8);
|
||||
|
||||
album.photos.push({
|
||||
id: photoRecord["id"],
|
||||
photo: {
|
||||
url: photoRecord["photo"]["filename_disk"],
|
||||
width: photoRecord["photo"]["width"],
|
||||
height: photoRecord["photo"]["height"]
|
||||
},
|
||||
text: photoRecord["text"]
|
||||
});
|
||||
|
||||
dates.push(photoRecord["date_created"]);
|
||||
dates.push(photoRecord["date_updated"]);
|
||||
dates.push(photoRecord["photo"]["created_on"]);
|
||||
});
|
||||
|
||||
if (dates.filter(e => e !== null).length === 0) {
|
||||
album.lastModified = new Date();
|
||||
}
|
||||
else {
|
||||
const sortedDates: string[] = dates.sort((a: string, b: string) => {
|
||||
return new Date(b).getTime() - new Date(a).getTime();
|
||||
});
|
||||
|
||||
album.lastModified = new Date(sortedDates[0]);
|
||||
}
|
||||
|
||||
albums.push(album);
|
||||
});
|
||||
|
||||
return albums;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import getCategories from '@/graphql/photos/getCategories.graphql';
|
||||
import getCategories from "@/graphql/photos/getCategories.graphql";
|
||||
import getCategory from "@/graphql/photos/getCategory.graphql";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
|
||||
export async function getAllCategories(settings: GlobalSettings): Promise<PhotoAlbumCategory[]> {
|
||||
const client = await createDirectusConnection();
|
||||
@@ -9,17 +11,46 @@ export async function getAllCategories(settings: GlobalSettings): Promise<PhotoA
|
||||
let categories: PhotoAlbumCategory[] = [];
|
||||
|
||||
result["Photo_Categories"].forEach((photoCategoryRecord: any) => {
|
||||
const imageSize = getImageSize(photoCategoryRecord["thumbnail"]["width"],
|
||||
photoCategoryRecord["thumbnail"]["height"], 1.5);
|
||||
|
||||
categories.push({
|
||||
id: photoCategoryRecord["id"],
|
||||
title: photoCategoryRecord["title"],
|
||||
url: photoCategoryRecord["url"],
|
||||
thumbnail: {
|
||||
url: photoCategoryRecord["thumbnail"]["filename_disk"],
|
||||
width: photoCategoryRecord["thumbnail"]["width"],
|
||||
height: photoCategoryRecord["thumbnail"]["height"]
|
||||
url: getImageUrl(photoCategoryRecord["thumbnail"]["filename_disk"]),
|
||||
width: imageSize.width,
|
||||
height: imageSize.height
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
export async function getPhotoCategory(url: string): Promise<PhotoAlbumCategory> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getCategory), {
|
||||
url: url
|
||||
});
|
||||
|
||||
const item = result["Photo_Categories"][0];
|
||||
|
||||
const imageSize = getImageSize(item["thumbnail"]["width"],
|
||||
item["thumbnail"]["height"], 1.5);
|
||||
|
||||
let categories: PhotoAlbumCategory = {
|
||||
id: item["id"],
|
||||
title: item["title"],
|
||||
url: item["url"],
|
||||
thumbnail: {
|
||||
url: getImageUrl(item["thumbnail"]["filename_disk"]),
|
||||
width: imageSize.width,
|
||||
height: imageSize.height
|
||||
}
|
||||
};
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import getPhotos from '@/graphql/photos/getPhotos.graphql';
|
||||
import getPhotos from "@/graphql/photos/getPhotos.graphql";
|
||||
import md5 from "md5";
|
||||
|
||||
export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<PhotoAlbumPhoto | null> {
|
||||
export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<PhotoAlbumItem | null> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getPhotos), {
|
||||
albumUrl: albumUrl
|
||||
});
|
||||
|
||||
let object: PhotoAlbumPhoto | null = null;
|
||||
let object: PhotoAlbumItem | null = null;
|
||||
|
||||
result["Photo_Albums"][0]["photos"].forEach((photo: any) => {
|
||||
/*
|
||||
* I have decided to not put the getImageSize here, it can mess up the
|
||||
* hashing, or anything else. It seems smarter to do this in the photo"s and galleries.
|
||||
*/
|
||||
|
||||
const hashObject = md5(JSON.stringify({
|
||||
id: photo.id,
|
||||
url: photo.photo.filename_disk,
|
||||
@@ -24,9 +29,13 @@ export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<
|
||||
id: photo.id,
|
||||
text: photo.text,
|
||||
photo: {
|
||||
url: photo.photo.url,
|
||||
url: photo.photo.filename_disk,
|
||||
width: photo.photo.width,
|
||||
height: photo.photo.height
|
||||
},
|
||||
album: {
|
||||
url: result["Photo_Albums"][0].url,
|
||||
title: result["Photo_Albums"][0].title
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { formatDate } from "@/lib/dates";
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import getProjects from '@/graphql/projects/getProjects.graphql';
|
||||
import getProjectPost from '@/graphql/projects/getProject.graphql';
|
||||
import getLastProjectsQuery from '@/graphql/projects/getLastProjects.graphql';
|
||||
import getProjects from "@/graphql/projects/getProjects.graphql";
|
||||
import getProjectPost from "@/graphql/projects/getProject.graphql";
|
||||
import getLastProjectsQuery from "@/graphql/projects/getLastProjects.graphql";
|
||||
import { getImageSize, getImageUrl } from "@/lib/images";
|
||||
import { getImage } from "astro:assets";
|
||||
|
||||
export async function getAllProjects(settings: GlobalSettings): Promise<ProjectPost[]> {
|
||||
const client = await createDirectusConnection();
|
||||
@@ -24,14 +26,23 @@ export async function getAllProjects(settings: GlobalSettings): Promise<ProjectP
|
||||
projectRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const projectThumbnailImage = getImageSize(projectRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
projectRecord["search_engine"][0]["thumbnail"]["height"], 0.756);
|
||||
|
||||
const project: ProjectPost = {
|
||||
exists: true,
|
||||
type: "ProjectPost",
|
||||
lastModified: new Date(),
|
||||
id: projectRecord["id"],
|
||||
title: projectRecord["title"],
|
||||
content: projectRecord["content"],
|
||||
date: projectRecord["date"],
|
||||
url: projectRecord["url"],
|
||||
thumbnail: {
|
||||
url: getImageUrl(projectRecord["search_engine"][0]["thumbnail"]["filename_disk"]),
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: projectRecord["search_engine"][0]["title"],
|
||||
description: projectRecord["search_engine"][0]["description"],
|
||||
@@ -39,9 +50,9 @@ export async function getAllProjects(settings: GlobalSettings): Promise<ProjectP
|
||||
canonical: projectRecord["search_engine"][0]["canonical"],
|
||||
priority: projectRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"],
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"]
|
||||
url: getImageUrl(projectRecord["search_engine"][0]["thumbnail"]["filename_disk"]),
|
||||
width: projectThumbnailImage.width,
|
||||
height: projectThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
@@ -93,15 +104,31 @@ export async function getProject(settings: GlobalSettings, route: string): Promi
|
||||
projectRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const projectThumbnailImage = getImageSize(projectRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
projectRecord["search_engine"][0]["thumbnail"]["height"], 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: getImageUrl(projectRecord["search_engine"][0]["thumbnail"]["filename_disk"]),
|
||||
width: projectThumbnailImage.width,
|
||||
height: projectThumbnailImage.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
|
||||
const project: ProjectPost = {
|
||||
type: "ProjectPost",
|
||||
exists: true,
|
||||
|
||||
lastModified: new Date(),
|
||||
id: projectRecord["id"],
|
||||
title: projectRecord["title"],
|
||||
content: projectRecord["content"],
|
||||
date: projectRecord["date"],
|
||||
url: projectRecord["url"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: projectRecord["search_engine"][0]["title"],
|
||||
description: projectRecord["search_engine"][0]["description"],
|
||||
@@ -109,9 +136,9 @@ export async function getProject(settings: GlobalSettings, route: string): Promi
|
||||
canonical: projectRecord["search_engine"][0]["canonical"],
|
||||
priority: projectRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"],
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"]
|
||||
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||
width: projectThumbnailImage.width,
|
||||
height: projectThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
@@ -160,14 +187,23 @@ const client = await createDirectusConnection();
|
||||
projectRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const projectThumbnailImage =
|
||||
getImageSize(projectRecord["search_engine"][0]["thumbnail"]["width"], projectRecord["search_engine"][0]["thumbnail"]["height"], 0.756)
|
||||
|
||||
const project: ProjectPost = {
|
||||
exists: true,
|
||||
type: "ProjectPost",
|
||||
lastModified: new Date(),
|
||||
id: projectRecord["id"],
|
||||
title: projectRecord["title"],
|
||||
content: projectRecord["content"],
|
||||
date: projectRecord["date"],
|
||||
url: projectRecord["url"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: projectRecord["search_engine"][0]["title"],
|
||||
description: projectRecord["search_engine"][0]["description"],
|
||||
@@ -176,8 +212,89 @@ const client = await createDirectusConnection();
|
||||
priority: projectRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"],
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"]
|
||||
width: projectThumbnailImage.width,
|
||||
height: projectThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
};
|
||||
|
||||
projectRecord["tags"].forEach((tagRecord: any) => {
|
||||
project["tags"].push({
|
||||
text: tagRecord["Tags_id"]["text"],
|
||||
code: tagRecord["Tags_id"]["code"],
|
||||
color: tagRecord["Tags_id"]["color"]
|
||||
});
|
||||
|
||||
dates.push(tagRecord["Tags_id"]["date_created"]);
|
||||
dates.push(tagRecord["Tags_id"]["date_updated"]);
|
||||
});
|
||||
|
||||
if (dates.filter(e => e !== null).length === 0) {
|
||||
project.lastModified = new Date();
|
||||
}
|
||||
else {
|
||||
const sortedDates: string[] = dates.sort((a: string, b: string) => {
|
||||
return new Date(b).getTime() - new Date(a).getTime();
|
||||
});
|
||||
|
||||
project.lastModified = new Date(sortedDates[0]);
|
||||
}
|
||||
|
||||
projects.push(project);
|
||||
});
|
||||
|
||||
return projects;
|
||||
}
|
||||
|
||||
export async function getAllPaginatedProjects(settings: GlobalSettings, page: number): Promise<ProjectPost[]> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getProjects), {
|
||||
date: formatDate(new Date(), "%Y-%M-%D"),
|
||||
limit: 6,
|
||||
pageNumber: page
|
||||
});
|
||||
|
||||
let projects: ProjectPost[] = [];
|
||||
|
||||
result["Projects"].forEach((projectRecord: any) => {
|
||||
let dates: string[] = [
|
||||
settings.project.lastModified.toISOString(),
|
||||
settings.website.lastModified.toISOString(),
|
||||
projectRecord["date_created"],
|
||||
projectRecord["date_updated"],
|
||||
projectRecord["search_engine"][0]["date_created"],
|
||||
projectRecord["search_engine"][0]["date_updated"],
|
||||
projectRecord["search_engine"][0]["thumbnail"]["created_on"]
|
||||
];
|
||||
|
||||
const projectThumbnailImage =
|
||||
getImageSize(projectRecord["search_engine"][0]["thumbnail"]["width"], projectRecord["search_engine"][0]["thumbnail"]["height"], 0.756)
|
||||
|
||||
const project: ProjectPost = {
|
||||
exists: true,
|
||||
type: "ProjectPost",
|
||||
lastModified: new Date(),
|
||||
id: projectRecord["id"],
|
||||
title: projectRecord["title"],
|
||||
content: projectRecord["content"],
|
||||
date: projectRecord["date"],
|
||||
url: projectRecord["url"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: projectRecord["search_engine"][0]["thumbnail"]["width"],
|
||||
height: projectRecord["search_engine"][0]["thumbnail"]["height"]
|
||||
},
|
||||
searchEngine: {
|
||||
title: projectRecord["search_engine"][0]["title"],
|
||||
description: projectRecord["search_engine"][0]["description"],
|
||||
allowCrawlers: projectRecord["search_engine"][0]["allow_crawler"],
|
||||
canonical: projectRecord["search_engine"][0]["canonical"],
|
||||
priority: projectRecord["search_engine"][0]["priority"],
|
||||
thumbnail: {
|
||||
url: projectRecord["search_engine"][0]["thumbnail"]["filename_disk"],
|
||||
width: projectThumbnailImage.width,
|
||||
height: projectThumbnailImage.height
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from 'graphql';
|
||||
import getRobotsQuery from '@/graphql/settings/robots.graphql';
|
||||
import { print } from "graphql";
|
||||
import getRobotsQuery from "@/graphql/settings/robots.graphql";
|
||||
|
||||
export async function getRobotsSettings(): Promise<RobotsSettings> {
|
||||
const client = await createDirectusConnection();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { print } from 'graphql';
|
||||
import { print } from "graphql";
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import getSettingsQuery from '@/graphql/settings/settings.graphql';
|
||||
import getSettingsQuery from "@/graphql/settings/settings.graphql";
|
||||
|
||||
export async function getSettings(): Promise<GlobalSettings> {
|
||||
const client = await createDirectusConnection();
|
||||
|
||||
39
astro/src/graphql/blogs/getPaginatedBlogs.graphql
Normal file
39
astro/src/graphql/blogs/getPaginatedBlogs.graphql
Normal file
@@ -0,0 +1,39 @@
|
||||
query getPaginatedBlogs($date: String!, $pageNumber: Int!, $limit: Int!) {
|
||||
Blogs(sort: ["-date", "-date_created"], filter: { status: { _eq: "published" }, date: { _lte: $date } }, limit: $limit, page: $pageNumber) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
status,
|
||||
title,
|
||||
url,
|
||||
date,
|
||||
content,
|
||||
tags {
|
||||
Tags_id {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
text,
|
||||
code,
|
||||
color
|
||||
}
|
||||
},
|
||||
search_engine {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
description,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
canonical,
|
||||
allow_crawler,
|
||||
priority
|
||||
}
|
||||
}
|
||||
}
|
||||
50
astro/src/graphql/footer/getFooter.graphql
Normal file
50
astro/src/graphql/footer/getFooter.graphql
Normal file
@@ -0,0 +1,50 @@
|
||||
query getFooter {
|
||||
Footer {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
logo {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
copyright,
|
||||
columns {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
links {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
text,
|
||||
url
|
||||
}
|
||||
},
|
||||
socials {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
name,
|
||||
url,
|
||||
icon {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
},
|
||||
secondary_links {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
text,
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
35
astro/src/graphql/menu/getMenu.graphql
Normal file
35
astro/src/graphql/menu/getMenu.graphql
Normal file
@@ -0,0 +1,35 @@
|
||||
query getMenu {
|
||||
Menu {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
items {
|
||||
id,
|
||||
item {
|
||||
...on Menu_Column {
|
||||
__typename,
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
links {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
text,
|
||||
url
|
||||
}
|
||||
}
|
||||
|
||||
...on Menu_Link {
|
||||
__typename,
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
text,
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ query getAllPages($date: String!) {
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
text,
|
||||
url,
|
||||
icon {
|
||||
id,
|
||||
created_on,
|
||||
|
||||
@@ -180,7 +180,7 @@ query getAllPages($date: String!, $route: String!) {
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
text,
|
||||
url,
|
||||
icon {
|
||||
id,
|
||||
created_on,
|
||||
|
||||
@@ -9,7 +9,7 @@ query getAllAlbums($route: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
@@ -27,7 +27,7 @@ query getAllAlbums($route: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ query getAllAlbums($date: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
@@ -27,7 +27,7 @@ query getAllAlbums($date: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ query getAllCategories {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
|
||||
17
astro/src/graphql/photos/getCategory.graphql
Normal file
17
astro/src/graphql/photos/getCategory.graphql
Normal file
@@ -0,0 +1,17 @@
|
||||
query getAllCategories($url: String!) {
|
||||
Photo_Categories(filter: { status: { _eq: "published" }, url: { _eq: $url } }) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
status,
|
||||
title,
|
||||
url,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
}
|
||||
}
|
||||
51
astro/src/graphql/photos/getCategoryAlbum.graphql
Normal file
51
astro/src/graphql/photos/getCategoryAlbum.graphql
Normal file
@@ -0,0 +1,51 @@
|
||||
query getCategoryAlbums($date: String!, $categoryUrl: String!) {
|
||||
Photo_Albums(sort: ["-start_date", "-date_created"], filter: { status: { _eq: "published" }, start_date: { _lte: $date }, category: { Photo_Categories_id: { status: { _eq: "published" }, url: { _eq: $categoryUrl } } } }) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
description,
|
||||
url,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
start_date,
|
||||
end_date,
|
||||
location,
|
||||
category {
|
||||
Photo_Categories_id {
|
||||
id,
|
||||
status,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
url,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
}
|
||||
},
|
||||
photos(filter: { status: { _eq: "published" } }) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
photo {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
text,
|
||||
sort
|
||||
}
|
||||
}
|
||||
}
|
||||
51
astro/src/graphql/photos/getLastAlbums.graphql
Normal file
51
astro/src/graphql/photos/getLastAlbums.graphql
Normal file
@@ -0,0 +1,51 @@
|
||||
query getLastAlbums($date: String!, $limit: Int!) {
|
||||
Photo_Albums(sort: ["-start_date", "-date_created"], filter: { status: { _eq: "published" }, start_date: { _lte: $date }, category: { Photo_Categories_id: { status: { _eq: "published" } } } }, limit: $limit) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
description,
|
||||
url,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
start_date,
|
||||
end_date,
|
||||
location,
|
||||
category {
|
||||
Photo_Categories_id {
|
||||
id,
|
||||
status,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
url,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
}
|
||||
},
|
||||
photos(filter: { status: { _eq: "published" } }) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
photo {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
text,
|
||||
sort
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ query getPhotos($albumUrl: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
@@ -27,7 +27,7 @@ query getPhotos($albumUrl: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
}
|
||||
|
||||
39
astro/src/graphql/projects/getPaginatedProjects.graphql
Normal file
39
astro/src/graphql/projects/getPaginatedProjects.graphql
Normal file
@@ -0,0 +1,39 @@
|
||||
query getAllProjects($date: String!, $pageNumber: Int!, $limit: Int!) {
|
||||
Projects(sort: ["-date", "-date_created"], filter: { status: { _eq: "published" }, date: { _lte: $date } }, limit: $limit, page: $pageNumber) {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
status,
|
||||
title,
|
||||
url,
|
||||
date,
|
||||
content,
|
||||
tags {
|
||||
Tags_id {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
text,
|
||||
code,
|
||||
color
|
||||
}
|
||||
},
|
||||
search_engine {
|
||||
id,
|
||||
date_created,
|
||||
date_updated,
|
||||
title,
|
||||
description,
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
canonical,
|
||||
allow_crawler,
|
||||
priority
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ query getAllProjects($route: String!) {
|
||||
thumbnail {
|
||||
id,
|
||||
created_on,
|
||||
filename_download,
|
||||
filename_disk,
|
||||
width,
|
||||
height
|
||||
},
|
||||
|
||||
10
astro/src/icons/ChevronUp.astro
Normal file
10
astro/src/icons/ChevronUp.astro
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
interface Props {
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
---
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width={Astro.props.width ?? "24"} height={Astro.props.height ?? "24"} viewBox="0 0 24 24">
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 15l8-8l8 8" />
|
||||
</svg>
|
||||
10
astro/src/icons/Close.astro
Normal file
10
astro/src/icons/Close.astro
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
interface Props {
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
---
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width={Astro.props.width ?? "24"} height={Astro.props.height ?? "24"} viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6z" />
|
||||
</svg>
|
||||
10
astro/src/icons/Download.astro
Normal file
10
astro/src/icons/Download.astro
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
interface Props {
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
---
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width={Astro.props.width ?? "24"} height={Astro.props.height ?? "24"} viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="m12 16l-5-5l1.4-1.45l2.6 2.6V4h2v8.15l2.6-2.6L17 11zm-6 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z" />
|
||||
</svg>
|
||||
5
astro/src/icons/jsx/loadingSpinner.tsx
Normal file
5
astro/src/icons/jsx/loadingSpinner.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
export function LoadingSpinner(props: { width?: number, height?: number }) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width={props.width ?? "24"} height={props.height ?? "24"} viewBox="0 0 24 24"><circle cx="12" cy="2" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(45 12 12)"><animate attributeName="r" begin="0.125s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(90 12 12)"><animate attributeName="r" begin="0.25s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(135 12 12)"><animate attributeName="r" begin="0.375s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(180 12 12)"><animate attributeName="r" begin="0.5s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(225 12 12)"><animate attributeName="r" begin="0.625s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(270 12 12)"><animate attributeName="r" begin="0.75s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle><circle cx="12" cy="2" r="0" fill="currentColor" transform="rotate(315 12 12)"><animate attributeName="r" begin="0.875s" calcMode="spline" dur="1s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"/></circle></svg>
|
||||
)
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
---
|
||||
import '@/styles/global.css';
|
||||
import "@/styles/global.css";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import { getTextColor } from '@/lib/colors';
|
||||
import { getTextColor } from "@/lib/colors";
|
||||
import Footer from "@/components/footer/Footer.astro";
|
||||
|
||||
interface Props {
|
||||
settings: BlogLayoutProps;
|
||||
}
|
||||
|
||||
const tags = Astro.props.settings.tags ?? [];
|
||||
const pageSettings = Astro.props.settings.searchEngine;
|
||||
const settings = await getSettings();
|
||||
|
||||
@@ -41,7 +43,7 @@ const css = {
|
||||
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" />
|
||||
<link rel="canonical" href={`${settings.website.domainName}/`} />
|
||||
<meta name="robots" content="index,follow" />
|
||||
<meta name="keywords" content={[].join(',')} />
|
||||
<meta name="keywords" content={tags.join(",")} />
|
||||
|
||||
<!-- Low Priority Page Metadata -->
|
||||
<meta name="description" content={pageSettings.description} />
|
||||
@@ -54,7 +56,7 @@ const css = {
|
||||
<meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} />
|
||||
<meta property="og:site_name" content={settings.website.applicationName} />
|
||||
<meta property="article:author" content={settings.website.author.name} />
|
||||
<meta property="article:tags" content={[].join(',')} />
|
||||
<meta property="article:tags" content={[].join(",")} />
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} />
|
||||
@@ -77,7 +79,10 @@ const css = {
|
||||
|
||||
<!-- Scripts and Style -->
|
||||
</head>
|
||||
<body style={ css } class="bg-[#fcfcfc]">
|
||||
<slot name="content" />
|
||||
|
||||
<body style={ css } class="bg-[#fcfcfc] flex flex-col min-h-screen">
|
||||
<slot class="grow" name="content" />
|
||||
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
98
astro/src/layouts/PhotoLayout.astro
Normal file
98
astro/src/layouts/PhotoLayout.astro
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
import '@/styles/global.css';
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import { getTextColor } from '@/lib/colors';
|
||||
import { getImageSize } from '@/lib/images';
|
||||
import { getImage } from 'astro:assets';
|
||||
|
||||
interface Props {
|
||||
settings: WebpageLayoutProps;
|
||||
}
|
||||
|
||||
const pageSettings = Astro.props.settings.searchEngine;
|
||||
const settings = await getSettings();
|
||||
|
||||
const css = {
|
||||
"--ptc": settings.website.colors.primary,
|
||||
"--stc": settings.website.colors.secondary ?? settings.website.colors.primary,
|
||||
"--ptt": getTextColor(settings.website.colors.primary),
|
||||
"--stt": settings.website.colors.secondary
|
||||
? getTextColor(settings.website.colors.secondary)
|
||||
: getTextColor(settings.website.colors.primary)
|
||||
};
|
||||
|
||||
const searchengine = Astro.props.settings.searchEngine;
|
||||
|
||||
// Changing the thumbnail here is okay, as we now have two images: a new thumbnail, and the original image.
|
||||
// Might have to make it prettier down the line?
|
||||
// TODO: See comment above.
|
||||
const resizedThumbnail = getImageSize(searchengine.thumbnail.width,
|
||||
searchengine.thumbnail.height, 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: searchengine.thumbnail.url,
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- High Priority Metadata -->
|
||||
<meta charset="utf-8" />
|
||||
<meta name="lanuage" content="en" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="theme-color" content={settings.website.colors.primary} />
|
||||
|
||||
<!-- High Priority Page Metadata -->
|
||||
<title>{settings.website.titleTemplate.replaceAll("%T", pageSettings.title)}</title>
|
||||
|
||||
<!-- Medium Priority Metadata -->
|
||||
<meta name="msapplication-TileColor" content={settings.website.colors.primary} />
|
||||
<meta name="msapplication-TileImage" content="" />
|
||||
<link rel="sitemap" href="/sitemap/index.xml" />
|
||||
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" />
|
||||
<link rel="canonical" href={`${settings.website.domainName}/`} />
|
||||
<meta name="robots" content="index,follow" />
|
||||
|
||||
<!-- Low Priority Page Metadata -->
|
||||
<meta name="description" content={pageSettings.description} />
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:locale" content="en-GB" />
|
||||
<meta property="og:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} />
|
||||
<meta property="og:description" content={pageSettings.description} />
|
||||
<meta property="og:image:url" content={`${settings.website.domainName}${thumbnail.src}`} />
|
||||
<meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} />
|
||||
<meta property="og:site_name" content={settings.website.applicationName} />
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} />
|
||||
<meta name="twitter:description" content={pageSettings.description} />
|
||||
<meta name="twitter:image" content={`${settings.website.domainName}${thumbnail.src}`} />
|
||||
<meta name="twitter:url" content={`${settings.website.domainName}${Astro.url.pathname}`} />
|
||||
<meta name="twitter:site" content={settings.website.twitter.handle} />
|
||||
<meta name="twitter:creator" content={settings.website.twitter.handle} />
|
||||
|
||||
<meta name="pagename" content={pageSettings.title} />
|
||||
<meta name="category" content="webpage" />
|
||||
|
||||
<!-- Low Priority Metadata -->
|
||||
<meta name="copyright" content={settings.website.copyright} />
|
||||
<meta name="author" content={`${settings.website.author.name}, ${settings.website.author.url}`} />
|
||||
<meta name="designer" content={settings.website.designer} />
|
||||
<meta name="owner" content={settings.website.owner} />
|
||||
<meta name="developer" content={settings.website.developer} />
|
||||
<meta name="application-name" content={settings.website.applicationName} />
|
||||
|
||||
<!-- Scripts and Style -->
|
||||
</head>
|
||||
|
||||
<body style={ css } class="bg-neutral-950 flex flex-col min-h-screen">
|
||||
<slot class="grow" name="content" />
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
import '@/styles/global.css';
|
||||
import "@/styles/global.css";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import { getTextColor } from '@/lib/colors';
|
||||
import { getTextColor } from "@/lib/colors";
|
||||
import Footer from "@/components/footer/Footer.astro";
|
||||
|
||||
interface Props {
|
||||
settings: BlogLayoutProps;
|
||||
@@ -41,7 +42,7 @@ const css = {
|
||||
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" />
|
||||
<link rel="canonical" href={`${settings.website.domainName}/`} />
|
||||
<meta name="robots" content="index,follow" />
|
||||
<meta name="keywords" content={[].join(',')} />
|
||||
<meta name="keywords" content={[].join(",")} />
|
||||
|
||||
<!-- Low Priority Page Metadata -->
|
||||
<meta name="description" content={pageSettings.description} />
|
||||
@@ -54,7 +55,7 @@ const css = {
|
||||
<meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} />
|
||||
<meta property="og:site_name" content={settings.website.applicationName} />
|
||||
<meta property="article:author" content={settings.website.author.name} />
|
||||
<meta property="article:tags" content={[].join(',')} />
|
||||
<meta property="article:tags" content={[].join(",")} />
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} />
|
||||
@@ -77,7 +78,10 @@ const css = {
|
||||
|
||||
<!-- Scripts and Style -->
|
||||
</head>
|
||||
<body style={ css } class="bg-[#fcfcfc]">
|
||||
<slot name="content" />
|
||||
|
||||
<body style={ css } class="bg-[#fcfcfc] flex flex-col min-h-screen">
|
||||
<slot class="grow" name="content" />
|
||||
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
import '@/styles/global.css';
|
||||
import "@/styles/global.css";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import { getTextColor } from '@/lib/colors';
|
||||
import { getTextColor } from "@/lib/colors";
|
||||
import Footer from "@/components/footer/Footer.astro";
|
||||
|
||||
interface Props {
|
||||
settings: WebpageLayoutProps;
|
||||
@@ -74,7 +75,10 @@ const css = {
|
||||
|
||||
<!-- Scripts and Style -->
|
||||
</head>
|
||||
<body style={ css } class="bg-[#fcfcfc]">
|
||||
<slot name="content" />
|
||||
|
||||
<body style={ css } class="bg-[#fcfcfc] flex flex-col min-h-screen">
|
||||
<slot class="grow" name="content" />
|
||||
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export function getTextColor(bgColor: string) {
|
||||
// Remove # if present
|
||||
const hex = bgColor.replace('#', '');
|
||||
const hex = bgColor.replace("#", "");
|
||||
|
||||
// Convert hex to RGB
|
||||
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
||||
@@ -19,5 +19,5 @@ export function getTextColor(bgColor: string) {
|
||||
const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
||||
|
||||
// Return white for dark backgrounds, black for light backgrounds
|
||||
return luminance > 0.179 ? '#000000' : '#fcfcfc';
|
||||
return luminance > 0.179 ? "#000000" : "#fcfcfc";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export function formatDate(date: Date, format: string) {
|
||||
return format
|
||||
.replaceAll("%Y", date.getFullYear().toString())
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0'))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, '0'));
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, "0"));
|
||||
}
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
export function getImageUrl(url: string) {
|
||||
return `${import.meta.env.DIRECTUS_URL}assets/${url}`;
|
||||
}
|
||||
|
||||
export function getImageSize(width: number, height: number, targetMegapixels: number): ResizedImageResponse {
|
||||
const originalPixels = width * height;
|
||||
const targetPixels = targetMegapixels * 1000 * 1000;
|
||||
|
||||
if (originalPixels <= targetPixels) {
|
||||
return {
|
||||
width,
|
||||
height
|
||||
}
|
||||
}
|
||||
|
||||
const scale = Math.sqrt(targetPixels / originalPixels);
|
||||
|
||||
return {
|
||||
width: Math.round(scale * width),
|
||||
height: Math.round(scale * height)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { getBlog } from "@/content/blogs/blogs";
|
||||
import { getWebpage } from "@/content/pages/pages";
|
||||
import { getAlbum } from "@/content/photos/albums";
|
||||
import { getAllCategories, getPhotoCategory } from "@/content/photos/categories";
|
||||
import { getPhotoFromHash } from "@/content/photos/photos";
|
||||
import { getProject } from "@/content/projects/projects";
|
||||
import { getImageSize, getImageUrl } from "./images";
|
||||
import { getImage } from "astro:assets";
|
||||
|
||||
export async function getPage(settings: GlobalSettings, route: string): Promise<PageType | null> {
|
||||
// Blog Index
|
||||
@@ -91,10 +94,32 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
||||
}
|
||||
// Photo Category Index
|
||||
else if (regexToRoute({ template: settings.photo.categoryIndex.indexRouteTemplate, allowPagination: false }).regex.test(route)) {
|
||||
const allCategories = await getAllCategories(settings);
|
||||
const lastCategory = allCategories[0];
|
||||
|
||||
// Changing the thumbnail here is okay, as it gets everything again in the CategoryIndex.astro file.
|
||||
// Might have to make it prettier down the line?
|
||||
// TODO: See comment above.
|
||||
const resizedThumbnail = getImageSize(lastCategory.thumbnail.width, lastCategory.thumbnail.height, 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: lastCategory.thumbnail.url,
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
|
||||
lastCategory.thumbnail = {
|
||||
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height
|
||||
}
|
||||
|
||||
return {
|
||||
route: route,
|
||||
pageType: "PhotoCategoryIndex",
|
||||
page: {
|
||||
category: lastCategory,
|
||||
type: "PhotoCategoryIndex",
|
||||
exists: true
|
||||
}
|
||||
@@ -112,13 +137,33 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
||||
params[key] = match[i + 1];
|
||||
});
|
||||
|
||||
const category = await getPhotoCategory(`/${params["C"]}`);
|
||||
|
||||
// Changing the thumbnail here is okay, as it gets everything again in the Category.astro file.
|
||||
// Might have to make it prettier down the line?
|
||||
// TODO: See comment above.
|
||||
const resizedThumbnail = getImageSize(category.thumbnail.width, category.thumbnail.height, 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: category.thumbnail.url,
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
|
||||
category.thumbnail = {
|
||||
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height
|
||||
};
|
||||
|
||||
return {
|
||||
route: route,
|
||||
pageType: "PhotoCategory",
|
||||
page: {
|
||||
type: "PhotoCategory",
|
||||
exists: true,
|
||||
category: params["category"],
|
||||
category: category,
|
||||
pageNumber: params["page"] !== undefined ? Number(params["page"]) : 1
|
||||
}
|
||||
};
|
||||
@@ -137,10 +182,30 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
||||
|
||||
const photoAlbum = await getAlbum(settings, `/${params["R"]}`);
|
||||
|
||||
// Changing the thumbnail here is okay, as the thumbnail is unused in the Album.astro file.
|
||||
// Might have to make it prettier down the line?
|
||||
// TODO: See comment above.
|
||||
const resizedThumbnail = getImageSize(photoAlbum.thumbnail.width, photoAlbum.thumbnail.height, 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: getImageUrl(photoAlbum.thumbnail.url),
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
|
||||
return {
|
||||
route: route,
|
||||
pageType: "PhotoAlbum",
|
||||
page: photoAlbum
|
||||
page: {
|
||||
...photoAlbum,
|
||||
thumbnail: {
|
||||
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||
width: resizedThumbnail.width,
|
||||
height: resizedThumbnail.height
|
||||
},
|
||||
pageNumber: params["page"] !== undefined ? Number(params["page"]) : 1
|
||||
}
|
||||
};
|
||||
}
|
||||
// Photograph
|
||||
@@ -168,7 +233,8 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
||||
|
||||
id: photo!.id,
|
||||
photo: photo!.photo,
|
||||
text: photo!.text
|
||||
text: photo!.text,
|
||||
album: photo!.album
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -188,6 +254,16 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
||||
}
|
||||
}
|
||||
|
||||
const resizedImage = getImageSize(webpageContent.searchEngine.thumbnail.width,
|
||||
webpageContent.searchEngine.thumbnail.height, 0.756);
|
||||
|
||||
const thumbnail = await getImage({
|
||||
src: webpageContent.searchEngine.thumbnail.url,
|
||||
width: resizedImage.width,
|
||||
height: resizedImage.height,
|
||||
format: "jpeg"
|
||||
});
|
||||
|
||||
return {
|
||||
route: route,
|
||||
pageType: "Webpage",
|
||||
@@ -197,7 +273,14 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
|
||||
id: webpageContent.id,
|
||||
lastModified: webpageContent.lastModified,
|
||||
url: webpageContent.url,
|
||||
searchEngine: webpageContent.searchEngine,
|
||||
searchEngine: {
|
||||
...webpageContent.searchEngine,
|
||||
thumbnail: {
|
||||
url: `${settings.website.domainName}${thumbnail.src}`,
|
||||
width: resizedImage.width,
|
||||
height: resizedImage.height
|
||||
}
|
||||
},
|
||||
components: webpageContent.components
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getAllBlogs } from "@/content/blogs/blogs";
|
||||
import { getAllWebpages } from "@/content/pages/pages";
|
||||
import { getAllAlbums } from "@/content/photos/albums";
|
||||
import { getAllProjects } from "@/content/projects/projects";
|
||||
import { getPhotoHash } from "./hash";
|
||||
import { getPhotoHash } from "@/lib/hash";
|
||||
import { getAllCategories } from "@/content/photos/categories";
|
||||
|
||||
export async function getAllRoutesList(settings: GlobalSettings): Promise<string[]> {
|
||||
@@ -11,7 +11,9 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise<string
|
||||
const webpages = await getAllWebpages();
|
||||
|
||||
webpages.forEach((webpage) => {
|
||||
if (webpage.exists) {
|
||||
routes.push(webpage.url);
|
||||
}
|
||||
});
|
||||
|
||||
if (settings.blog.enabled) {
|
||||
@@ -48,6 +50,8 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise<string
|
||||
}
|
||||
if (settings.photo.enabled) {
|
||||
const categories = await getAllCategories(settings);
|
||||
|
||||
if (categories.length > 0) {
|
||||
const galleries = await getAllAlbums(settings);
|
||||
|
||||
routes.push(settings.photo.categoryIndex.indexRouteTemplate);
|
||||
@@ -85,6 +89,7 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise<string
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return routes;
|
||||
}
|
||||
@@ -94,10 +99,10 @@ export function getBlogRoute(blogSettings: BlogSettings, blog: BlogPost) {
|
||||
|
||||
return blogSettings.blogRouteTemplate
|
||||
.replaceAll("%Y", date.getFullYear().toString())
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0'))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, '0'))
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, "0"))
|
||||
.replaceAll("%R", blog.url)
|
||||
.replace(/\/+/g, '/');
|
||||
.replace(/\/+/g, "/");
|
||||
}
|
||||
|
||||
export function getProjectRoute(projectSettings: ProjectSettings, project: ProjectPost) {
|
||||
@@ -105,16 +110,16 @@ export function getProjectRoute(projectSettings: ProjectSettings, project: Proje
|
||||
|
||||
return projectSettings.projectRouteTemplate
|
||||
.replaceAll("%Y", date.getFullYear().toString())
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0'))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, '0'))
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, "0"))
|
||||
.replaceAll("%R", project.url)
|
||||
.replace(/\/+/g, '/');
|
||||
.replace(/\/+/g, "/");
|
||||
}
|
||||
|
||||
export function getCategoryRoute(photoSettings: WebsitePhotoSettings, category: PhotoAlbumCategory) {
|
||||
return photoSettings.category.routeTemplate
|
||||
.replaceAll("%C", category.url)
|
||||
.replace(/\/+/g, '/');
|
||||
.replace(/\/+/g, "/");
|
||||
}
|
||||
|
||||
export function getAlbumRoute(photoSettings: WebsitePhotoSettings, album: PhotoAlbum) {
|
||||
@@ -122,11 +127,11 @@ export function getAlbumRoute(photoSettings: WebsitePhotoSettings, album: PhotoA
|
||||
|
||||
return photoSettings.album.routeTemplate
|
||||
.replaceAll("%Y", date.getFullYear().toString())
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0'))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, '0'))
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, "0"))
|
||||
.replaceAll("%C", album.category.url)
|
||||
.replaceAll("%R", album.url)
|
||||
.replace(/\/+/g, '/');
|
||||
.replace(/\/+/g, "/");
|
||||
}
|
||||
|
||||
export function getPhotoRoute(photoSettings: WebsitePhotoSettings, album: PhotoAlbum, photo: PhotoAlbumPhoto) {
|
||||
@@ -134,10 +139,10 @@ export function getPhotoRoute(photoSettings: WebsitePhotoSettings, album: PhotoA
|
||||
|
||||
return photoSettings.photo.routeTemplate
|
||||
.replaceAll("%Y", date.getFullYear().toString())
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0'))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, '0'))
|
||||
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
|
||||
.replaceAll("%D", date.getDate().toString().padStart(2, "0"))
|
||||
.replaceAll("%C", album.category.url)
|
||||
.replaceAll("%R", album.url)
|
||||
.replaceAll("%H", getPhotoHash(photo))
|
||||
.replace(/\/+/g, '/');
|
||||
.replace(/\/+/g, "/");
|
||||
}
|
||||
|
||||
@@ -5,9 +5,17 @@ import { getSettings } from "@/content/settings/settings"
|
||||
import WebpageLayout from "@/layouts/WebpageLayout.astro";
|
||||
import BlogLayout from "@/layouts/BlogLayout.astro";
|
||||
import ProjectLayout from "@/layouts/ProjectLayout.astro";
|
||||
import PhotoLayout from "@/layouts/PhotoLayout.astro";
|
||||
import BlogIndex from "@/components/blogs/BlogIndex.astro";
|
||||
import ProjectIndex from "@/components/projects/ProjectIndex.astro";
|
||||
import Webpage from "@/components/webpage/Webpage.astro";
|
||||
import BlogPost from "@/components/blogs/BlogPost.astro";
|
||||
import ProjectPost from "@/components/projects/ProjectPost.astro";
|
||||
import CategoryIndex from "@/components/photos/CategoryIndex.astro";
|
||||
import Category from "@/components/photos/Category.astro";
|
||||
import AlbumPage from "@/components/photos/Album.astro";
|
||||
import { getImageUrl } from "@/lib/images";
|
||||
import Photo from "@/components/photos/Photo.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const settings = await getSettings();
|
||||
@@ -23,9 +31,10 @@ export async function getStaticPaths() {
|
||||
}
|
||||
|
||||
const settings = await getSettings();
|
||||
const page = await getPage(settings, Astro.url.pathname);
|
||||
const pathName = Astro.url.pathname === "/" ? "/" : Astro.url.pathname.replace(/\/$/, "");
|
||||
const page = await getPage(settings, pathName);
|
||||
|
||||
if (page === null || page.page === null) {
|
||||
if (page === null || page.page === null || !page.page.exists) {
|
||||
return new Response("Page not found.", {
|
||||
status: 404,
|
||||
statusText: "Not Found"
|
||||
@@ -35,18 +44,8 @@ if (page === null || page.page === null) {
|
||||
|
||||
{ page.page.type === "Webpage" && page.page.exists && (
|
||||
<WebpageLayout settings={{
|
||||
searchEngine: {
|
||||
title: page.page.searchEngine.title,
|
||||
description: page.page.searchEngine.description,
|
||||
allowCrawlers: page.page.searchEngine.allowCrawlers,
|
||||
canonical: page.page.searchEngine.canonical,
|
||||
priority: page.page.searchEngine.priority,
|
||||
thumbnail: {
|
||||
url: page.page.searchEngine.thumbnail.url,
|
||||
width: 1200,
|
||||
height: 630
|
||||
}
|
||||
}}}>
|
||||
searchEngine: page.page.searchEngine
|
||||
}}>
|
||||
<Fragment slot="content">
|
||||
<Webpage webpage={page.page.components} />
|
||||
</Fragment>
|
||||
@@ -75,22 +74,11 @@ if (page === null || page.page === null) {
|
||||
|
||||
{ page.page.type === "BlogPost" && (
|
||||
<BlogLayout settings={{
|
||||
searchEngine: {
|
||||
title: page.page.searchEngine.title,
|
||||
description: page.page.searchEngine.description,
|
||||
allowCrawlers: page.page.searchEngine.allowCrawlers,
|
||||
canonical: page.page.searchEngine.canonical,
|
||||
priority: page.page.searchEngine.priority,
|
||||
thumbnail: {
|
||||
url: page.page.searchEngine.thumbnail.url,
|
||||
width: 1200,
|
||||
height: 630
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
searchEngine: page.page.searchEngine,
|
||||
tags: page.page.tags.map((tag) => tag.text)
|
||||
}}>
|
||||
<Fragment slot="content">
|
||||
<dib>BlogPost</dib>
|
||||
<BlogPost blog={page.page} />
|
||||
</Fragment>
|
||||
</BlogLayout>
|
||||
) }
|
||||
@@ -110,29 +98,18 @@ if (page === null || page.page === null) {
|
||||
}
|
||||
}}}>
|
||||
<Fragment slot="content">
|
||||
<ProjectIndex page={page.page as ProjectIndex} />
|
||||
<ProjectIndex page={page.page} />
|
||||
</Fragment>
|
||||
</WebpageLayout>
|
||||
) }
|
||||
|
||||
{ page.page.type === "ProjectPost" && (
|
||||
<ProjectLayout settings={{
|
||||
searchEngine: {
|
||||
title: "Projects",
|
||||
description: "",
|
||||
allowCrawlers: true,
|
||||
canonical: null,
|
||||
priority: 65,
|
||||
thumbnail: {
|
||||
url: "",
|
||||
width: 1200,
|
||||
height: 630
|
||||
}
|
||||
},
|
||||
tags: []
|
||||
searchEngine: page.page.searchEngine,
|
||||
tags: page.page.tags.map((tag) => tag.text)
|
||||
}}>
|
||||
<Fragment slot="content">
|
||||
<div>ProjectPost</div>
|
||||
<ProjectPost project={page.page} />
|
||||
</Fragment>
|
||||
</ProjectLayout>
|
||||
) }
|
||||
@@ -140,39 +117,67 @@ if (page === null || page.page === null) {
|
||||
{ page.pageType === "PhotoCategoryIndex" && (
|
||||
<WebpageLayout settings={{
|
||||
searchEngine: {
|
||||
title: "Projects",
|
||||
description: "",
|
||||
title: "Categories",
|
||||
description: "See the photo categories on this page, where you can see the different types of photography I do.",
|
||||
allowCrawlers: true,
|
||||
canonical: null,
|
||||
priority: 65,
|
||||
thumbnail: {
|
||||
url: "",
|
||||
width: 1200,
|
||||
height: 630
|
||||
}
|
||||
thumbnail: page.page.category.thumbnail
|
||||
}}}>
|
||||
<Fragment slot="content">
|
||||
<div>PhotoCategoryIndex</div>
|
||||
<CategoryIndex />
|
||||
</Fragment>
|
||||
</WebpageLayout>
|
||||
) }
|
||||
|
||||
{ page.pageType === "PhotoCategory" && (
|
||||
<WebpageLayout settings={{
|
||||
searchEngine: {
|
||||
title: page.page.category.title,
|
||||
description: `See the photos in the ${page.page.category.title.toLowerCase()} category.`,
|
||||
allowCrawlers: true,
|
||||
canonical: null,
|
||||
priority: 65,
|
||||
thumbnail: page.page.category.thumbnail
|
||||
}}}>
|
||||
<Fragment slot="content">
|
||||
<Category category={page.page} />
|
||||
</Fragment>
|
||||
</WebpageLayout>
|
||||
) }
|
||||
|
||||
{ page.pageType === "PhotoAlbum" && (
|
||||
<WebpageLayout settings={{
|
||||
searchEngine: {
|
||||
title: page.page.title,
|
||||
description: `See the photos in the ${page.page.category.title.toLowerCase()} category.`,
|
||||
allowCrawlers: true,
|
||||
canonical: null,
|
||||
priority: 65,
|
||||
thumbnail: page.page.thumbnail
|
||||
}}}>
|
||||
<Fragment slot="content">
|
||||
<AlbumPage page={page.page} />
|
||||
</Fragment>
|
||||
</WebpageLayout>
|
||||
) }
|
||||
|
||||
{ page.pageType === "Photo" && (
|
||||
<WebpageLayout settings={{
|
||||
<PhotoLayout settings={{
|
||||
searchEngine: {
|
||||
title: "Projects",
|
||||
description: "",
|
||||
title: page.page.album.title,
|
||||
description: `See this photo from the album ${page.page.album.title}`,
|
||||
allowCrawlers: true,
|
||||
canonical: null,
|
||||
priority: 65,
|
||||
thumbnail: {
|
||||
url: "",
|
||||
width: 1200,
|
||||
height: 630
|
||||
url: getImageUrl(page.page.photo.url),
|
||||
width: page.page.photo.width,
|
||||
height: page.page.photo.height
|
||||
}
|
||||
}}}>
|
||||
<Fragment slot="content">
|
||||
<div>Photo</div>
|
||||
<Photo page={page.page} />
|
||||
</Fragment>
|
||||
</WebpageLayout>
|
||||
</PhotoLayout>
|
||||
) }
|
||||
|
||||
@@ -7,8 +7,8 @@ export const GET = (async () => {
|
||||
const robots = await getRobotsSettings();
|
||||
|
||||
let crawlers = [
|
||||
{ id: 'google', name: 'Googlebot' },
|
||||
{ id: 'bing', name: "Bingbot" },
|
||||
{ id: "google", name: "Googlebot" },
|
||||
{ id: "bing", name: "Bingbot" },
|
||||
{ id: "slurp", name: "Slurp" },
|
||||
{ id: "duckduckgo", name: "DuckDuckBot" },
|
||||
{ id: "baidu", name: "Baiduspider" },
|
||||
@@ -53,7 +53,7 @@ export const GET = (async () => {
|
||||
`User-agent: ${crawlerData!.name}\nDisallow: /`
|
||||
}
|
||||
|
||||
crawlerContent = crawlerContent + "\n\n\n"
|
||||
crawlerContent = crawlerContent + "\n\n"
|
||||
});
|
||||
|
||||
return new Response(crawlerContent.trim(), {
|
||||
|
||||
@@ -39,7 +39,7 @@ export const GET = (async ({ params }) => {
|
||||
<loc>${settings.website.domainName}${page.url}</loc>
|
||||
<lastmod>${page.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function getStaticPaths() {
|
||||
let items: any[] = [];
|
||||
|
||||
for (let i = 0; i < pages; i++) {
|
||||
items.push({ params: { page: (i + 1) } });
|
||||
items.push({ params: { page: (i + 1).toString() } });
|
||||
}
|
||||
|
||||
return items;
|
||||
|
||||
@@ -54,7 +54,7 @@ export const GET = (async () => {
|
||||
<loc>${settings.website.domainName}${item.url}</loc>
|
||||
<lastmod>${item.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export const GET = (async ({ params }) => {
|
||||
<loc>${settings.website.domainName}${page.url}</loc>
|
||||
<lastmod>${page.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function getStaticPaths() {
|
||||
let items: any[] = [];
|
||||
|
||||
for (let i = 0; i < pages; i++) {
|
||||
items.push({ params: { page: (i + 1) } });
|
||||
items.push({ params: { page: (i + 1).toString() } });
|
||||
}
|
||||
|
||||
return items;
|
||||
|
||||
@@ -54,7 +54,7 @@ export const GET = (async () => {
|
||||
<loc>${settings.website.domainName}${item.url}</loc>
|
||||
<lastmod>${item.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ export const GET = (async () => {
|
||||
<loc>${settings.website.domainName}${item.url}</loc>
|
||||
<lastmod>${item.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
|
||||
@@ -17,10 +17,12 @@ export const GET = (async ({ params }) => {
|
||||
let pages: SitemapPage[] = [];
|
||||
|
||||
selectedPages.forEach((page) => {
|
||||
if (page.exists) {
|
||||
pages.push({
|
||||
url: page.url,
|
||||
lastModified: page.lastModified
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let sitemapContent = `
|
||||
@@ -31,7 +33,7 @@ export const GET = (async ({ params }) => {
|
||||
<loc>${settings.website.domainName}${page.url}</loc>
|
||||
<lastmod>${page.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
@@ -55,7 +57,7 @@ export async function getStaticPaths() {
|
||||
let items: any[] = [];
|
||||
|
||||
for (let i = 0; i < pages; i++) {
|
||||
items.push({ params: { page: (i + 1) } });
|
||||
items.push({ params: { page: (i + 1).toString() } });
|
||||
}
|
||||
|
||||
return items;
|
||||
|
||||
@@ -28,7 +28,7 @@ export const GET = (async () => {
|
||||
<loc>${settings.website.domainName}${item.url}</loc>
|
||||
<lastmod>${item.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export const GET = (async ({ params }) => {
|
||||
<loc>${settings.website.domainName}${page.url}</loc>
|
||||
<lastmod>${page.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function getStaticPaths() {
|
||||
let items: any[] = [];
|
||||
|
||||
for (let i = 0; i < pages; i++) {
|
||||
items.push({ params: { page: (i + 1) } });
|
||||
items.push({ params: { page: (i + 1).toString() } });
|
||||
}
|
||||
|
||||
return items;
|
||||
|
||||
@@ -54,7 +54,7 @@ export const GET = (async () => {
|
||||
<loc>${settings.website.domainName}${item.url}</loc>
|
||||
<lastmod>${item.lastModified.toISOString()}</lastmod>
|
||||
</sitemap>
|
||||
`).join('')}
|
||||
`).join("")}
|
||||
</sitemapindex>
|
||||
`;
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
@import "tailwindcss";
|
||||
@plugin "@tailwindcss/typography";
|
||||
|
||||
13
astro/src/styles/markdownClasses.ts
Normal file
13
astro/src/styles/markdownClasses.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export function getTypographyClasses() {
|
||||
return [
|
||||
"prose prose-neutral",
|
||||
"prose-h1:mb-2",
|
||||
"prose-h2:mb-1.5 prose-h2:mt-0.5",
|
||||
"prose-p:mt-1.5 prose-p:mb-7",
|
||||
"[&>p:has(+:is(h1,h2,h3,h4,h5,h6))]:mb-8",
|
||||
"[&>p:has(+p)]:mb-4",
|
||||
"[&>*:first-child]:mt-0",
|
||||
"[&>*:last-child]:mb-0",
|
||||
"[&>pre]:max-w-[100%]"
|
||||
].join(' ').trim();
|
||||
}
|
||||
2
astro/src/types/blogs/blog.d.ts
vendored
2
astro/src/types/blogs/blog.d.ts
vendored
@@ -8,6 +8,8 @@ type BlogPost = {
|
||||
date: string;
|
||||
content: string;
|
||||
|
||||
thumbnail: PhotoProps;
|
||||
|
||||
tags: Tag[];
|
||||
|
||||
searchEngine: SearchEngine;
|
||||
|
||||
5
astro/src/types/common/images.d.ts
vendored
5
astro/src/types/common/images.d.ts
vendored
@@ -3,3 +3,8 @@ type PhotoProps = {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
type ResizedImageResponse = {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
2
astro/src/types/components/contact.d.ts
vendored
2
astro/src/types/components/contact.d.ts
vendored
@@ -10,7 +10,7 @@ type ContactComponent = {
|
||||
type ContactMethod = {
|
||||
id: string;
|
||||
title: string;
|
||||
text: string;
|
||||
url: string;
|
||||
color: string;
|
||||
icon: PhotoProps;
|
||||
}
|
||||
|
||||
44
astro/src/types/footers/footer.d.ts
vendored
Normal file
44
astro/src/types/footers/footer.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { StringValidation } from "astro:schema";
|
||||
|
||||
type Footer = {
|
||||
id: string;
|
||||
|
||||
title: string | null;
|
||||
logo: PhotoProps | null;
|
||||
copyright: string | null;
|
||||
|
||||
columns: FooterColumn[];
|
||||
socials: FooterSocial[] | null;
|
||||
secondaryLinks: FooterSecondaryLink[] | null;
|
||||
|
||||
lastModified: Date;
|
||||
}
|
||||
|
||||
type FooterColumn = {
|
||||
id: string;
|
||||
|
||||
title: string;
|
||||
links: FooterColumnLink[];
|
||||
}
|
||||
|
||||
type FooterSocial = {
|
||||
id: string;
|
||||
|
||||
name: string;
|
||||
url: string;
|
||||
icon: PhotoProps;
|
||||
}
|
||||
|
||||
type FooterSecondaryLink = {
|
||||
id: string;
|
||||
|
||||
text: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
type FooterColumnLink = {
|
||||
id: string;
|
||||
|
||||
text: string;
|
||||
url: string;
|
||||
}
|
||||
20
astro/src/types/menu/menu.d.ts
vendored
Normal file
20
astro/src/types/menu/menu.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
type Menu = {
|
||||
id: string;
|
||||
items: MenuColumn[];
|
||||
}
|
||||
|
||||
type MenuColumn = {
|
||||
type: "Column";
|
||||
|
||||
id: string;
|
||||
title: string;
|
||||
links: MenuLink[];
|
||||
}
|
||||
|
||||
type MenuLink = {
|
||||
type: "Link";
|
||||
|
||||
id: string;
|
||||
text: string;
|
||||
url: string;
|
||||
}
|
||||
2
astro/src/types/pages/page.d.ts
vendored
2
astro/src/types/pages/page.d.ts
vendored
@@ -41,6 +41,6 @@ type PageType =
|
||||
| { pageType: "ProjectPost"; page: ProjectPost; route: string }
|
||||
| { pageType: "PhotoCategoryIndex"; page: PhotoCategoryIndex; route: string }
|
||||
| { pageType: "PhotoCategory"; page: PhotoCategory; route: string }
|
||||
| { pageType: "PhotoAlbum"; page: PhotoAlbum; route: string }
|
||||
| { pageType: "PhotoAlbum"; page: PhotoAlbumPage; route: string }
|
||||
| { pageType: "Photo"; page: PhotoPage; route: string }
|
||||
| { pageType: "Unknown"; page: null; route: string };
|
||||
|
||||
37
astro/src/types/photos/album.d.ts
vendored
37
astro/src/types/photos/album.d.ts
vendored
@@ -2,6 +2,31 @@ type PhotoAlbum = {
|
||||
type: "PhotoAlbum";
|
||||
exists: boolean;
|
||||
|
||||
id: string;
|
||||
|
||||
title: string;
|
||||
url: string;
|
||||
description: string | null;
|
||||
|
||||
thumbnail: PhotoProps;
|
||||
|
||||
startDate: string;
|
||||
endDate: string | null;
|
||||
location: string | null;
|
||||
|
||||
category: PhotoAlbumCategory;
|
||||
photos: PhotoAlbumPhoto[];
|
||||
|
||||
lastModified: Date;
|
||||
}
|
||||
|
||||
type PhotoAlbumPage = {
|
||||
type: "PhotoAlbum";
|
||||
exists: boolean;
|
||||
pageNumber: number;
|
||||
|
||||
id: string;
|
||||
|
||||
title: string;
|
||||
url: string;
|
||||
description: string | null;
|
||||
@@ -35,6 +60,16 @@ type PhotoCategory = {
|
||||
type: "PhotoCategory";
|
||||
exists: boolean;
|
||||
|
||||
category: string;
|
||||
category: PhotoAlbumCategory;
|
||||
pageNumber: number;
|
||||
}
|
||||
|
||||
type PhotoAlbumItem = {
|
||||
id: string;
|
||||
photo: PhotoProps;
|
||||
text: string | null;
|
||||
album: {
|
||||
url: string;
|
||||
title: string;
|
||||
};
|
||||
}
|
||||
|
||||
2
astro/src/types/photos/category.d.ts
vendored
2
astro/src/types/photos/category.d.ts
vendored
@@ -1,4 +1,6 @@
|
||||
type PhotoCategoryIndex = {
|
||||
type: "PhotoCategoryIndex";
|
||||
exists: boolean;
|
||||
|
||||
category: PhotoAlbumCategory;
|
||||
}
|
||||
|
||||
16
astro/src/types/photos/photo.d.ts
vendored
16
astro/src/types/photos/photo.d.ts
vendored
@@ -5,4 +5,20 @@ type PhotoPage = {
|
||||
id: string;
|
||||
photo: PhotoProps;
|
||||
text: string | null;
|
||||
album: {
|
||||
url: string;
|
||||
title: string;
|
||||
};
|
||||
}
|
||||
|
||||
type PhotoAlbumItem = {
|
||||
photo: PhotoProps;
|
||||
url: string;
|
||||
}
|
||||
|
||||
type PhotoAlbumGalleryItem = {
|
||||
id: string;
|
||||
photo: PhotoProps;
|
||||
text: string | null;
|
||||
url: string;
|
||||
}
|
||||
|
||||
3
astro/src/types/projects/project.d.ts
vendored
3
astro/src/types/projects/project.d.ts
vendored
@@ -2,11 +2,14 @@ type ProjectPost = {
|
||||
type: "ProjectPost";
|
||||
exists: boolean;
|
||||
|
||||
id: string;
|
||||
title: string;
|
||||
url: string;
|
||||
date: string;
|
||||
content: string;
|
||||
|
||||
thumbnail: PhotoProps;
|
||||
|
||||
tags: Tag[];
|
||||
|
||||
searchEngine: SearchEngine;
|
||||
|
||||
@@ -1730,15 +1730,15 @@
|
||||
},
|
||||
{
|
||||
"collection": "Contact_Social",
|
||||
"field": "text",
|
||||
"type": "text",
|
||||
"field": "url",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"name": "text",
|
||||
"name": "url",
|
||||
"table": "Contact_Social",
|
||||
"data_type": "text",
|
||||
"data_type": "character varying",
|
||||
"default_value": null,
|
||||
"generation_expression": null,
|
||||
"max_length": null,
|
||||
"max_length": 255,
|
||||
"numeric_precision": null,
|
||||
"numeric_scale": null,
|
||||
"is_generated": false,
|
||||
@@ -1754,10 +1754,12 @@
|
||||
},
|
||||
"meta": {
|
||||
"collection": "Contact_Social",
|
||||
"field": "text",
|
||||
"field": "url",
|
||||
"special": null,
|
||||
"interface": "input-rich-text-md",
|
||||
"options": null,
|
||||
"interface": "input",
|
||||
"options": {
|
||||
"iconLeft": "link"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
@@ -3972,6 +3974,52 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Menu_Link",
|
||||
"field": "Menu_Column_id",
|
||||
"type": "uuid",
|
||||
"schema": {
|
||||
"name": "Menu_Column_id",
|
||||
"table": "Menu_Link",
|
||||
"data_type": "uuid",
|
||||
"default_value": null,
|
||||
"generation_expression": null,
|
||||
"max_length": null,
|
||||
"numeric_precision": null,
|
||||
"numeric_scale": null,
|
||||
"is_generated": false,
|
||||
"is_nullable": true,
|
||||
"is_unique": false,
|
||||
"is_indexed": false,
|
||||
"is_primary_key": false,
|
||||
"has_auto_increment": false,
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Menu_Column",
|
||||
"foreign_key_column": "id",
|
||||
"comment": null
|
||||
},
|
||||
"meta": {
|
||||
"collection": "Menu_Link",
|
||||
"field": "Menu_Column_id",
|
||||
"special": null,
|
||||
"interface": "select-dropdown-m2o",
|
||||
"options": null,
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": true,
|
||||
"sort": 8,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": false,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Menu_items",
|
||||
"field": "id",
|
||||
@@ -4553,9 +4601,7 @@
|
||||
"o2m"
|
||||
],
|
||||
"interface": "list-o2m",
|
||||
"options": {
|
||||
"template": "{{title}}"
|
||||
},
|
||||
"options": null,
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
@@ -4565,7 +4611,7 @@
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
@@ -7569,10 +7615,10 @@
|
||||
},
|
||||
{
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Page_id",
|
||||
"field": "Project_id",
|
||||
"type": "uuid",
|
||||
"schema": {
|
||||
"name": "Page_id",
|
||||
"name": "Project_id",
|
||||
"table": "Search_Engine_Optimisation",
|
||||
"data_type": "uuid",
|
||||
"default_value": null,
|
||||
@@ -7587,23 +7633,25 @@
|
||||
"is_primary_key": false,
|
||||
"has_auto_increment": false,
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Pages",
|
||||
"foreign_key_table": "Projects",
|
||||
"foreign_key_column": "id",
|
||||
"comment": null
|
||||
},
|
||||
"meta": {
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Page_id",
|
||||
"field": "Project_id",
|
||||
"special": [
|
||||
"uuid"
|
||||
"m2o"
|
||||
],
|
||||
"interface": "input",
|
||||
"options": null,
|
||||
"interface": "select-dropdown-m2o",
|
||||
"options": {
|
||||
"template": "{{title}}"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 12,
|
||||
"hidden": true,
|
||||
"sort": 16,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
@@ -7643,15 +7691,17 @@
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Blog_id",
|
||||
"special": [
|
||||
"uuid"
|
||||
"m2o"
|
||||
],
|
||||
"interface": "input",
|
||||
"options": null,
|
||||
"interface": "select-dropdown-m2o",
|
||||
"options": {
|
||||
"template": "{{title}}"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": true,
|
||||
"sort": 13,
|
||||
"sort": 18,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
@@ -7665,10 +7715,10 @@
|
||||
},
|
||||
{
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Project_id",
|
||||
"field": "Page_id",
|
||||
"type": "uuid",
|
||||
"schema": {
|
||||
"name": "Project_id",
|
||||
"name": "Page_id",
|
||||
"table": "Search_Engine_Optimisation",
|
||||
"data_type": "uuid",
|
||||
"default_value": null,
|
||||
@@ -7683,23 +7733,25 @@
|
||||
"is_primary_key": false,
|
||||
"has_auto_increment": false,
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Projects",
|
||||
"foreign_key_table": "Pages",
|
||||
"foreign_key_column": "id",
|
||||
"comment": null
|
||||
},
|
||||
"meta": {
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Project_id",
|
||||
"field": "Page_id",
|
||||
"special": [
|
||||
"uuid"
|
||||
"m2o"
|
||||
],
|
||||
"interface": "input",
|
||||
"options": null,
|
||||
"interface": "select-dropdown-m2o",
|
||||
"options": {
|
||||
"template": "{{url}}"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": true,
|
||||
"sort": 14,
|
||||
"sort": 19,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
@@ -9261,37 +9313,6 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Blogs",
|
||||
"field": "search_engine",
|
||||
"type": "alias",
|
||||
"schema": null,
|
||||
"meta": {
|
||||
"collection": "Blogs",
|
||||
"field": "search_engine",
|
||||
"special": [
|
||||
"o2m"
|
||||
],
|
||||
"interface": "list-o2m",
|
||||
"options": {
|
||||
"template": "{{title}}"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 10,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Blogs",
|
||||
"field": "tags",
|
||||
@@ -9311,7 +9332,7 @@
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 11,
|
||||
"sort": 10,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
@@ -9323,6 +9344,35 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Blogs",
|
||||
"field": "search_engine",
|
||||
"type": "alias",
|
||||
"schema": null,
|
||||
"meta": {
|
||||
"collection": "Blogs",
|
||||
"field": "search_engine",
|
||||
"special": [
|
||||
"o2m"
|
||||
],
|
||||
"interface": "list-o2m",
|
||||
"options": null,
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 11,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Blogs",
|
||||
"field": "content",
|
||||
@@ -11819,7 +11869,7 @@
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": true,
|
||||
"sort": 8,
|
||||
"sort": 7,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
@@ -11831,6 +11881,37 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Menu_Column",
|
||||
"field": "links",
|
||||
"type": "alias",
|
||||
"schema": null,
|
||||
"meta": {
|
||||
"collection": "Menu_Column",
|
||||
"field": "links",
|
||||
"special": [
|
||||
"o2m"
|
||||
],
|
||||
"interface": "list-o2m",
|
||||
"options": {
|
||||
"template": "{{text}}"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 8,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Menu_Column",
|
||||
"field": "sort",
|
||||
@@ -12356,37 +12437,6 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Projects",
|
||||
"field": "search_engine",
|
||||
"type": "alias",
|
||||
"schema": null,
|
||||
"meta": {
|
||||
"collection": "Projects",
|
||||
"field": "search_engine",
|
||||
"special": [
|
||||
"o2m"
|
||||
],
|
||||
"interface": "list-o2m",
|
||||
"options": {
|
||||
"template": "{{title}}"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 10,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Projects",
|
||||
"field": "tags",
|
||||
@@ -12406,7 +12456,7 @@
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 11,
|
||||
"sort": 10,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
@@ -12418,6 +12468,35 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Projects",
|
||||
"field": "search_engine",
|
||||
"type": "alias",
|
||||
"schema": null,
|
||||
"meta": {
|
||||
"collection": "Projects",
|
||||
"field": "search_engine",
|
||||
"special": [
|
||||
"o2m"
|
||||
],
|
||||
"interface": "list-o2m",
|
||||
"options": null,
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 11,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Projects",
|
||||
"field": "content",
|
||||
@@ -20052,6 +20131,68 @@
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Text_With_Side_Image",
|
||||
"field": "image_size",
|
||||
"type": "string",
|
||||
"schema": {
|
||||
"name": "image_size",
|
||||
"table": "Text_With_Side_Image",
|
||||
"data_type": "character varying",
|
||||
"default_value": "medium",
|
||||
"generation_expression": null,
|
||||
"max_length": 255,
|
||||
"numeric_precision": null,
|
||||
"numeric_scale": null,
|
||||
"is_generated": false,
|
||||
"is_nullable": true,
|
||||
"is_unique": false,
|
||||
"is_indexed": false,
|
||||
"is_primary_key": false,
|
||||
"has_auto_increment": false,
|
||||
"foreign_key_schema": null,
|
||||
"foreign_key_table": null,
|
||||
"foreign_key_column": null,
|
||||
"comment": null
|
||||
},
|
||||
"meta": {
|
||||
"collection": "Text_With_Side_Image",
|
||||
"field": "image_size",
|
||||
"special": null,
|
||||
"interface": "select-dropdown",
|
||||
"options": {
|
||||
"choices": [
|
||||
{
|
||||
"text": "Small",
|
||||
"value": "small"
|
||||
},
|
||||
{
|
||||
"text": "Medium",
|
||||
"value": "medium"
|
||||
},
|
||||
{
|
||||
"text": "Large",
|
||||
"value": "large"
|
||||
}
|
||||
],
|
||||
"icon": "photo_size_select_small"
|
||||
},
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"readonly": false,
|
||||
"hidden": false,
|
||||
"sort": 10,
|
||||
"width": "full",
|
||||
"translations": null,
|
||||
"note": null,
|
||||
"conditions": null,
|
||||
"required": true,
|
||||
"group": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"searchable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Wall_Of_Text",
|
||||
"field": "id",
|
||||
@@ -23941,6 +24082,32 @@
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Menu_Link",
|
||||
"field": "Menu_Column_id",
|
||||
"related_collection": "Menu_Column",
|
||||
"schema": {
|
||||
"constraint_name": "menu_link_menu_column_id_foreign",
|
||||
"table": "Menu_Link",
|
||||
"column": "Menu_Column_id",
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Menu_Column",
|
||||
"foreign_key_column": "id",
|
||||
"on_update": "NO ACTION",
|
||||
"on_delete": "SET NULL"
|
||||
},
|
||||
"meta": {
|
||||
"many_collection": "Menu_Link",
|
||||
"many_field": "Menu_Column_id",
|
||||
"one_collection": "Menu_Column",
|
||||
"one_field": "links",
|
||||
"one_collection_field": null,
|
||||
"one_allowed_collections": null,
|
||||
"junction_field": null,
|
||||
"sort_field": null,
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Menu_items",
|
||||
"field": "Menu_id",
|
||||
@@ -24403,32 +24570,6 @@
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Project_id",
|
||||
"related_collection": "Projects",
|
||||
"schema": {
|
||||
"constraint_name": "search_engine_optimisation_project_id_foreign",
|
||||
"table": "Search_Engine_Optimisation",
|
||||
"column": "Project_id",
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Projects",
|
||||
"foreign_key_column": "id",
|
||||
"on_update": "NO ACTION",
|
||||
"on_delete": "SET NULL"
|
||||
},
|
||||
"meta": {
|
||||
"many_collection": "Search_Engine_Optimisation",
|
||||
"many_field": "Project_id",
|
||||
"one_collection": "Projects",
|
||||
"one_field": "search_engine",
|
||||
"one_collection_field": null,
|
||||
"one_allowed_collections": null,
|
||||
"junction_field": null,
|
||||
"sort_field": null,
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Blog_id",
|
||||
@@ -24455,6 +24596,32 @@
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "Project_id",
|
||||
"related_collection": "Projects",
|
||||
"schema": {
|
||||
"constraint_name": "search_engine_optimisation_project_id_foreign",
|
||||
"table": "Search_Engine_Optimisation",
|
||||
"column": "Project_id",
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Projects",
|
||||
"foreign_key_column": "id",
|
||||
"on_update": "NO ACTION",
|
||||
"on_delete": "SET NULL"
|
||||
},
|
||||
"meta": {
|
||||
"many_collection": "Search_Engine_Optimisation",
|
||||
"many_field": "Project_id",
|
||||
"one_collection": "Projects",
|
||||
"one_field": "search_engine",
|
||||
"one_collection_field": null,
|
||||
"one_allowed_collections": null,
|
||||
"junction_field": null,
|
||||
"sort_field": null,
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Search_Engine_Optimisation",
|
||||
"field": "thumbnail",
|
||||
@@ -25625,6 +25792,32 @@
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Pages_components",
|
||||
"field": "Pages_id",
|
||||
"related_collection": "Pages",
|
||||
"schema": {
|
||||
"constraint_name": "pages_components_pages_id_foreign",
|
||||
"table": "Pages_components",
|
||||
"column": "Pages_id",
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Pages",
|
||||
"foreign_key_column": "id",
|
||||
"on_update": "NO ACTION",
|
||||
"on_delete": "SET NULL"
|
||||
},
|
||||
"meta": {
|
||||
"many_collection": "Pages_components",
|
||||
"many_field": "Pages_id",
|
||||
"one_collection": "Pages",
|
||||
"one_field": "components",
|
||||
"one_collection_field": null,
|
||||
"one_allowed_collections": null,
|
||||
"junction_field": "item",
|
||||
"sort_field": "sort",
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Pages_components",
|
||||
"field": "item",
|
||||
@@ -25654,32 +25847,6 @@
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Pages_components",
|
||||
"field": "Pages_id",
|
||||
"related_collection": "Pages",
|
||||
"schema": {
|
||||
"constraint_name": "pages_components_pages_id_foreign",
|
||||
"table": "Pages_components",
|
||||
"column": "Pages_id",
|
||||
"foreign_key_schema": "public",
|
||||
"foreign_key_table": "Pages",
|
||||
"foreign_key_column": "id",
|
||||
"on_update": "NO ACTION",
|
||||
"on_delete": "SET NULL"
|
||||
},
|
||||
"meta": {
|
||||
"many_collection": "Pages_components",
|
||||
"many_field": "Pages_id",
|
||||
"one_collection": "Pages",
|
||||
"one_field": "components",
|
||||
"one_collection_field": null,
|
||||
"one_allowed_collections": null,
|
||||
"junction_field": "item",
|
||||
"sort_field": "sort",
|
||||
"one_deselect_action": "nullify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": "Project_Settings",
|
||||
"field": "user_updated",
|
||||
|
||||
Reference in New Issue
Block a user