Skip to content

Commit f333d34

Browse files
Herwalomfj
andcommitted
parent 2a81314
author Herwal <[email protected]> 1727281716 +0200 committer herwal <[email protected]> 1727438031 +0200 parent 2a81314 author Herwal <[email protected]> 1727281716 +0200 committer herwal <[email protected]> 1727437984 +0200 parent 2a81314 author Herwal <[email protected]> 1727281716 +0200 committer herwal <[email protected]> 1727437815 +0200 parent 2a81314 author Herwal <[email protected]> 1727281716 +0200 committer herwal <[email protected]> 1727437186 +0200 skjuler private brukere fra andre serverless Style job ads Smaller text Remove image on smaller screen Fix package specifier Fix external link Update dependency eslint to v8.57.1 (#2258) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Update dependency postcss to v8.4.47 (#2259) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Update dependency tailwindcss to v3.4.12 (#2260) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Add dedicated api app (#2255) Display waitlist position (#2268) Only show spot when registration is open Simplify CI (#2269) Remove kaffe (#2270) Center div Fix external link Fix feedback form Update dependency @types/react to v18.3.8 (#2257) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Move docker compose file Refresh data Update dependency typescript to v5.6.2 (#2263) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Remove t3 env (#2272) Add date endpoint Remove date endpoint Update cache New backend, who dis? Add revalidation tags Add message Remove unused env Update fly.toml Made landingpage better by making happenings and posts smaller (#2275) Remove concurrency Nixengh/calendar (#2267) Co-authored-by: Ole Magnus Fon Johnsen <[email protected]>
1 parent 761dd71 commit f333d34

File tree

18 files changed

+351
-158
lines changed

18 files changed

+351
-158
lines changed

apps/api/fly.toml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
app = "fly-echo-api"
22
primary_region = "arn"
3+
kill_signal = "SIGINT"
4+
kill_timeout = 5
5+
swap_size_mb = 512
36

4-
[build]
7+
[[services]]
8+
internal_port = 8000
9+
processes = [ "app" ]
10+
protocol = "tcp"
11+
auto_stop_machines = "stop"
12+
auto_start_machines = true
13+
min_machines_running = 1
14+
script_checks = [ ]
515

6-
[http_service]
7-
internal_port = 8000
16+
# [services.concurrency]
17+
# hard_limit = 120
18+
# soft_limit = 100
19+
# type = "requests"
20+
21+
[[services.ports]]
22+
handlers = [ "http" ]
23+
port = 80
824
force_https = true
9-
auto_stop_machines = "stop"
10-
auto_start_machines = true
11-
min_machines_running = 1
12-
processes = ["app"]
1325

14-
[[vm]]
15-
size = "shared-cpu-2x"
16-
memory = "1gb"
17-
cpus = 1
26+
[[services.ports]]
27+
handlers = [ "tls", "http" ]
28+
port = 443

apps/api/src/services/shopping-list.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Hono } from "hono";
22

3-
import { db } from "../lib/db";
3+
import { db } from "@echo-webkom/db/serverless";
4+
45
import { admin } from "../middleware/admin";
56

67
const app = new Hono();

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@radix-ui/react-separator": "1.1.0",
3232
"@radix-ui/react-slot": "1.1.0",
3333
"@radix-ui/react-switch": "1.1.0",
34+
"@radix-ui/react-tabs": "1.1.0",
3435
"@radix-ui/react-toast": "1.2.1",
3536
"@sanity/client": "6.21.3",
3637
"@sanity/image-url": "1.0.2",

apps/web/src/app/(default)/for-studenter/arrangementer/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@ import {
88
FilterStatusAndOrderBar,
99
} from "@/components/event-filter";
1010
import { EventsView, type SearchParams } from "@/components/events-view";
11-
import { getCalendarEvents } from "@/lib/calendar-events";
11+
import { happeningsToCalendarEvent, moviesToCalendarEvent } from "@/lib/calendar-event-helpers";
12+
import { fetchAllHappenings } from "@/sanity/happening";
13+
import { fetchMovies } from "@/sanity/movies";
1214

1315
export default async function Page({ searchParams }: { searchParams?: SearchParams }) {
14-
// TODO: This is very bad practice and should be fixed!
16+
const [happenings, movies] = await Promise.all([fetchAllHappenings(), fetchMovies()]);
1517
if (!searchParams) searchParams = { type: "all" };
1618

1719
// Serialize searchParams to a JSON string as a key for the Suspense component.
1820
// Ensure a stable key by stringifying a sorted object if the order may vary.
1921
const searchParamsKey = JSON.stringify(searchParams, Object.keys(searchParams).sort());
2022

21-
const calendarEvents = await getCalendarEvents();
23+
const calendarEvents = happeningsToCalendarEvent(happenings).concat(
24+
moviesToCalendarEvent(movies),
25+
);
2226

2327
return (
2428
<Container layout="larger" className="space-y-4 py-10">

apps/web/src/app/(default)/hjem/_components/coming-bedpres.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,13 @@ export const ComingHappenings = async ({
2525

2626
return (
2727
<BentoBox title={title} href={href} className={className}>
28-
{happenings.length > 0 ? (
29-
<ul className="grid grid-cols-1 gap-x-3">
30-
{happenings.map((happening) => (
31-
<li key={happening._id}>
32-
<HappeningPreview happening={happening} />
33-
</li>
34-
))}
35-
</ul>
36-
) : (
37-
<div className="flex flex-1 flex-col items-center justify-center py-6 text-center text-gray-500">
38-
<LuClock10 className="mb-4 size-16" />
39-
<p className="font-medium">Ingen kommende {title.toLowerCase()}</p>
40-
</div>
41-
)}
28+
<ul className="grid grid-cols-1 gap-x-3">
29+
{happenings.map((happening) => (
30+
<li key={happening._id}>
31+
<HappeningPreview happening={happening} />
32+
</li>
33+
))}
34+
</ul>
4235
</BentoBox>
4336
);
4437
};

apps/web/src/app/(default)/hjem/_components/fp-calendar.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { Calendar } from "@/components/calendar/calendar";
2-
import { getCalendarEvents } from "@/lib/calendar-events";
2+
import { happeningsToCalendarEvent, moviesToCalendarEvent } from "@/lib/calendar-event-helpers";
3+
import { fetchAllHappenings } from "@/sanity/happening";
4+
import { fetchMovies } from "@/sanity/movies";
35

46
export const FPCalendar = async ({ className }: { className?: string }) => {
5-
const calendarEvents = await getCalendarEvents();
7+
const [happenings, movies] = await Promise.all([fetchAllHappenings(), fetchMovies()]);
8+
9+
const calendarEvents = happeningsToCalendarEvent(happenings).concat(
10+
moviesToCalendarEvent(movies),
11+
);
612

713
return (
814
<div className={className}>

apps/web/src/app/(default)/hjem/_components/happening-preview.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ export const HappeningPreview = ({
2222
<Link href={href}>
2323
<div
2424
className={cn(
25-
"h-18 relative flex items-center gap-4 rounded-xl border-2 border-transparent p-4 hover:border-muted-dark hover:bg-muted",
25+
"h-18 flex items-center gap-4 rounded-xl border-2 border-transparent p-4 hover:border-muted-dark hover:bg-muted",
2626
{
2727
"h-[6.5rem]": happening.happeningType === "bedpres",
28-
"border-secondary-dark": happening.isPinned === true,
2928
},
3029
)}
3130
>
@@ -62,7 +61,7 @@ export const HappeningPreview = ({
6261
<li className="flex justify-end text-xs text-muted-foreground">
6362
<time>{shortDateNoTimeNoYear(happening.date)}</time>
6463
</li>
65-
<li>
64+
<li className="text-muted-foreground">
6665
<HappeningRegistrationInfo happening={happening} />
6766
</li>
6867
</ul>

apps/web/src/app/(default)/hjem/page.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Container } from "@/components/container";
22
import { ensureUser } from "@/lib/ensure";
3-
import { Banner } from "./_components/Banner";
4-
import BirthdayBanner from "./_components/birthdayBanner";
53
import { ComingHappenings } from "./_components/coming-bedpres";
64
import { FilmklubbMovies } from "./_components/filmklubb";
75
import { FPCalendar } from "./_components/fp-calendar";
@@ -13,9 +11,10 @@ export default async function Home() {
1311
await ensureUser();
1412

1513
return (
16-
<>
17-
<Banner />
18-
<BirthdayBanner />
14+
<div className="space-y-8 py-24">
15+
<Container layout="larger">
16+
<FPCalendar />
17+
</Container>
1918

2019
<Container
2120
layout="larger"
@@ -25,11 +24,11 @@ export default async function Home() {
2524
title="Arrangementer"
2625
href="/for-studenter/arrangementer?type=event"
2726
types={["external", "event"]}
28-
n={7}
27+
n={11}
2928
className="col-span-1 row-span-2"
3029
/>
3130
<ComingHappenings
32-
title="Bedpresser"
31+
title="Bedriftspresentasjoner"
3332
href="/for-studenter/arrangementer?type=bedpres"
3433
types={["bedpres"]}
3534
n={3}

apps/web/src/app/api/sanity/route.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ export const POST = withBasicAuth(async (req) => {
123123
}
124124
revalidateTag("happenings");
125125

126+
// Revalidate happening data from Sanity
127+
revalidateTag("happening-params");
128+
revalidateTag("home-happenings");
129+
if (data?.slug) {
130+
revalidateTag(`happening-${data.slug}`);
131+
}
132+
if (pastSlug) {
133+
revalidateTag(`happening-${pastSlug}`);
134+
}
135+
revalidateTag("happenings");
136+
126137
/**
127138
* If the happening is external, we don't want to do anything. Since
128139
* we are not responsible for the registrations of external happenings.

apps/web/src/components/calendar/calendar.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useEffect, useRef, useState } from "react";
44
import Link from "next/link";
5-
import { motion } from "motion/react";
5+
import { motion } from "framer-motion";
66
import { BiCalendar, BiDownload } from "react-icons/bi";
77

88
import { Heading } from "@/components/typography/heading";
@@ -119,25 +119,21 @@ export const Calendar = ({ events, type }: Props) => {
119119

120120
const Legend = () => {
121121
return (
122-
<div className="flex flex-wrap gap-4 p-5 text-xs">
122+
<div className="flex flex-col gap-4 p-5 md:flex-row">
123123
<div className="mr-2 flex items-center">
124-
<div className="mr-1 h-3 w-3 rounded-full bg-primary"></div>
124+
<div className="mr-1 h-4 w-4 rounded-full bg-primary"></div>
125125
<div>Bedpres</div>
126126
</div>
127127
<div className="mr-2 flex items-center">
128-
<div className="mr-1 h-3 w-3 rounded-full bg-secondary"></div>
128+
<div className="mr-1 h-4 w-4 rounded-full bg-secondary"></div>
129129
<div>Arrangement</div>
130130
</div>
131131
<div className="mr-2 flex items-center">
132-
<div className="mr-1 h-3 w-3 rounded-full bg-pink-400"></div>
132+
<div className="mr-1 h-4 w-4 rounded-full bg-pink-400"></div>
133133
<div>Film</div>
134134
</div>
135-
<div className="mr-2 flex items-center">
136-
<div className="mr-1 h-3 w-3 rounded-full bg-green-600"></div>
137-
<div>Brettspill</div>
138-
</div>
139135
<div className="flex items-center">
140-
<div className="mr-1 h-3 w-3 rounded-full bg-gray-600"></div>
136+
<div className="mr-1 h-4 w-4 rounded-full bg-gray-600"></div>
141137
<div>Annet</div>
142138
</div>
143139
</div>

0 commit comments

Comments
 (0)