This commit is contained in:
parent
dd8a2da23a
commit
9f5455c5ec
15 changed files with 1163 additions and 752 deletions
|
@ -10,7 +10,7 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
integrations: [sitemap()],
|
integrations: [sitemap()],
|
||||||
image: {
|
image: {
|
||||||
domains: ["directus.swablab.de", "files.mastodon.social"],
|
domains: ["directus.swablab.de", "files.mastodon.social", "wiki.swablab.de"],
|
||||||
service: passthroughImageService(),
|
service: passthroughImageService(),
|
||||||
},
|
},
|
||||||
vite: {
|
vite: {
|
||||||
|
|
1796
package-lock.json
generated
1796
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -9,19 +9,19 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.9.4",
|
"@astrojs/check": "^0.9.4",
|
||||||
"@astrojs/sitemap": "^3.3.1",
|
"@astrojs/sitemap": "^3.5.1",
|
||||||
"@fontsource-variable/ubuntu-sans": "^5.2.7",
|
"@fontsource-variable/ubuntu-sans": "^5.2.9",
|
||||||
"@iconify-json/ph": "^1.2.2",
|
"@iconify-json/ph": "^1.2.2",
|
||||||
"@iconify/tailwind4": "^1.0.6",
|
"@iconify/tailwind4": "^1.0.6",
|
||||||
"@tailwindcss/typography": "^0.5.16",
|
"@tailwindcss/typography": "^0.5.16",
|
||||||
"@tailwindcss/vite": "^4.1.5",
|
"@tailwindcss/vite": "^4.1.13",
|
||||||
"astro": "^5.7.12",
|
"astro": "^5.13.7",
|
||||||
"daisyui": "^5.0.35",
|
"daisyui": "^5.1.10",
|
||||||
"tailwindcss": "^4.0.14"
|
"tailwindcss": "^4.1.13"
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"endOfLine": "lf"
|
"endOfLine": "lf"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ export interface Props {
|
||||||
text: string
|
text: string
|
||||||
href: 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>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getImage } from "astro:assets"
|
import { getImage } from "astro:assets"
|
||||||
import { formatDate } from "../helper"
|
import { formatDate } from "../util"
|
||||||
|
|
||||||
type Post = {
|
type Post = {
|
||||||
content: string
|
content: string
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import { directus } from "../helper"
|
import { directus } from "../util"
|
||||||
import DirectusImg from "./DirectusImg.astro"
|
import DirectusImg from "./DirectusImg.astro"
|
||||||
|
|
||||||
type Member = {
|
type Member = {
|
||||||
|
|
69
src/components/Projects.astro
Normal file
69
src/components/Projects.astro
Normal 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>
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import { directus } from "../helper"
|
import { directus } from "../util"
|
||||||
import DirectusImg from "./DirectusImg.astro"
|
import DirectusImg from "./DirectusImg.astro"
|
||||||
|
|
||||||
type Sponsor = {
|
type Sponsor = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
import { documents } from "../helper"
|
import { documents } from "../util"
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
|
|
||||||
function entry(name: string, icon: string, link: string) {
|
function entry(name: string, icon: string, link: string) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { directus, formatDate, formatTime } from "../helper"
|
import { directus, formatDate, formatTime } from "../util"
|
||||||
|
|
||||||
async function update() {
|
async function update() {
|
||||||
const { last, next } = await directus<{ last?: string; next?: string }>(
|
const { last, next } = await directus<{ last?: string; next?: string }>(
|
||||||
|
|
|
@ -6,8 +6,8 @@ import List from "../components/List.astro"
|
||||||
import Section from "../components/Section.astro"
|
import Section from "../components/Section.astro"
|
||||||
import Steps from "../components/Steps.astro"
|
import Steps from "../components/Steps.astro"
|
||||||
import Text from "../components/Text.astro"
|
import Text from "../components/Text.astro"
|
||||||
import { documents } from "../helper"
|
|
||||||
import Page from "../layouts/Page.astro"
|
import Page from "../layouts/Page.astro"
|
||||||
|
import { documents } from "../util"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Page title="3D Druck Service">
|
<Page title="3D Druck Service">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import Section from "../components/Section.astro"
|
import Section from "../components/Section.astro"
|
||||||
import { documents } from "../helper"
|
|
||||||
import Page from "../layouts/Page.astro"
|
import Page from "../layouts/Page.astro"
|
||||||
|
import { documents } from "../util"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Page title="Offizielle Dokumente">
|
<Page title="Offizielle Dokumente">
|
||||||
|
|
|
@ -4,6 +4,7 @@ import DirectusImg from "../components/DirectusImg.astro"
|
||||||
import Forest from "../components/Forest.astro"
|
import Forest from "../components/Forest.astro"
|
||||||
import Link from "../components/Link.astro"
|
import Link from "../components/Link.astro"
|
||||||
import Mastodon from "../components/Mastodon.astro"
|
import Mastodon from "../components/Mastodon.astro"
|
||||||
|
import Projects from "../components/Projects.astro"
|
||||||
import Section from "../components/Section.astro"
|
import Section from "../components/Section.astro"
|
||||||
import Sponsors from "../components/Sponsors.astro"
|
import Sponsors from "../components/Sponsors.astro"
|
||||||
import Text from "../components/Text.astro"
|
import Text from "../components/Text.astro"
|
||||||
|
@ -54,6 +55,10 @@ import Page from "../layouts/Page.astro"
|
||||||
<Mastodon />
|
<Mastodon />
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
<Section title="Hervorgehobenes Projekt" jumpId="projects">
|
||||||
|
<Projects />
|
||||||
|
</Section>
|
||||||
|
|
||||||
<Section title="Unsere Sponsoren" jumpId="sponsors">
|
<Section title="Unsere Sponsoren" jumpId="sponsors">
|
||||||
<Sponsors />
|
<Sponsors />
|
||||||
</Section>
|
</Section>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import Link from "../components/Link.astro"
|
import Link from "../components/Link.astro"
|
||||||
import Section from "../components/Section.astro"
|
import Section from "../components/Section.astro"
|
||||||
import Text from "../components/Text.astro"
|
import Text from "../components/Text.astro"
|
||||||
import { documents } from "../helper"
|
|
||||||
import Page from "../layouts/Page.astro"
|
import Page from "../layouts/Page.astro"
|
||||||
|
import { documents } from "../util"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Page title="Mitglied werden">
|
<Page title="Mitglied werden">
|
||||||
|
|
|
@ -4,6 +4,15 @@ export async function directus<T>(path: string): Promise<T> {
|
||||||
.then((res) => res.data)
|
.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(
|
export function formatDate(
|
||||||
date: string | number | Date | undefined,
|
date: string | number | Date | undefined,
|
||||||
style: "short" | "medium" | "long",
|
style: "short" | "medium" | "long",
|
Loading…
Add table
Reference in a new issue