Clean up the project a bit

Fix imports, remove unnecessary imports, and replace all single apostrophe to double apostrophes
This commit is contained in:
itsfinniii
2026-04-27 21:15:32 +02:00
parent 9a92b1939c
commit d9430335d5
47 changed files with 192 additions and 197 deletions

View File

@@ -1,11 +1,11 @@
--- ---
import { getAllPaginatedBlogs } from '@/content/blogs/blogs'; import { getAllPaginatedBlogs } from "@/content/blogs/blogs";
import { getSettings } from '@/content/settings/settings'; import { getSettings } from "@/content/settings/settings";
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize, getImageUrl } from "@/lib/images";
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { getBlogRoute } from '@/lib/routing'; import { getBlogRoute } from "@/lib/routing";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
page: BlogIndex; page: BlogIndex;

View File

@@ -1,10 +1,8 @@
--- ---
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { markdownToHtml } from "@/lib/markdown";
import { markdownToHtml } from '@/lib/markdown'; import { getTypographyClasses } from "@/styles/markdownClasses";
import { getTypographyClasses } from '@/styles/markdownClasses'; import { Image } from "astro:assets";
import { Image } from 'astro:assets';
import LastBlogs from '../web/LastBlogs.astro';
interface Props { interface Props {
blog: BlogPost; blog: BlogPost;

View File

@@ -1,9 +1,9 @@
--- ---
import { getAlbumRoute, getPhotoRoute } from '@/lib/routing'; import { getAlbumRoute, getPhotoRoute } from "@/lib/routing";
import { AlbumPhotos } from './Album.tsx'; import { AlbumPhotos } from "./Album.tsx";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize, getImageUrl } from "@/lib/images";
import { getSettings } from '@/content/settings/settings'; import { getSettings } from "@/content/settings/settings";
import Pagination from '../common/Pagination.astro'; import Pagination from "@/components/common/Pagination.astro";
interface Props { interface Props {
page: PhotoAlbumPage; page: PhotoAlbumPage;

View File

@@ -1,5 +1,5 @@
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks"; import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
import { JustifiedLayout } from '@immich/justified-layout-wasm'; import { JustifiedLayout } from "@immich/justified-layout-wasm";
import { LoadingSpinner } from "@/icons/jsx/loadingSpinner"; import { LoadingSpinner } from "@/icons/jsx/loadingSpinner";
export function AlbumPhotos(props: { photos: PhotoAlbumGalleryItem[] }) { export function AlbumPhotos(props: { photos: PhotoAlbumGalleryItem[] }) {

View File

@@ -1,7 +1,6 @@
--- ---
import { getAllCategories } from "@/content/photos/categories"; import { getAllCategories } from "@/content/photos/categories";
import { getSettings } from "@/content/settings/settings" import { getSettings } from "@/content/settings/settings"
import { getImageUrl } from "@/lib/images";
import { getCategoryRoute } from "@/lib/routing"; import { getCategoryRoute } from "@/lib/routing";
import { Image } from "astro:assets"; import { Image } from "astro:assets";

View File

@@ -1,14 +1,14 @@
--- ---
import { getAlbum } from '@/content/photos/albums'; import { getAlbum } from "@/content/photos/albums";
import { getSettings } from '@/content/settings/settings'; import { getSettings } from "@/content/settings/settings";
import ChevronUp from '@/icons/ChevronUp.astro'; import ChevronUp from "@/icons/ChevronUp.astro";
import Download from '@/icons/Download.astro'; import Download from "@/icons/Download.astro";
import Close from '@/icons/Close.astro'; import Close from "@/icons/Close.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize, getImageUrl } from "@/lib/images";
import { getAlbumRoute, getPhotoRoute } from '@/lib/routing'; import { getAlbumRoute, getPhotoRoute } from "@/lib/routing";
import { getImage } from 'astro:assets'; import { getImage } from "astro:assets";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
import { getPhotoHash } from '@/lib/hash'; import { getPhotoHash } from "@/lib/hash";
interface Props { interface Props {
page: PhotoPage; page: PhotoPage;

View File

@@ -1,12 +1,11 @@
--- ---
import { getSettings } from '@/content/settings/settings'; import { getSettings } from "@/content/settings/settings";
import { getAllPaginatedProjects } from '@/content/projects/projects'; import { getAllPaginatedProjects } from "@/content/projects/projects";
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
import { getProjectRoute } from '@/lib/routing'; import { getProjectRoute } from "@/lib/routing";
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize, getImageUrl } from "@/lib/images";
import { promise } from 'astro:schema';
interface Props { interface Props {
page: ProjectIndex; page: ProjectIndex;

View File

@@ -1,9 +1,9 @@
--- ---
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize } from "@/lib/images";
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { getTypographyClasses } from '@/styles/markdownClasses'; import { getTypographyClasses } from "@/styles/markdownClasses";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
project: ProjectPost; project: ProjectPost;

View File

@@ -1,6 +1,6 @@
--- ---
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
contact: ContactComponent; contact: ContactComponent;

View File

@@ -1,6 +1,6 @@
--- ---
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
equipment: EquipmentTableComponent; equipment: EquipmentTableComponent;

View File

@@ -1,6 +1,6 @@
--- ---
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { QuestionList } from '@/components/web/subcomponents/QuestionList.tsx'; import { QuestionList } from "@/components/web/subcomponents/QuestionList.tsx";
interface Props { interface Props {
faq: FrequentlyAskedQuestionsComponent; faq: FrequentlyAskedQuestionsComponent;

View File

@@ -1,5 +1,5 @@
--- ---
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
hero: HeroComponent; hero: HeroComponent;

View File

@@ -1,10 +1,10 @@
--- ---
import { getLastBlogs } from '@/content/blogs/blogs'; import { getLastBlogs } from "@/content/blogs/blogs";
import { getSettings } from '@/content/settings/settings'; import { getSettings } from "@/content/settings/settings";
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize, getImageUrl } from "@/lib/images";
import { getBlogRoute } from '@/lib/routing'; import { getBlogRoute } from "@/lib/routing";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
blogs: LastBlogsComponent; blogs: LastBlogsComponent;

View File

@@ -1,10 +1,10 @@
--- ---
import { getLastProjects } from '@/content/projects/projects'; import { getLastProjects } from "@/content/projects/projects";
import { getSettings } from '@/content/settings/settings'; import { getSettings } from "@/content/settings/settings";
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { getImageSize, getImageUrl } from '@/lib/images'; import { getImageSize, getImageUrl } from "@/lib/images";
import { getProjectRoute } from '@/lib/routing'; import { getProjectRoute } from "@/lib/routing";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
projects: LastProjectsComponent; projects: LastProjectsComponent;

View File

@@ -1,6 +1,6 @@
--- ---
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import StarRating from './subcomponents/StarRating.astro'; import StarRating from "./subcomponents/StarRating.astro";
interface Props { interface Props {
reviews: ReviewListComponent; reviews: ReviewListComponent;

View File

@@ -1,6 +1,6 @@
--- ---
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
interface Props { interface Props {
textWithImage: TextWithImageComponent; textWithImage: TextWithImageComponent;

View File

@@ -1,8 +1,8 @@
--- ---
import CalendarIcon from '@/icons/CalendarIcon.astro'; import CalendarIcon from "@/icons/CalendarIcon.astro";
import { Image } from 'astro:assets'; import { Image } from "astro:assets";
import { upcomingEvent as UpcomingEvent } from './subcomponents/UpcomingEvent'; import { upcomingEvent as UpcomingEvent } from "./subcomponents/UpcomingEvent";
import { markdownToHtml } from '@/lib/markdown'; import { markdownToHtml } from "@/lib/markdown";
interface Props { interface Props {
upcomingEvents: UpcomingEventsComponent; upcomingEvents: UpcomingEventsComponent;

View File

@@ -1,15 +1,15 @@
--- ---
import FrequentlyAskedQuestions from '../web/FrequentlyAskedQuestions.astro'; import FrequentlyAskedQuestions from '@/components/web/FrequentlyAskedQuestions.astro';
import Hero from '../web/Hero.astro'; import Hero from '@/components/web/Hero.astro';
import TextWithImage from '../web/TextWithImage.astro'; import TextWithImage from '@/components/web/TextWithImage.astro';
import UpcomingEvents from '../web/UpcomingEvents.astro'; import UpcomingEvents from '@/components/web/UpcomingEvents.astro';
import WallOfText from '../web/WallOfText.astro'; import WallOfText from '@/components/web/WallOfText.astro';
import EquipmentTable from '../web/EquipmentTable.astro'; import EquipmentTable from '@/components/web/EquipmentTable.astro';
import Reviews from '../web/Reviews.astro'; import Reviews from '@/components/web/Reviews.astro';
import LastBlogs from '../web/LastBlogs.astro'; import LastBlogs from '@/components/web/LastBlogs.astro';
import LastProjects from '../web/LastProjects.astro'; import LastProjects from '@/components/web/LastProjects.astro';
import LastAlbums from '../web/LastAlbums.astro'; import LastAlbums from '@/components/web/LastAlbums.astro';
import Contact from '../web/Contact.astro'; import Contact from '@/components/web/Contact.astro';
interface Props { interface Props {
webpage: WebpageComponent[]; webpage: WebpageComponent[];

View File

@@ -1,9 +1,9 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from 'graphql'; import { print } from "graphql";
import getBlogs from '@/graphql/blogs/getBlogs.graphql'; import getBlogs from "@/graphql/blogs/getBlogs.graphql";
import getBlogPost from '@/graphql/blogs/getBlog.graphql'; import getBlogPost from "@/graphql/blogs/getBlog.graphql";
import getLastBlogPosts from '@/graphql/blogs/getLastBlogPosts.graphql'; import getLastBlogPosts from "@/graphql/blogs/getLastBlogPosts.graphql";
import getPaginatedBlogs from '@/graphql/blogs/getPaginatedBlogs.graphql'; import getPaginatedBlogs from "@/graphql/blogs/getPaginatedBlogs.graphql";
import { formatDate } from "@/lib/dates"; import { formatDate } from "@/lib/dates";
import { getImageSize, getImageUrl } from "@/lib/images"; import { getImageSize, getImageUrl } from "@/lib/images";
import { getImage } from "astro:assets"; import { getImage } from "astro:assets";

View File

@@ -1,95 +1,95 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from 'graphql'; import { print } from "graphql";
import type { Footer, FooterColumn, FooterSecondaryLink, FooterSocial } from "@/types/footers/footer"; import type { Footer, FooterColumn, FooterSecondaryLink, FooterSocial } from "@/types/footers/footer";
import getFooterQuery from '@/graphql/footer/getFooter.graphql'; import getFooterQuery from "@/graphql/footer/getFooter.graphql";
import { getImageUrl } from "@/lib/images"; import { getImageUrl } from "@/lib/images";
export async function getFooter(): Promise<Footer> { export async function getFooter(): Promise<Footer> {
const client = await createDirectusConnection(); const client = await createDirectusConnection();
const result = await client.query(print(getFooterQuery)); const result = await client.query(print(getFooterQuery));
const footerRecord = result['Footer']; const footerRecord = result["Footer"];
let dates: string[] = [ let dates: string[] = [
footerRecord['date_created'], footerRecord["date_created"],
footerRecord['date_updated'] footerRecord["date_updated"]
]; ];
let footer: Footer = { let footer: Footer = {
id: footerRecord['id'], id: footerRecord["id"],
title: footerRecord['title'], title: footerRecord["title"],
logo: { logo: {
url: getImageUrl(footerRecord['logo']['filename_disk']), url: getImageUrl(footerRecord["logo"]["filename_disk"]),
width: footerRecord['logo']['width'], width: footerRecord["logo"]["width"],
height: footerRecord['logo']['height'] height: footerRecord["logo"]["height"]
}, },
copyright: footerRecord['copyright'], copyright: footerRecord["copyright"],
columns: [], columns: [],
socials: null, socials: null,
secondaryLinks: null, secondaryLinks: null,
lastModified: new Date() lastModified: new Date()
}; };
if (footerRecord['columns'] !== null) { if (footerRecord["columns"] !== null) {
footerRecord['columns'].forEach((footerColumn: any) => { footerRecord["columns"].forEach((footerColumn: any) => {
const column: FooterColumn = { const column: FooterColumn = {
id: footerColumn['id'], id: footerColumn["id"],
title: footerColumn['title'], title: footerColumn["title"],
links: [] links: []
}; };
footerColumn['links'].forEach((columnLink: any) => { footerColumn["links"].forEach((columnLink: any) => {
column.links.push({ column.links.push({
id: columnLink['id'], id: columnLink["id"],
text: columnLink['text'], text: columnLink["text"],
url: columnLink['url'] url: columnLink["url"]
}); });
dates.push(columnLink['date_created']); dates.push(columnLink["date_created"]);
dates.push(columnLink['date_updated']); dates.push(columnLink["date_updated"]);
}); });
footer.columns.push(column); footer.columns.push(column);
dates.push(footerColumn['date_created']); dates.push(footerColumn["date_created"]);
dates.push(footerColumn['date_updated']); dates.push(footerColumn["date_updated"]);
}); });
} }
if (footerRecord['socials'] !== null) { if (footerRecord["socials"] !== null) {
let socials: FooterSocial[] = []; let socials: FooterSocial[] = [];
footerRecord['socials'].forEach((footerSocial: any) => { footerRecord["socials"].forEach((footerSocial: any) => {
socials.push({ socials.push({
id: footerSocial['id'], id: footerSocial["id"],
name: footerSocial['name'], name: footerSocial["name"],
url: footerSocial['url'], url: footerSocial["url"],
icon: { icon: {
url: getImageUrl(footerSocial['icon']['filename_disk']), url: getImageUrl(footerSocial["icon"]["filename_disk"]),
width: footerSocial['icon']['width'], width: footerSocial["icon"]["width"],
height: footerSocial['icon']['height'] height: footerSocial["icon"]["height"]
} }
}); });
dates.push(footerSocial['date_created']); dates.push(footerSocial["date_created"]);
dates.push(footerSocial['date_updated']); dates.push(footerSocial["date_updated"]);
}); });
footer.socials = socials; footer.socials = socials;
} }
if (footerRecord['secondary_links'] !== null) { if (footerRecord["secondary_links"] !== null) {
let secondaryLinks: FooterSecondaryLink[] = []; let secondaryLinks: FooterSecondaryLink[] = [];
footerRecord['secondary_links'].forEach((footerSecondaryLink: any) => { footerRecord["secondary_links"].forEach((footerSecondaryLink: any) => {
secondaryLinks.push({ secondaryLinks.push({
id: footerSecondaryLink['id'], id: footerSecondaryLink["id"],
text: footerSecondaryLink['text'], text: footerSecondaryLink["text"],
url: footerSecondaryLink['url'] url: footerSecondaryLink["url"]
}); });
dates.push(footerSecondaryLink['date_created']); dates.push(footerSecondaryLink["date_created"]);
dates.push(footerSecondaryLink['date_updated']); dates.push(footerSecondaryLink["date_updated"]);
}); });
footer.secondaryLinks = secondaryLinks; footer.secondaryLinks = secondaryLinks;

View File

@@ -6,28 +6,28 @@ export async function getMenu(): Promise<Menu> {
const client = await createDirectusConnection(); const client = await createDirectusConnection();
const result = await client.query(print(getMenuQuery)); const result = await client.query(print(getMenuQuery));
const menuRecord = result['Menu']; const menuRecord = result["Menu"];
let menu: Menu = { let menu: Menu = {
id: menuRecord['id'], id: menuRecord["id"],
items: [] items: []
}; };
menuRecord['items'].forEach((menuItem: any) => { menuRecord["items"].forEach((menuItem: any) => {
if (menuItem['collection'] === "Menu_Column") { if (menuItem["collection"] === "Menu_Column") {
let menuColumnItem: MenuColumn = { let menuColumnItem: MenuColumn = {
id: menuItem['item']['id'], id: menuItem["item"]["id"],
type: "Column", type: "Column",
title: menuItem['item']['title'], title: menuItem["item"]["title"],
links: [] links: []
}; };
menuItem['item']['links'].forEach((menuItemLink: any) => { menuItem["item"]["links"].forEach((menuItemLink: any) => {
menuColumnItem.links.push({ menuColumnItem.links.push({
id: menuItemLink['id'], id: menuItemLink["id"],
type: "Link", type: "Link",
text: menuItemLink['text'], text: menuItemLink["text"],
url: menuItemLink['url'] url: menuItemLink["url"]
}); });
}); });

View File

@@ -1,5 +1,5 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from 'graphql'; import { print } from "graphql";
import { formatDate } from "@/lib/dates"; import { formatDate } from "@/lib/dates";
import getAllPages from "@/graphql/pages/getAllPages.graphql"; import getAllPages from "@/graphql/pages/getAllPages.graphql";
import getPage from "@/graphql/pages/getPage.graphql"; import getPage from "@/graphql/pages/getPage.graphql";

View File

@@ -1,9 +1,9 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql"; import { print } from "graphql";
import getAlbums from '@/graphql/photos/getAlbums.graphql'; import getAlbums from "@/graphql/photos/getAlbums.graphql";
import getAlbumItem from '@/graphql/photos/getAlbum.graphql'; import getAlbumItem from "@/graphql/photos/getAlbum.graphql";
import getLastAlbumsQuery from '@/graphql/photos/getLastAlbums.graphql'; import getLastAlbumsQuery from "@/graphql/photos/getLastAlbums.graphql";
import getCategoryAlbumQuery from '@/graphql/photos/getCategoryAlbum.graphql'; import getCategoryAlbumQuery from "@/graphql/photos/getCategoryAlbum.graphql";
import { formatDate } from "@/lib/dates"; import { formatDate } from "@/lib/dates";
import { getImageSize } from "@/lib/images"; import { getImageSize } from "@/lib/images";

View File

@@ -1,7 +1,7 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql"; 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 getCategory from "@/graphql/photos/getCategory.graphql";
import { getImageSize, getImageUrl } from "@/lib/images"; import { getImageSize, getImageUrl } from "@/lib/images";
export async function getAllCategories(settings: GlobalSettings): Promise<PhotoAlbumCategory[]> { export async function getAllCategories(settings: GlobalSettings): Promise<PhotoAlbumCategory[]> {

View File

@@ -1,6 +1,6 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql"; import { print } from "graphql";
import getPhotos from '@/graphql/photos/getPhotos.graphql'; import getPhotos from "@/graphql/photos/getPhotos.graphql";
import md5 from "md5"; import md5 from "md5";
export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<PhotoAlbumItem | null> { export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<PhotoAlbumItem | null> {
@@ -14,7 +14,7 @@ export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<
result["Photo_Albums"][0]["photos"].forEach((photo: any) => { result["Photo_Albums"][0]["photos"].forEach((photo: any) => {
/* /*
* I have decided to not put the getImageSize here, it can mess up the * 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. * hashing, or anything else. It seems smarter to do this in the photo"s and galleries.
*/ */
const hashObject = md5(JSON.stringify({ const hashObject = md5(JSON.stringify({

View File

@@ -1,9 +1,9 @@
import { formatDate } from "@/lib/dates"; import { formatDate } from "@/lib/dates";
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql"; import { print } from "graphql";
import getProjects from '@/graphql/projects/getProjects.graphql'; import getProjects from "@/graphql/projects/getProjects.graphql";
import getProjectPost from '@/graphql/projects/getProject.graphql'; import getProjectPost from "@/graphql/projects/getProject.graphql";
import getLastProjectsQuery from '@/graphql/projects/getLastProjects.graphql'; import getLastProjectsQuery from "@/graphql/projects/getLastProjects.graphql";
import { getImageSize, getImageUrl } from "@/lib/images"; import { getImageSize, getImageUrl } from "@/lib/images";
import { getImage } from "astro:assets"; import { getImage } from "astro:assets";

View File

@@ -1,6 +1,6 @@
import { createDirectusConnection } from "@/lib/directus"; import { createDirectusConnection } from "@/lib/directus";
import { print } from 'graphql'; import { print } from "graphql";
import getRobotsQuery from '@/graphql/settings/robots.graphql'; import getRobotsQuery from "@/graphql/settings/robots.graphql";
export async function getRobotsSettings(): Promise<RobotsSettings> { export async function getRobotsSettings(): Promise<RobotsSettings> {
const client = await createDirectusConnection(); const client = await createDirectusConnection();

View File

@@ -1,6 +1,6 @@
import { print } from 'graphql'; import { print } from "graphql";
import { createDirectusConnection } from "@/lib/directus"; 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> { export async function getSettings(): Promise<GlobalSettings> {
const client = await createDirectusConnection(); const client = await createDirectusConnection();

View File

@@ -1,8 +1,8 @@
--- ---
import '@/styles/global.css'; import "@/styles/global.css";
import { getSettings } from "@/content/settings/settings"; import { getSettings } from "@/content/settings/settings";
import { getTextColor } from '@/lib/colors'; import { getTextColor } from "@/lib/colors";
import Footer from '@/components/footer/Footer.astro'; import Footer from "@/components/footer/Footer.astro";
interface Props { interface Props {
settings: BlogLayoutProps; settings: BlogLayoutProps;
@@ -43,7 +43,7 @@ const css = {
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" /> <link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" />
<link rel="canonical" href={`${settings.website.domainName}/`} /> <link rel="canonical" href={`${settings.website.domainName}/`} />
<meta name="robots" content="index,follow" /> <meta name="robots" content="index,follow" />
<meta name="keywords" content={tags.join(',')} /> <meta name="keywords" content={tags.join(",")} />
<!-- Low Priority Page Metadata --> <!-- Low Priority Page Metadata -->
<meta name="description" content={pageSettings.description} /> <meta name="description" content={pageSettings.description} />
@@ -56,7 +56,7 @@ const css = {
<meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} /> <meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} />
<meta property="og:site_name" content={settings.website.applicationName} /> <meta property="og:site_name" content={settings.website.applicationName} />
<meta property="article:author" content={settings.website.author.name} /> <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:card" content="summary_large_image" />
<meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} /> <meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} />

View File

@@ -2,7 +2,6 @@
import '@/styles/global.css'; import '@/styles/global.css';
import { getSettings } from "@/content/settings/settings"; import { getSettings } from "@/content/settings/settings";
import { getTextColor } from '@/lib/colors'; import { getTextColor } from '@/lib/colors';
import Footer from '@/components/footer/Footer.astro';
import { getImageSize } from '@/lib/images'; import { getImageSize } from '@/lib/images';
import { getImage } from 'astro:assets'; import { getImage } from 'astro:assets';

View File

@@ -1,8 +1,8 @@
--- ---
import '@/styles/global.css'; import "@/styles/global.css";
import { getSettings } from "@/content/settings/settings"; import { getSettings } from "@/content/settings/settings";
import { getTextColor } from '@/lib/colors'; import { getTextColor } from "@/lib/colors";
import Footer from '@/components/footer/Footer.astro'; import Footer from "@/components/footer/Footer.astro";
interface Props { interface Props {
settings: BlogLayoutProps; settings: BlogLayoutProps;
@@ -42,7 +42,7 @@ const css = {
<link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" /> <link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS" />
<link rel="canonical" href={`${settings.website.domainName}/`} /> <link rel="canonical" href={`${settings.website.domainName}/`} />
<meta name="robots" content="index,follow" /> <meta name="robots" content="index,follow" />
<meta name="keywords" content={[].join(',')} /> <meta name="keywords" content={[].join(",")} />
<!-- Low Priority Page Metadata --> <!-- Low Priority Page Metadata -->
<meta name="description" content={pageSettings.description} /> <meta name="description" content={pageSettings.description} />
@@ -55,7 +55,7 @@ const css = {
<meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} /> <meta property="og:url" content={`${settings.website.domainName}${Astro.url.pathname}`} />
<meta property="og:site_name" content={settings.website.applicationName} /> <meta property="og:site_name" content={settings.website.applicationName} />
<meta property="article:author" content={settings.website.author.name} /> <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:card" content="summary_large_image" />
<meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} /> <meta name="twitter:title" content={settings.website.titleTemplate.replaceAll("%T", pageSettings.title)} />

View File

@@ -1,8 +1,8 @@
--- ---
import '@/styles/global.css'; import "@/styles/global.css";
import { getSettings } from "@/content/settings/settings"; import { getSettings } from "@/content/settings/settings";
import { getTextColor } from '@/lib/colors'; import { getTextColor } from "@/lib/colors";
import Footer from '@/components/footer/Footer.astro'; import Footer from "@/components/footer/Footer.astro";
interface Props { interface Props {
settings: WebpageLayoutProps; settings: WebpageLayoutProps;

View File

@@ -1,6 +1,6 @@
export function getTextColor(bgColor: string) { export function getTextColor(bgColor: string) {
// Remove # if present // Remove # if present
const hex = bgColor.replace('#', ''); const hex = bgColor.replace("#", "");
// Convert hex to RGB // Convert hex to RGB
const r = parseInt(hex.substring(0, 2), 16) / 255; 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; const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;
// Return white for dark backgrounds, black for light backgrounds // Return white for dark backgrounds, black for light backgrounds
return luminance > 0.179 ? '#000000' : '#fcfcfc'; return luminance > 0.179 ? "#000000" : "#fcfcfc";
} }

View File

@@ -1,6 +1,6 @@
export function formatDate(date: Date, format: string) { export function formatDate(date: Date, format: string) {
return format return format
.replaceAll("%Y", date.getFullYear().toString()) .replaceAll("%Y", date.getFullYear().toString())
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0')) .replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
.replaceAll("%D", date.getDate().toString().padStart(2, '0')); .replaceAll("%D", date.getDate().toString().padStart(2, "0"));
} }

View File

@@ -204,7 +204,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
width: resizedThumbnail.width, width: resizedThumbnail.width,
height: resizedThumbnail.height height: resizedThumbnail.height
}, },
pageNumber: params["page"] !== undefined ? Number(params['page']) : 1 pageNumber: params["page"] !== undefined ? Number(params["page"]) : 1
} }
}; };
} }

View File

@@ -2,7 +2,7 @@ import { getAllBlogs } from "@/content/blogs/blogs";
import { getAllWebpages } from "@/content/pages/pages"; import { getAllWebpages } from "@/content/pages/pages";
import { getAllAlbums } from "@/content/photos/albums"; import { getAllAlbums } from "@/content/photos/albums";
import { getAllProjects } from "@/content/projects/projects"; import { getAllProjects } from "@/content/projects/projects";
import { getPhotoHash } from "./hash"; import { getPhotoHash } from "@/lib/hash";
import { getAllCategories } from "@/content/photos/categories"; import { getAllCategories } from "@/content/photos/categories";
export async function getAllRoutesList(settings: GlobalSettings): Promise<string[]> { export async function getAllRoutesList(settings: GlobalSettings): Promise<string[]> {
@@ -99,10 +99,10 @@ export function getBlogRoute(blogSettings: BlogSettings, blog: BlogPost) {
return blogSettings.blogRouteTemplate return blogSettings.blogRouteTemplate
.replaceAll("%Y", date.getFullYear().toString()) .replaceAll("%Y", date.getFullYear().toString())
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0')) .replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
.replaceAll("%D", date.getDate().toString().padStart(2, '0')) .replaceAll("%D", date.getDate().toString().padStart(2, "0"))
.replaceAll("%R", blog.url) .replaceAll("%R", blog.url)
.replace(/\/+/g, '/'); .replace(/\/+/g, "/");
} }
export function getProjectRoute(projectSettings: ProjectSettings, project: ProjectPost) { export function getProjectRoute(projectSettings: ProjectSettings, project: ProjectPost) {
@@ -110,16 +110,16 @@ export function getProjectRoute(projectSettings: ProjectSettings, project: Proje
return projectSettings.projectRouteTemplate return projectSettings.projectRouteTemplate
.replaceAll("%Y", date.getFullYear().toString()) .replaceAll("%Y", date.getFullYear().toString())
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0')) .replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
.replaceAll("%D", date.getDate().toString().padStart(2, '0')) .replaceAll("%D", date.getDate().toString().padStart(2, "0"))
.replaceAll("%R", project.url) .replaceAll("%R", project.url)
.replace(/\/+/g, '/'); .replace(/\/+/g, "/");
} }
export function getCategoryRoute(photoSettings: WebsitePhotoSettings, category: PhotoAlbumCategory) { export function getCategoryRoute(photoSettings: WebsitePhotoSettings, category: PhotoAlbumCategory) {
return photoSettings.category.routeTemplate return photoSettings.category.routeTemplate
.replaceAll("%C", category.url) .replaceAll("%C", category.url)
.replace(/\/+/g, '/'); .replace(/\/+/g, "/");
} }
export function getAlbumRoute(photoSettings: WebsitePhotoSettings, album: PhotoAlbum) { export function getAlbumRoute(photoSettings: WebsitePhotoSettings, album: PhotoAlbum) {
@@ -127,11 +127,11 @@ export function getAlbumRoute(photoSettings: WebsitePhotoSettings, album: PhotoA
return photoSettings.album.routeTemplate return photoSettings.album.routeTemplate
.replaceAll("%Y", date.getFullYear().toString()) .replaceAll("%Y", date.getFullYear().toString())
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0')) .replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
.replaceAll("%D", date.getDate().toString().padStart(2, '0')) .replaceAll("%D", date.getDate().toString().padStart(2, "0"))
.replaceAll("%C", album.category.url) .replaceAll("%C", album.category.url)
.replaceAll("%R", album.url) .replaceAll("%R", album.url)
.replace(/\/+/g, '/'); .replace(/\/+/g, "/");
} }
export function getPhotoRoute(photoSettings: WebsitePhotoSettings, album: PhotoAlbum, photo: PhotoAlbumPhoto) { export function getPhotoRoute(photoSettings: WebsitePhotoSettings, album: PhotoAlbum, photo: PhotoAlbumPhoto) {
@@ -139,10 +139,10 @@ export function getPhotoRoute(photoSettings: WebsitePhotoSettings, album: PhotoA
return photoSettings.photo.routeTemplate return photoSettings.photo.routeTemplate
.replaceAll("%Y", date.getFullYear().toString()) .replaceAll("%Y", date.getFullYear().toString())
.replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, '0')) .replaceAll("%M", (date.getMonth() + 1).toString().padStart(2, "0"))
.replaceAll("%D", date.getDate().toString().padStart(2, '0')) .replaceAll("%D", date.getDate().toString().padStart(2, "0"))
.replaceAll("%C", album.category.url) .replaceAll("%C", album.category.url)
.replaceAll("%R", album.url) .replaceAll("%R", album.url)
.replaceAll("%H", getPhotoHash(photo)) .replaceAll("%H", getPhotoHash(photo))
.replace(/\/+/g, '/'); .replace(/\/+/g, "/");
} }

View File

@@ -5,7 +5,7 @@ import { getSettings } from "@/content/settings/settings"
import WebpageLayout from "@/layouts/WebpageLayout.astro"; import WebpageLayout from "@/layouts/WebpageLayout.astro";
import BlogLayout from "@/layouts/BlogLayout.astro"; import BlogLayout from "@/layouts/BlogLayout.astro";
import ProjectLayout from "@/layouts/ProjectLayout.astro"; import ProjectLayout from "@/layouts/ProjectLayout.astro";
import PhotoLayout from '@/layouts/PhotoLayout.astro'; import PhotoLayout from "@/layouts/PhotoLayout.astro";
import BlogIndex from "@/components/blogs/BlogIndex.astro"; import BlogIndex from "@/components/blogs/BlogIndex.astro";
import ProjectIndex from "@/components/projects/ProjectIndex.astro"; import ProjectIndex from "@/components/projects/ProjectIndex.astro";
import Webpage from "@/components/webpage/Webpage.astro"; import Webpage from "@/components/webpage/Webpage.astro";

View File

@@ -7,8 +7,8 @@ export const GET = (async () => {
const robots = await getRobotsSettings(); const robots = await getRobotsSettings();
let crawlers = [ let crawlers = [
{ id: 'google', name: 'Googlebot' }, { id: "google", name: "Googlebot" },
{ id: 'bing', name: "Bingbot" }, { id: "bing", name: "Bingbot" },
{ id: "slurp", name: "Slurp" }, { id: "slurp", name: "Slurp" },
{ id: "duckduckgo", name: "DuckDuckBot" }, { id: "duckduckgo", name: "DuckDuckBot" },
{ id: "baidu", name: "Baiduspider" }, { id: "baidu", name: "Baiduspider" },

View File

@@ -39,7 +39,7 @@ export const GET = (async ({ params }) => {
<loc>${settings.website.domainName}${page.url}</loc> <loc>${settings.website.domainName}${page.url}</loc>
<lastmod>${page.lastModified.toISOString()}</lastmod> <lastmod>${page.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -54,7 +54,7 @@ export const GET = (async () => {
<loc>${settings.website.domainName}${item.url}</loc> <loc>${settings.website.domainName}${item.url}</loc>
<lastmod>${item.lastModified.toISOString()}</lastmod> <lastmod>${item.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -39,7 +39,7 @@ export const GET = (async ({ params }) => {
<loc>${settings.website.domainName}${page.url}</loc> <loc>${settings.website.domainName}${page.url}</loc>
<lastmod>${page.lastModified.toISOString()}</lastmod> <lastmod>${page.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -54,7 +54,7 @@ export const GET = (async () => {
<loc>${settings.website.domainName}${item.url}</loc> <loc>${settings.website.domainName}${item.url}</loc>
<lastmod>${item.lastModified.toISOString()}</lastmod> <lastmod>${item.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -90,7 +90,7 @@ export const GET = (async () => {
<loc>${settings.website.domainName}${item.url}</loc> <loc>${settings.website.domainName}${item.url}</loc>
<lastmod>${item.lastModified.toISOString()}</lastmod> <lastmod>${item.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -33,7 +33,7 @@ export const GET = (async ({ params }) => {
<loc>${settings.website.domainName}${page.url}</loc> <loc>${settings.website.domainName}${page.url}</loc>
<lastmod>${page.lastModified.toISOString()}</lastmod> <lastmod>${page.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -28,7 +28,7 @@ export const GET = (async () => {
<loc>${settings.website.domainName}${item.url}</loc> <loc>${settings.website.domainName}${item.url}</loc>
<lastmod>${item.lastModified.toISOString()}</lastmod> <lastmod>${item.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -39,7 +39,7 @@ export const GET = (async ({ params }) => {
<loc>${settings.website.domainName}${page.url}</loc> <loc>${settings.website.domainName}${page.url}</loc>
<lastmod>${page.lastModified.toISOString()}</lastmod> <lastmod>${page.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;

View File

@@ -54,7 +54,7 @@ export const GET = (async () => {
<loc>${settings.website.domainName}${item.url}</loc> <loc>${settings.website.domainName}${item.url}</loc>
<lastmod>${item.lastModified.toISOString()}</lastmod> <lastmod>${item.lastModified.toISOString()}</lastmod>
</sitemap> </sitemap>
`).join('')} `).join("")}
</sitemapindex> </sitemapindex>
`; `;