Skip to content

Commit 32cb8a4

Browse files
authored
make website prettier on april 1st (#1150)
* implement 2004 design * fix documents
1 parent 3b78b3a commit 32cb8a4

5 files changed

Lines changed: 209 additions & 96 deletions

File tree

src/lib/server/loadHomeData.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ export const loadHomeData = async ({
6767
where: {
6868
...BASIC_ARTICLE_FILTER(),
6969
},
70+
include: {
71+
author: {
72+
include: {
73+
member: true,
74+
mandate: {
75+
include: {
76+
position: true,
77+
},
78+
},
79+
},
80+
},
81+
},
7082
orderBy: {
7183
createdAt: "desc",
7284
},
@@ -151,6 +163,8 @@ export const loadHomeData = async ({
151163
take: 4,
152164
});
153165

166+
const committeePromise = prisma.committee.findMany();
167+
154168
const [
155169
news,
156170
events,
@@ -160,6 +174,7 @@ export const loadHomeData = async ({
160174
commitData,
161175
hasActiveMandate,
162176
readme,
177+
committees,
163178
] = await Promise.allSettled([
164179
newsPromise,
165180
eventsPromise,
@@ -169,6 +184,7 @@ export const loadHomeData = async ({
169184
commitPromise,
170185
hasActiveMandatePromise,
171186
readmePromise,
187+
committeePromise,
172188
]);
173189
if (news.status === "rejected") {
174190
throw error(500, "Failed to fetch news");
@@ -194,7 +210,9 @@ export const loadHomeData = async ({
194210
if (readme.status === "rejected") {
195211
throw error(500, "Failed to fetch readme");
196212
}
197-
213+
if (committees.status === "rejected") {
214+
throw error(500, "Failed to fetch committees");
215+
}
198216
// WIKI
199217

200218
const minecraftStatus = async () => {
@@ -222,5 +240,6 @@ export const loadHomeData = async ({
222240
readmeIssues: readme.value,
223241
wikiData: await wikiDataCache.get(),
224242
minecraftStatus: minecraftStatus(),
243+
committees: committees.value,
225244
};
226245
};

src/routes/(app)/home/+page.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ export const load: PageServerLoad = async ({ locals, fetch, cookies }) => {
1111
if (!locals.user?.memberId) {
1212
redirect(302, "/");
1313
}
14+
1415
return await loadHomeData({ locals, fetch });
1516
};

src/routes/(app)/home/+page.svelte

Lines changed: 0 additions & 95 deletions
This file was deleted.
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<script lang="ts">
2+
import type { PageData } from "./$types";
3+
import { page } from "$app/stores";
4+
import { getFullName } from "$lib/utils/client/member";
5+
import SetPageTitle from "$lib/components/nav/SetPageTitle.svelte";
6+
import * as m from "$paraglide/messages";
7+
import SEO from "$lib/seo/SEO.svelte";
8+
9+
import "./home.css";
10+
import { markdownToTxt } from "markdown-to-txt";
11+
import dayjs from "dayjs";
12+
export let data: PageData;
13+
</script>
14+
15+
<SetPageTitle />
16+
<SEO
17+
data={{
18+
type: "website",
19+
props: {
20+
title: "D-sektionen",
21+
description: m.landing_intro(),
22+
},
23+
}}
24+
/>
25+
<div class="homepage pb-20">
26+
<div class="m-2 bg-primary p-1 text-center text-2xl font-bold text-white">
27+
Datatekniksektionen
28+
</div>
29+
<div id="home" class="flex flex-col gap-4 md:flex-row">
30+
<div class="float-left m-2 w-64 border-2 border-primary *:ml-1">
31+
<ul>
32+
<li><a href="/home"><b>Förstasidan</b></a></li>
33+
<li><a href="/events">Kalender</a></li>
34+
<li><a href="/news">Nyheter</a></li>
35+
<li><a href="/shop/tickets">Biljetter</a></li>
36+
<li><a href="/documents/governing">{m.documents_governing()}</a></li>
37+
<li><a href="/documents">{m.documents_meetingDocuments()}</a></li>
38+
<li>
39+
<a href="/documents/requirements"
40+
>{m.documents_requirementProfiles()}</a
41+
>
42+
</li>
43+
<li><hr class="my-1 mr-1 h-[2px] bg-primary" /></li>
44+
<li><a href="/board">{m.theBoard()}</a></li>
45+
<li><a href="/committees">{m.committees()}</a></li>
46+
<li><a href="/elections">{m.openElections()}</a></li>
47+
<li><a href="/bookings">{m.bookings()}</a></li>
48+
<li><a href="/expenses">{m.expenses()}</a></li>
49+
<li><a href="/songbook">{m.songBook()}</a></li>
50+
<li><a href="/medals">{m.medals()}</a></li>
51+
<li><a href="/gallery">{m.gallery()}</a></li>
52+
</ul>
53+
<hr class="my-1 mr-1 h-[2px] bg-primary" />
54+
{#if $page.data.member}
55+
<p>Inloggad som {getFullName($page.data.member)}</p>
56+
<ul>
57+
<li><a href="/members/me">{m.navbar_userMenu_profile()}</a></li>
58+
<li><a href="/settings">{m.navbar_userMenu_settings()}</a></li>
59+
</ul>
60+
{/if}
61+
</div>
62+
63+
<div class="mx-4 md:mx-0 md:w-[500px]">
64+
<h1 class="border-b-2 border-primary text-lg font-bold text-primary">
65+
Välkommen jämte D-sektionen...2004!
66+
</h1>
67+
<div class="flex flex-row justify-between">
68+
{#if $page.data.member}
69+
<div>
70+
<p>
71+
Hej {getFullName($page.data.member)}! Idag är det första april!
72+
</p>
73+
<br />
74+
<p>Ungefär så här såg hemsidan ut 1 april 2004...</p>
75+
<br />
76+
<p>Oroa dig inte, den borde vara som vanligt imorgon igen!</p>
77+
</div>
78+
{/if}
79+
<img
80+
src="https://i.imgur.com/XVb6nfS.png"
81+
alt="panter"
82+
class="m-4 h-32"
83+
/>
84+
</div>
85+
86+
<h1 class="border-b-2 border-primary text-lg font-bold text-primary">
87+
Senaste nytt
88+
</h1>
89+
{#each data.news as article}
90+
<div class="mb-10">
91+
<div class="flex flex-col">
92+
<a href="/news/{article.slug}" class="font-bold">{article.header}</a
93+
>
94+
<p><i>infört {article.createdAt.toString().slice(0, 24)}</i></p>
95+
</div>
96+
<p class="line-clamp-3 text-ellipsis">
97+
{markdownToTxt(article.body, { pedantic: true })}
98+
</p>
99+
100+
<span class="text-xs text-black">
101+
<a href="/members/{article.author.member.studentId}"
102+
>{article.author.member.firstName}</a
103+
>{article.author.mandate
104+
? `, ${
105+
article.author.mandate?.position.name
106+
} (${article.author.mandate?.position.email})`
107+
: ""}
108+
</span>
109+
</div>
110+
{/each}
111+
112+
<h1 class="border-b-2 border-primary text-lg font-bold text-primary">
113+
Info från DWWW
114+
</h1>
115+
<p>
116+
DWWW kan med gläjde informera om att arbetet med nya hemsidan går
117+
framåt, och vi tror att den kommer vara klar om ett halvår.™
118+
</p>
119+
</div>
120+
121+
<div class="mx-4 md:mx-0 md:w-[500px]">
122+
<h1 class="border-b-2 border-primary text-lg font-bold text-primary">
123+
Nytt under den senaste veckan!
124+
</h1>
125+
126+
{#each data.files.next.slice(0, 4) as file}
127+
<li class="block max-w-full">
128+
<a href={file.thumbnailUrl}>
129+
<span class="overflow-x-hidden text-ellipsis whitespace-nowrap">
130+
{file.name}
131+
</span>
132+
</a>
133+
</li>
134+
{/each}
135+
136+
<h1 class="border-b-2 border-primary text-lg font-bold text-primary">
137+
Nästa kalenderhändelse
138+
</h1>
139+
140+
{#each data.events as event}
141+
<div class="flex flex-col">
142+
<span class="text-black"
143+
><a class="font-bold" href="/events/{event.slug}">{event.title}</a>, {dayjs(
144+
event.startDatetime,
145+
).format("YYYY-MM-DD HH:MM")}</span
146+
>
147+
</div>
148+
{/each}
149+
150+
<h1 class="border-b-2 border-primary text-lg font-bold text-primary">
151+
Utskott
152+
</h1>
153+
<ul>
154+
{#if data.committees}
155+
{#each data.committees as committee}
156+
<li>
157+
<a href="/committees/{committee.shortName}">{committee.name}</a>
158+
</li>
159+
{/each}
160+
{/if}
161+
</ul>
162+
</div>
163+
</div>
164+
</div>

src/routes/(app)/home/home.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.homepage {
2+
background-color: #fff;
3+
}
4+
5+
#home a {
6+
color: #0000ee !important;
7+
text-decoration: underline;
8+
}
9+
10+
#home p,
11+
#home a,
12+
#home span {
13+
font-family: serif;
14+
}
15+
16+
#home p {
17+
color: #000;
18+
font-size: 0.9rem !important;
19+
}
20+
21+
#home h1 {
22+
margin-top: 1rem;
23+
font-size: 1.3rem !important;
24+
}

0 commit comments

Comments
 (0)