feat: add highlighted project
All checks were successful
deploy / deploy (push) Successful in 48s

This commit is contained in:
ndsboy 2025-09-13 16:24:53 +00:00
parent dd8a2da23a
commit 9f5455c5ec
15 changed files with 1163 additions and 752 deletions

View file

@ -10,7 +10,7 @@ export default defineConfig({
},
integrations: [sitemap()],
image: {
domains: ["directus.swablab.de", "files.mastodon.social"],
domains: ["directus.swablab.de", "files.mastodon.social", "wiki.swablab.de"],
service: passthroughImageService(),
},
vite: {

1796
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,15 +9,15 @@
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/sitemap": "^3.3.1",
"@fontsource-variable/ubuntu-sans": "^5.2.7",
"@astrojs/sitemap": "^3.5.1",
"@fontsource-variable/ubuntu-sans": "^5.2.9",
"@iconify-json/ph": "^1.2.2",
"@iconify/tailwind4": "^1.0.6",
"@tailwindcss/typography": "^0.5.16",
"@tailwindcss/vite": "^4.1.5",
"astro": "^5.7.12",
"daisyui": "^5.0.35",
"tailwindcss": "^4.0.14"
"@tailwindcss/vite": "^4.1.13",
"astro": "^5.13.7",
"daisyui": "^5.1.10",
"tailwindcss": "^4.1.13"
},
"prettier": {
"tabWidth": 2,

View file

@ -3,7 +3,7 @@ export interface Props {
text: string
href: string
}
const { text, href }: Props = Astro.props
const { text, href, ...attrs }: Props = Astro.props
---
<a class="link link-primary" href={href}>{text}</a>
<a class="link link-primary" href={href} {...attrs}>{text}</a>

View file

@ -1,6 +1,6 @@
---
import { getImage } from "astro:assets"
import { formatDate } from "../helper"
import { formatDate } from "../util"
type Post = {
content: string

View file

@ -1,5 +1,5 @@
---
import { directus } from "../helper"
import { directus } from "../util"
import DirectusImg from "./DirectusImg.astro"
type Member = {

View file

@ -0,0 +1,69 @@
---
import { bookstack } from "../util"
type Pages = {
data: {
id: string
name: string
draft: boolean
chapter_id: number
book_slug: string
}[]
}
type Page = {
name: string
slug: string
html: string
image: string
}
const imageRegex = /"https:\/\/wiki.swablab.de\/uploads\/images.*?"/gm
const pages = await bookstack<Pages>("pages")
const projects = pages.data
.filter(
(p) =>
!p.draft &&
p.book_slug == "projekte" &&
p.chapter_id == 0 &&
!p.name.includes("("),
)
.map(async (p) => {
const page = await bookstack<Page>(`pages/${p.id}`)
page.image = page.html.match(imageRegex)?.[0].replaceAll('"', "") ?? ""
return page
})
.filter(async (p) => (await p).image != "")
const project = await projects[Math.floor(Math.random() * projects.length)]
---
<div class="flex justify-center">
<div class="card w-96 bg-base-300 shadow-sm">
<figure>
<img src={project.image} />
</figure>
<div class="card-body">
<h2 class="card-title text-2xl">
{project.name}
</h2>
<p></p>
<div class="card-actions justify-end">
<a
class="btn btn-primary"
href={"https://wiki.swablab.de/books/projekte/page/" + project.slug}
>
Artikel lesen
</a>
</div>
</div>
</div>
</div>
<a
class="link link-primary"
href="https://wiki.swablab.de/books/projekte"
rel="noopener noreferrer me"
target="_blank"
>
Alle Projekte anzeigen
</a>

View file

@ -1,5 +1,5 @@
---
import { directus } from "../helper"
import { directus } from "../util"
import DirectusImg from "./DirectusImg.astro"
type Sponsor = {

View file

@ -1,5 +1,5 @@
---
import { documents } from "../helper"
import { documents } from "../util"
const year = new Date().getFullYear()
function entry(name: string, icon: string, link: string) {

View file

@ -15,7 +15,7 @@
</div>
<script>
import { directus, formatDate, formatTime } from "../helper"
import { directus, formatDate, formatTime } from "../util"
async function update() {
const { last, next } = await directus<{ last?: string; next?: string }>(

View file

@ -6,8 +6,8 @@ import List from "../components/List.astro"
import Section from "../components/Section.astro"
import Steps from "../components/Steps.astro"
import Text from "../components/Text.astro"
import { documents } from "../helper"
import Page from "../layouts/Page.astro"
import { documents } from "../util"
---
<Page title="3D Druck Service">

View file

@ -1,7 +1,7 @@
---
import Section from "../components/Section.astro"
import { documents } from "../helper"
import Page from "../layouts/Page.astro"
import { documents } from "../util"
---
<Page title="Offizielle Dokumente">

View file

@ -4,6 +4,7 @@ import DirectusImg from "../components/DirectusImg.astro"
import Forest from "../components/Forest.astro"
import Link from "../components/Link.astro"
import Mastodon from "../components/Mastodon.astro"
import Projects from "../components/Projects.astro"
import Section from "../components/Section.astro"
import Sponsors from "../components/Sponsors.astro"
import Text from "../components/Text.astro"
@ -54,6 +55,10 @@ import Page from "../layouts/Page.astro"
<Mastodon />
</Section>
<Section title="Hervorgehobenes Projekt" jumpId="projects">
<Projects />
</Section>
<Section title="Unsere Sponsoren" jumpId="sponsors">
<Sponsors />
</Section>

View file

@ -2,8 +2,8 @@
import Link from "../components/Link.astro"
import Section from "../components/Section.astro"
import Text from "../components/Text.astro"
import { documents } from "../helper"
import Page from "../layouts/Page.astro"
import { documents } from "../util"
---
<Page title="Mitglied werden">

View file

@ -4,6 +4,15 @@ export async function directus<T>(path: string): Promise<T> {
.then((res) => res.data)
}
export async function bookstack<T>(path: string): Promise<T> {
return await fetch(`https://wiki.swablab.de/api/${path}`, {
headers: {
Authorization: `Token l3SUMrYagdtATY5Epq7dz4qV6obWUQ4g:J8QRGH92niTLj77DDuKFLoeqExk9hfEk`,
},
})
.then((res) => res.json())
}
export function formatDate(
date: string | number | Date | undefined,
style: "short" | "medium" | "long",