From a2687083e027c616bec513724f6fa66a711eebd4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 24 Dec 2023 23:00:20 +0100 Subject: [PATCH] Images --- src/components/EloTable.svelte | 2 +- src/components/GroupTable.svelte | 4 +- .../admin/components/TypeAheadSearch.svelte | 2 +- src/components/admin/pages/Perms.svelte | 2 +- .../admin/pages/event/FightList.svelte | 2 +- .../admin/pages/event/TeamList.svelte | 2 +- .../event/modals/CreateFightModal.svelte | 2 +- .../pages/generate/GroupGenerator.svelte | 22 +++---- src/components/dashboard/SchematicList.svelte | 4 +- src/components/util.ts | 2 +- .../announcements/de/microneujahrsevent.md | 1 + src/layouts/Basic.astro | 7 +++ src/layouts/NavbarLayout.astro | 4 +- src/layouts/PageLayout.astro | 9 +-- src/pages/announcements/[...slug].astro | 60 +++++++++++++++---- steamwarci.yml | 4 ++ 16 files changed, 91 insertions(+), 38 deletions(-) diff --git a/src/components/EloTable.svelte b/src/components/EloTable.svelte index 3cf7ddd..94c53bc 100644 --- a/src/components/EloTable.svelte +++ b/src/components/EloTable.svelte @@ -40,7 +40,7 @@ {t("elo.name")} {t("elo.elo")} - {#each data as player, i} + {#each data as player, i (player.id)} {`${i + 1}.`} {player.name} diff --git a/src/components/GroupTable.svelte b/src/components/GroupTable.svelte index 4a14cda..3d50299 100644 --- a/src/components/GroupTable.svelte +++ b/src/components/GroupTable.svelte @@ -49,14 +49,14 @@
- {#each Array(rows) as _} + {#each Array(rows) as i (i)} {/each} {#each window(teamPoints, rows) as teams} - {#each teams as team} + {#each teams as team (team.team.id)} {/each} diff --git a/src/components/admin/components/TypeAheadSearch.svelte b/src/components/admin/components/TypeAheadSearch.svelte index e968723..2e46758 100644 --- a/src/components/admin/components/TypeAheadSearch.svelte +++ b/src/components/admin/components/TypeAheadSearch.svelte @@ -40,7 +40,7 @@
open = true} on:keydown={() => open = true}/>
- {#each filteredItems as item} + {#each filteredItems as item (item)} diff --git a/src/components/admin/pages/Perms.svelte b/src/components/admin/pages/Perms.svelte index 1b276f5..8e32c18 100644 --- a/src/components/admin/pages/Perms.svelte +++ b/src/components/admin/pages/Perms.svelte @@ -102,7 +102,7 @@ {#if filteredPlayers.length < 100} {/if} - {#each pagedSchematics as schem} + {#each pagedSchematics as schem (schem.id)} {/each} diff --git a/src/components/util.ts b/src/components/util.ts index e52e644..9259500 100644 --- a/src/components/util.ts +++ b/src/components/util.ts @@ -18,7 +18,7 @@ */ export function window(arr: T[], len: number): T[][] { - let result: T[][] = []; + const result: T[][] = []; for (let i = 0; i < arr.length; i += len) { result.push(arr.slice(i, i + len)); } diff --git a/src/content/announcements/de/microneujahrsevent.md b/src/content/announcements/de/microneujahrsevent.md index 5e5954c..c1c3319 100644 --- a/src/content/announcements/de/microneujahrsevent.md +++ b/src/content/announcements/de/microneujahrsevent.md @@ -6,6 +6,7 @@ created: 2023-12-03 tags: - event - microwargear +image: ../../../images/bau.jpg --- Liebe Community! diff --git a/src/layouts/Basic.astro b/src/layouts/Basic.astro index 42dd6d1..3564d8d 100644 --- a/src/layouts/Basic.astro +++ b/src/layouts/Basic.astro @@ -20,6 +20,13 @@ const iconImage = await getImage({src: icon, height: 32, width: 32, format: "png ({ + hrefLang: locale, + href: `/${locale}/` + }))} /> diff --git a/src/layouts/NavbarLayout.astro b/src/layouts/NavbarLayout.astro index cd65b72..04a41a8 100644 --- a/src/layouts/NavbarLayout.astro +++ b/src/layouts/NavbarLayout.astro @@ -9,10 +9,10 @@ import {l} from "../util/util"; import ServerStatus from "../components/ServerStatus.svelte"; -const { title } = Astro.props; +const { title, description } = Astro.props; --- - +
diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro index 5fe3f91..7c172b7 100644 --- a/src/layouts/PageLayout.astro +++ b/src/layouts/PageLayout.astro @@ -3,12 +3,13 @@ import NavbarLayout from "./NavbarLayout.astro"; import localBau from "../images/2023-10-08_20.43.43.png"; import { Image } from "astro:assets"; -const { title } = Astro.props; +const { title, description, image } = Astro.props; --- - - -
+ +
diff --git a/src/pages/announcements/[...slug].astro b/src/pages/announcements/[...slug].astro index a019b41..a1b148a 100644 --- a/src/pages/announcements/[...slug].astro +++ b/src/pages/announcements/[...slug].astro @@ -5,6 +5,9 @@ import PageLayout from "../../layouts/PageLayout.astro"; import {TagSolid, CalendarMonthSolid} from "flowbite-svelte-icons"; import TagComponent from "../../components/TagComponent.astro"; import LanguageWarning from "../../components/LanguageWarning.astro"; +import { SEO } from "astro-seo"; +import localBau from "../../images/2022-03-28_13.18.25.png"; +import {getImage, Image} from "astro:assets"; export const getStaticPaths = createGetStaticPaths(async () => { const posts = await getCollection("announcements", entry => entry.id.split("/")[0] === astroI18n.locale); @@ -37,18 +40,49 @@ interface Props { const {post, german} = Astro.props; const { Content } = await post.render(); + +const ogImage = await getImage({ + src: post.data.image || localBau, + format: "png", + width: 1200, + height: 630, +}); + --- - + + + +
-

{post.data.title}

-
{post.data.tags.map(tag => ( - - ))} {Intl.DateTimeFormat(astroI18n.locale, { - day: "numeric", - month: "short", - year: "numeric" - }).format(post.data.created)}
+
+ {post.data.image && ( + + )} +
+

{post.data.title}

+
{post.data.tags.map(tag => ( + + ))} {Intl.DateTimeFormat(astroI18n.locale, { + day: "numeric", + month: "short", + year: "numeric" + }).format(post.data.created)}
+
+
{german && ( )} @@ -56,7 +90,7 @@ const { Content } = await post.render();
{t("announcements.table.team")} {t("announcements.table.points")}
{team.team.name} {team.points}