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 { 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';
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;

View File

@@ -1,10 +1,8 @@
---
import CalendarIcon from '@/icons/CalendarIcon.astro';
import { getImageSize, getImageUrl } from '@/lib/images';
import { markdownToHtml } from '@/lib/markdown';
import { getTypographyClasses } from '@/styles/markdownClasses';
import { Image } from 'astro:assets';
import LastBlogs from '../web/LastBlogs.astro';
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;

View File

@@ -1,9 +1,9 @@
---
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 '../common/Pagination.astro';
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;

View File

@@ -1,5 +1,5 @@
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";
export function AlbumPhotos(props: { photos: PhotoAlbumGalleryItem[] }) {

View File

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

View File

@@ -1,14 +1,14 @@
---
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';
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;

View File

@@ -1,12 +1,11 @@
---
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';
import { promise } from 'astro:schema';
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;

View File

@@ -1,9 +1,9 @@
---
import CalendarIcon from '@/icons/CalendarIcon.astro';
import { getImageSize, getImageUrl } from '@/lib/images';
import { markdownToHtml } from '@/lib/markdown';
import { getTypographyClasses } from '@/styles/markdownClasses';
import { Image } from 'astro:assets';
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;

View File

@@ -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 {
contact: ContactComponent;

View File

@@ -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;

View File

@@ -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;

View File

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

View File

@@ -1,10 +1,10 @@
---
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';
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;

View File

@@ -1,10 +1,10 @@
---
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';
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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,15 +1,15 @@
---
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 LastAlbums from '../web/LastAlbums.astro';
import Contact from '../web/Contact.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[];

View File

@@ -1,9 +1,9 @@
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 getPaginatedBlogs from '@/graphql/blogs/getPaginatedBlogs.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";

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
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";

View File

@@ -1,9 +1,9 @@
import { createDirectusConnection } from "@/lib/directus";
import { print } from "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 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";

View File

@@ -1,7 +1,7 @@
import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql";
import getCategories from '@/graphql/photos/getCategories.graphql';
import getCategory from '@/graphql/photos/getCategory.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[]> {

View File

@@ -1,6 +1,6 @@
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<PhotoAlbumItem | null> {
@@ -14,7 +14,7 @@ export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<
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.
* hashing, or anything else. It seems smarter to do this in the photo"s and galleries.
*/
const hashObject = md5(JSON.stringify({

View File

@@ -1,9 +1,9 @@
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";

View File

@@ -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();

View File

@@ -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();

View File

@@ -1,8 +1,8 @@
---
import '@/styles/global.css';
import "@/styles/global.css";
import { getSettings } from "@/content/settings/settings";
import { getTextColor } from '@/lib/colors';
import Footer from '@/components/footer/Footer.astro';
import { getTextColor } from "@/lib/colors";
import Footer from "@/components/footer/Footer.astro";
interface Props {
settings: BlogLayoutProps;
@@ -43,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={tags.join(',')} />
<meta name="keywords" content={tags.join(",")} />
<!-- Low Priority Page Metadata -->
<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: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)} />

View File

@@ -2,7 +2,6 @@
import '@/styles/global.css';
import { getSettings } from "@/content/settings/settings";
import { getTextColor } from '@/lib/colors';
import Footer from '@/components/footer/Footer.astro';
import { getImageSize } from '@/lib/images';
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 { getTextColor } from '@/lib/colors';
import Footer from '@/components/footer/Footer.astro';
import { getTextColor } from "@/lib/colors";
import Footer from "@/components/footer/Footer.astro";
interface Props {
settings: BlogLayoutProps;
@@ -42,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} />
@@ -55,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)} />

View File

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

View File

@@ -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";
}

View File

@@ -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"));
}

View File

@@ -204,7 +204,7 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
width: resizedThumbnail.width,
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 { 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[]> {
@@ -99,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) {
@@ -110,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) {
@@ -127,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) {
@@ -139,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, "/");
}

View File

@@ -5,7 +5,7 @@ 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 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";

View File

@@ -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" },

View File

@@ -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>
`;

View File

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

View File

@@ -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>
`;

View File

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

View File

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

View File

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

View File

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

View File

@@ -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>
`;

View File

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