Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
1. Apply migrations

```bash
pnpm db:migrate -- --local
pnpm db:migrate:local
```

1. Start the development server
Expand Down
12 changes: 6 additions & 6 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"db:migrate:local": "pnpm db:migrate -- --local"
},
"devDependencies": {
"@cloudflare/workers-types": "4.20241205.0",
"@faker-js/faker": "9.3.0",
"@cloudflare/workers-types": "4.20250321.0",
"@faker-js/faker": "9.6.0",
"@playwright/test": "1.49.1",
"@sveltejs/adapter-cloudflare": "4.8.0",
"@sveltejs/kit": "2.11.0",
"@sveltejs/adapter-cloudflare": "6.0.1",
"@sveltejs/kit": "2.20.0",
"@sveltejs/vite-plugin-svelte": "5.0.3",
"@tailwindcss/forms": "0.5.9",
"@tailwindcss/typography": "0.5.15",
Expand All @@ -41,15 +41,15 @@
"prettier": "3.4.2",
"prettier-plugin-svelte": "3.3.2",
"prettier-plugin-tailwindcss": "0.6.9",
"svelte": "5.15.0",
"svelte": "5.25.3",
"svelte-check": "4.1.1",
"tailwindcss": "3.4.16",
"tsx": "4.19.2",
"typescript": "5.7.2",
"typescript-eslint": "8.18.0",
"vite": "6.0.3",
"vitest": "2.1.8",
"wrangler": "3.95.0"
"wrangler": "4.4.0"
},
"dependencies": {
"@lucia-auth/adapter-drizzle": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/www/scripts/add-invitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Env = {
// Example "tsx ./apps/www/scripts/add-invitation.ts "some@email.com""
const main = async () => {
const { env } = await getPlatformProxy<Env>({
configPath: './apps/www/wrangler.toml',
configPath: './apps/www/wrangler.jsonc',
persist: {
path: './apps/www/.wrangler/state/v3'
}
Expand Down
7 changes: 6 additions & 1 deletion apps/www/src/lib/components/footer/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@
<a class="hover:underline" href="/portal">Portal</a>
</li>
{/if}
{#if $user}
<li>
<a class="hover:underline" href="/emeritus">Emeritus</a>
</li>
{/if}
{#if !$user}
<li>
<a class="hover:underline" href="/logg-inn">Logg inn</a>
<a class="hover:underline" href="/logg-inn">logg inn</a>
</li>
{/if}
</ul>
Expand Down
3 changes: 2 additions & 1 deletion apps/www/src/routes/(app)/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ export const load: PageServerLoad = async () => {
getRepeatingEvents()
]);

const p = products.filter((product) => !product.isSoldOut);
const allRepeatingEvents = flattenRepeatingEvents(repeatingEvents);
const allEvents = [...events, ...allRepeatingEvents]
.filter((event) => Date.now() <= new Date(event.date).getTime())
.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime())
.slice(0, 6);

return {
products,
products: p,
events: allEvents,
status
};
Expand Down
104 changes: 104 additions & 0 deletions apps/www/src/routes/(app)/emeritus/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<script lang="ts">
// Define the props interface
interface Props {
groupLogo?: string;
groupName?: string;
estYear?: string;
description?: string;
}

let {
groupLogo = '/android-chrome-192x192.png',
groupName = 'Programmerbar',
estYear = '2020',
description = 'Tidligere og nåværende medlemmer av echo Programmerbar.'
}: Props = $props();

const coFounders = [
{ name: 'Brigt A.T Håvardstun', role: 'Co-founder' },
{ name: 'Sandra Lekve', role: 'Co-founder' },
{ name: 'Vegard Jensløkken', role: 'Co-founder' },
{ name: 'Eivind D. Halderaker', role: 'Co-founder' }
];

const members = [
'Lars Bysheim',
'Erik Fjelltveit Nyhuus',
'Lene Soltveit',
'Lars Haukland',
'Gard Heine Kalland',
'Steffen Andre Pettersen',
'Siren Bjorøy',
'Stian Munkejord',
'Ole Straumland',
'Tony Lam',
'Eirik Rekve Thorsheim',
'Ole Magnus Fon Johnsen',
'August Ebne Røeggen',
'Simen Hauge Østbø'
];

const pastMembers = [
'Mina Tolfsen',
'Ask Rud Persson',
'Palma Rud Persson',
'Sigurd Johnsen Setså',
'Erlend Raa Vågset',
'Sofia Hestenes Eika',
'Kristoffer Borg Nilsen',
'Lars Lismoen',
'Yoeri Otten',
'Eirik Øygard',
'Arne Natskår',
'Alexander Alf Iversen',
'Henrik Trondseth',
'Emil Johannessen',
'Andre Normann',
'Sofie Nhu Nguyen'
];
</script>

<div class="container py-10 text-center">
<img class="mx-auto h-32 w-auto" src={groupLogo} alt="Programmerbar logo" />
<h1 class="font-display mx-auto">{groupName}</h1>
<p class="text-muted-foreground text-xs">EST. {estYear}</p>
<p class="text-muted-foreground">{description}</p>

<div class="mx-auto my-10 max-w-md space-y-8">
<!-- Co-founders -->
<ul class="list-none p-0 text-lg">
{#each coFounders as founder}
<li class="relative mx-auto w-fit">
<!-- Inline crown icon -->
<svg
class="absolute -left-6 top-1 h-4 w-4 text-yellow-400"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 16 16"
>
<path
d="M2.5 8a.5.5 0 0 1 .5-.5H5v-3H3a.5.5 0 0 1-.5-.5H1v9h1.5a.5.5 0 0 1 .5-.5H5v-3H3.5a.5.5 0 0 1-.5-.5zM11 8a.5.5 0 0 0-.5-.5H9v-3h2a.5.5 0 0 0 .5-.5H15v9h-1.5a.5.5 0 0 0-.5-.5H11v-3zM6 8.5a.5.5 0 0 0 .5-.5V5.5H8v2.5a.5.5 0 0 0 .5.5H10v3H6v-3h.001z"
/>
</svg>
<span>{founder.name} ({founder.role})</span>
</li>
{/each}
</ul>

<!-- Members -->
<h2 class="text-xl font-bold">Styremedlemmer</h2>
<ul class="list-none p-0 text-lg">
{#each members as member}
<li>{member}</li>
{/each}
</ul>

<!-- Past Members -->
<h2 class="mt-16 text-xl font-bold">Tidligere Styremedlemmer</h2>
<ul class="list-none p-0 text-lg">
{#each pastMembers as member}
<li>{member}</li>
{/each}
</ul>
</div>
</div>
16 changes: 12 additions & 4 deletions apps/www/src/routes/(app)/om-oss/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@
<div
class="mx-auto mb-4 flex h-72 w-full items-center justify-center gap-4 rounded-xl border-2 bg-gray-100 sm:float-right sm:ml-4 md:w-96"
>
<Smile class="h-16 w-16 text-primary" />
<Beer class="h-16 w-16 text-primary" />
<Wine class="h-16 w-16 text-primary" />
<Wifi class="h-16 w-16 text-primary" />
{#if data.programmerbar.image}
<img
src={echoUrlFor(data.programmerbar.image).url()}
alt={'Programmerbar'}
class="h-full w-full rounded-xl object-cover"
/>
{:else}
<Smile class="h-16 w-16 text-primary" />
<Beer class="h-16 w-16 text-primary" />
<Wine class="h-16 w-16 text-primary" />
<Wifi class="h-16 w-16 text-primary" />
{/if}
</div>

<article class="prose prose-xl break-words text-xl">
Expand Down
4 changes: 3 additions & 1 deletion apps/www/src/routes/portal/brukere/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ export const load: PageServerLoad = async ({ locals }) => {
locals.invitationService.findAllUnused()
]);

const isBoardMember = locals.user?.role === 'board';

return {
users,
invitations
invitations: isBoardMember ? invitations : []
};
};

Expand Down
65 changes: 34 additions & 31 deletions apps/www/src/routes/portal/brukere/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,39 @@
</ul>
</section>

<section class="mt-12 space-y-6">
<Heading>Invitasjoner</Heading>
{#if data.invitations.length > 0}
<hr class="my-12 border-t border-gray-200" />
<section class="mt-12 space-y-6">
<Heading>Invitasjoner</Heading>

<ul class="grid grid-cols-1 gap-4 md:grid-cols-3">
{#each data.invitations as invitation}
<li class="relative block rounded-lg border bg-white p-4">
<form method="post" action="?/deleteInvitation" use:enhance>
<input name="invitationId" hidden value={invitation.id} />
<button class="absolute right-2 top-2 h-6 w-6 cursor-pointer text-gray-500">
<X class="h-6 w-6 text-gray-500" />
</button>
</form>
<ul class="grid grid-cols-1 gap-4 md:grid-cols-3">
{#each data.invitations as invitation}
<li class="relative block rounded-lg border bg-white p-4">
<form method="post" action="?/deleteInvitation" use:enhance>
<input name="invitationId" hidden value={invitation.id} />
<button class="absolute right-2 top-2 h-6 w-6 cursor-pointer text-gray-500">
<X class="h-6 w-6 text-gray-500" />
</button>
</form>

<p class="text-sm">
<span class="font-medium">E-post:</span>
<a class="hover:underline" href={mailto(invitation.email)}>{invitation.email}</a>
</p>
<p class="text-sm">
<span class="font-medium">Sendt:</span>
{formatDate(invitation.createdAt)}
</p>
<p class="text-sm">
<span class="font-medium">Utgår:</span>
{formatDate(invitation.expiresAt)}
</p>
</li>
{:else}
<li class="block col-span-3 text-center py-4">
<p>Ingen invitasjoner</p>
</li>
{/each}
</ul>
</section>
<p class="text-sm">
<span class="font-medium">E-post:</span>
<a class="hover:underline" href={mailto(invitation.email)}>{invitation.email}</a>
</p>
<p class="text-sm">
<span class="font-medium">Sendt:</span>
{formatDate(invitation.createdAt)}
</p>
<p class="text-sm">
<span class="font-medium">Utgår:</span>
{formatDate(invitation.expiresAt)}
</p>
</li>
{:else}
<li class="block col-span-3 text-center py-4">
<p>Ingen invitasjoner</p>
</li>
{/each}
</ul>
</section>
{/if}
46 changes: 46 additions & 0 deletions apps/www/src/routes/portal/claim-beer/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { redirect } from '@sveltejs/kit';
import type { Actions, PageServerLoad } from './$types';
import { fail } from '@sveltejs/kit';

export const load: PageServerLoad = async ({ locals }) => {
const userId = await locals.user?.id;

if (!userId) {
throw redirect(301, '/');
}

const unclaimedBeers = await locals.beerService.getTotalAvailableBeers(userId);

return {
unclaimedBeers
};
};

export const actions: Actions = {
default: async ({ locals }) => {
const userId = locals.user?.id;

if (!userId) {
return fail(401, {
success: false,
message: 'Please log in to claim your beer.'
});
}

try {
const success = await locals.beerService.claimBeer(userId);

if (success) {
return { success: true, message: 'Beer claimed.' };
} else {
return { success: false, message: 'No more beers left to claim.' };
}
} catch (err) {
console.error('Error claiming beer:', err);
return fail(500, {
success: false,
message: 'Internal error'
});
}
}
};
Loading