Migrate to dayjs and Astro 4.0

This commit is contained in:
2023-12-07 00:17:32 +01:00
parent 505ee26622
commit 311856415e
24 changed files with 731 additions and 980 deletions

View File

@@ -2,11 +2,11 @@
import { getCollection } from "astro:content"
import PageLayout from "../../layouts/PageLayout.astro";
import {astroI18n, t} from "astro-i18n";
import moment from "moment";
import PostComponent from "../../components/PostComponent.astro";
import * as dayjs from "dayjs";
const posts = (await getCollection("announcements", (entry) => entry.id.split("/")[0] === astroI18n.locale))
.sort((a, b) => moment(b.data.created).unix() - moment(a.data.created).unix());
.sort((a, b) => dayjs(b.data.created).unix() - dayjs(a.data.created).unix());
---

View File

@@ -1,16 +1,15 @@
---
import moment from "moment/moment";
import {CollectionEntry} from "astro:content";
import {astroI18n, createGetStaticPaths, t} from "astro-i18n";
import {getCollection} from "astro:content";
import PageLayout from "../../../layouts/PageLayout.astro";
import {l} from "../../../util/util";
import {capitalize} from "../../../components/admin/util";
import PostComponent from "../../../components/PostComponent.astro";
import * as dayjs from "dayjs";
export const getStaticPaths = createGetStaticPaths(async () => {
const posts = (await getCollection('announcements', entry => entry.id.split("/")[0] === astroI18n.locale))
.sort((a, b) => moment(b.data.created).unix() - moment(a.data.created).unix());
.sort((a, b) => dayjs(b.data.created).unix() - dayjs(a.data.created).unix());
let groupedByTags: Record<string, CollectionEntry<'announcements'>[]> = {}
posts.forEach(post => {

View File

@@ -41,8 +41,7 @@ function mapMap<T, K, J>(i: Map<T, K>, fn: (key: T, value: K) => J): J[] {
<Image src={localBau} alt="Bau" width="1920" height="1080" class="w-screen object-cover rounded-b-2xl shadow-2xl dark:brightness-75" style="height: calc(100vh + 1rem)" draggable="false" />
<drop-in class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center">
<h1 class="text-4xl sm:text-6xl md:text-8xl font-extrabold text-white -translate-y-16 opacity-0 barlow" style="transition: transform .7s ease-out, opacity .7s linear; text-shadow: 2px 2px 5px black;">
<span class="text-yellow-400">{t("home.title.first")}</span>
<span class="text-neutral-600">{t("home.title.second")}</span>
<span class="text-yellow-400">{t("home.title.first")}</span><span class="text-neutral-600">{t("home.title.second")}</span>
</h1>
<text-carousel class="h-20 w-full relative select-none">
<h2 class="-translate-y-16">{t("home.subtitle.1")}</h2>