Skip to content

Commit

Permalink
Merge pull request #115 from DeutscheModelUnitedNations/registration-…
Browse files Browse the repository at this point in the history
…alert

✨ feature: Display Active Registration Periods on home page
  • Loading branch information
m1212e authored Oct 5, 2024
2 parents 84de3a2 + 5bc96aa commit 29995c0
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
68 changes: 68 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@
website: 'https://munbw.de',
logo: BWLogo
};
let { data } = $props();
const openRegistrations = $derived(() => {
return data.conferences
.filter((c) => {
if (!c.startRegistration || !c.endRegistration) return false;
return (
new Date(c.startRegistration).getTime() < new Date().getTime() &&
new Date(c.endRegistration).getTime() > new Date().getTime()
);
})
.sort(
(a, b) =>
new Date(b.startRegistration!).getTime() - new Date(a.startRegistration!).getTime()
);
});
</script>

<svelte:head>
Expand All @@ -56,6 +73,16 @@
btnLink="/registration"
>
<p>{m.homeRegistrationSub()}</p>
{#if openRegistrations().length > 0}
<ul class="live-list mt-2">
{#each openRegistrations() as conference}
<li>
<span></span>
{conference.title}
</li>
{/each}
</ul>
{/if}
</UndrawCard>

<UndrawCard
Expand Down Expand Up @@ -144,3 +171,44 @@
</main>
<Footer />
</div>

<style lang="postcss">
.live-list {
list-style: none;
@apply mt-4;
}
.live-list li {
position: relative;
@apply pl-6 mx-2 my-1;
}
.live-list span {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 10px; /* Size of the dot */
height: 10px; /* Size of the dot */
background-color: green; /* Dot color */
border-radius: 50%; /* Make it a circle */
box-shadow: 0 0 5px rgba(0, 255, 0, 0.2); /* Initial glow */
animation: pulsate 1.5s infinite; /* Animation */
}
@keyframes pulsate {
0% {
box-shadow: 0 0 3px rgba(0, 115, 0, 0.2);
transform: translateY(-50%) scale(1);
}
50% {
box-shadow: 0 0 10px rgb(0, 115, 0); /* Glow effect */
transform: translateY(-50%) scale(1.1); /* Slightly enlarge */
}
100% {
box-shadow: 0 0 5px rgba(0, 115, 0, 0.2);
transform: translateY(-50%) scale(1);
}
}
</style>
11 changes: 11 additions & 0 deletions src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { checkForError } from '$api/client';
import { loadApiHandler } from '$lib/helper/loadApiHandler';
import type { PageLoad } from './$types';

export const load: PageLoad = loadApiHandler(async ({ api }) => {
const conferences = await checkForError(api.conference.get());

return {
conferences
};
});

0 comments on commit 29995c0

Please sign in to comment.