diff --git a/src/content/projects/plantarium/_components/leaves.ts b/src/content/projects/plantarium/_components/leaves.ts
index 27da6bb..0fba6be 100644
--- a/src/content/projects/plantarium/_components/leaves.ts
+++ b/src/content/projects/plantarium/_components/leaves.ts
@@ -50,6 +50,7 @@ export function createLeaves({ canvas, num = 20, alpha = false, minZ = -1, maxZ
const model = await GLTFLoader.load(gl, "/models/leaf.glb");
+ // @ts-ignore
const data = model.nodes[0].children[0].geometry.attributes;
let offset = new Float32Array(num * 3);
diff --git a/src/helpers/exif.ts b/src/helpers/exif.ts
index 453463a..9f5b9eb 100644
--- a/src/helpers/exif.ts
+++ b/src/helpers/exif.ts
@@ -1,3 +1,6 @@
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
+// @ts-nocheck
+
let debug = true;
let EXIF = {};
diff --git a/src/helpers/normalizeWheel.ts b/src/helpers/normalizeWheel.ts
index 85b65b5..5bdd30e 100644
--- a/src/helpers/normalizeWheel.ts
+++ b/src/helpers/normalizeWheel.ts
@@ -1,3 +1,4 @@
+//@ts-nocheck
// Reasonable defaults
var PIXEL_STEP = 10;
diff --git a/src/i18n/utils.ts b/src/i18n/utils.ts
index f5c4c1c..9708579 100644
--- a/src/i18n/utils.ts
+++ b/src/i18n/utils.ts
@@ -1,18 +1,15 @@
import { defaultLocale, getLocale } from 'astro-i18n-aut';
import { ui, defaultLang, showDefaultLang } from './ui';
-import type { AstroGlobal } from 'astro';
-
-export function useTranslatedPath(astro: AstroGlobal) {
- const locale = getLocale(astro.url);
+export function useTranslatedPath(url: URL) {
+ const locale = getLocale(url);
return function translatePath(path: string, l: string = locale) {
return !showDefaultLang && l === defaultLang ? path : `/${l}${path}`.replace(/\/$/g, '');
}
-
}
-export function useTranslations(astro: AstroGlobal) {
- const lang = getLocale(astro.url);
+export function useTranslations(url: URL) {
+ const lang = getLocale(url);
return function t(key: keyof typeof ui[typeof defaultLang]) {
return ui[lang as keyof typeof ui][key] || ui[defaultLang][key];
}
@@ -25,11 +22,11 @@ export function parseSlug(id: string) {
return [splitPath.join("/"), lang]
}
-export function filterCollection
(collection: T[], locale: string): T[] {
+export function filterCollection(collection: T[], locale: string): T[] {
return collection.filter(post => {
const [_, lang] = parseSlug(post?.id);
return lang === locale;
}).sort((a, b) => {
- return a.data.date > b.data.date ? -1 : 1;
+ return (a?.data?.date > b?.data?.date) ? -1 : 1;
});
}
diff --git a/src/layouts/Post.astro b/src/layouts/Post.astro
index 5823920..49bc7ca 100644
--- a/src/layouts/Post.astro
+++ b/src/layouts/Post.astro
@@ -10,7 +10,7 @@ type CustomProps = {
type Props = CollectionEntry<"blog">["data"] & CustomProps;
const { title, date, _layout, backlink = "/blog" } = Astro.props;
-const path = useTranslatedPath(Astro);
+const path = useTranslatedPath(Astro.url);
---
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 333478e..4afeeef 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -19,8 +19,8 @@ const projects = filterCollection(
getLocale(Astro.url),
);
-const t = useTranslations(Astro);
-const tp = useTranslatedPath(Astro);
+const t = useTranslations(Astro.url);
+const tp = useTranslatedPath(Astro.url);
const featuredProject = projects.find((project) => project.data?.featured);
const otherProjects = projects
diff --git a/src/pages/projects/index.astro b/src/pages/projects/index.astro
index 90f379b..de3eea4 100644
--- a/src/pages/projects/index.astro
+++ b/src/pages/projects/index.astro
@@ -8,7 +8,7 @@ import HeroCard from "@components/HeroCard.astro";
const locale = getLocale(Astro.url);
const pages = await getCollection("projects");
const posts = filterCollection(pages, locale)
- .sort((a, b) => b.data.date - a.data.date)
+ .sort((a, b) => (b.data.date > a.data.date ? 1 : -1))
.sort((a) => (a.data.featured ? -1 : 1));
---
diff --git a/src/pages/tag/[tag].astro b/src/pages/tag/[tag].astro
index 920c18d..f3aca84 100644
--- a/src/pages/tag/[tag].astro
+++ b/src/pages/tag/[tag].astro
@@ -3,28 +3,24 @@ import Layout from "@layouts/Layout.astro";
import { getCollection } from "astro:content";
import { useTranslatedPath } from "@i18n/utils";
-const collections = ["blog", "photos", "projects"];
+const collections = ["blog", "photos", "projects"] as const;
-const tp = useTranslatedPath(Astro);
+const tp = useTranslatedPath(Astro.url);
export async function getStaticPaths() {
-const collections = ["blog", "photos", "projects"];
-const posts = await Promise.all(
- collections.map((collection) => {
- return getCollection(collection, {
- fields: ["slug", "title", "date", "tags"],
+ const collections = ["blog", "photos", "projects"] as const;
+ const posts = await Promise.all(
+ collections.map((collection) => getCollection(collection)),
+ );
+
+ const tags = new Set();
+
+ posts.flat().forEach((post) => {
+ if (!post.data?.tags) return;
+ post.data.tags.forEach((tag: string) => {
+ tags.add(tag.toLowerCase());
});
- }),
-);
-
-const tags = new Set();
-
-posts.flat().forEach((post) => {
- if (!post.data?.tags) return;
- post.data.tags.forEach((tag) => {
- tags.add(tag.toLowerCase());
});
-});
return [...tags.values()].map((tag) => {
return {
@@ -37,22 +33,17 @@ posts.flat().forEach((post) => {
const { tag } = Astro.params;
-
-const allPosts = (await Promise.all(
- collections.map((collection) => {
- return getCollection(collection, {
- fields: ["slug", "title", "date", "tags"],
- });
- }),
-)).flat();
-
-
+const allPosts = (
+ await Promise.all(
+ collections.map((collection) => {
+ return getCollection(collection);
+ }),
+ )
+).flat();
const posts = allPosts.filter((post) => {
- return post.data?.tags?.find(t => t.toLowerCase() === tag);
+ return post.data?.tags?.find((t) => t.toLowerCase() === tag);
});
-
-
---
@@ -62,10 +53,13 @@ const posts = allPosts.filter((post) => {
-
diff --git a/src/pages/tag/index.astro b/src/pages/tag/index.astro
index 872f227..6387a18 100644
--- a/src/pages/tag/index.astro
+++ b/src/pages/tag/index.astro
@@ -3,15 +3,13 @@ import Layout from "@layouts/Layout.astro";
import { getCollection } from "astro:content";
import { useTranslatedPath } from "@i18n/utils";
-const tp = useTranslatedPath(Astro);
+const tp = useTranslatedPath(Astro.url);
-const collections = ["blog", "photos", "projects"];
+const collections = ["blog", "photos", "projects"] as const;
const posts = await Promise.all(
collections.map((collection) => {
- return getCollection(collection, {
- fields: ["slug", "title", "date", "tags"],
- });
+ return getCollection(collection);
}),
);