added event helpers to ui libary, added Badge component, reordered Dashboard Components, splitted Event Admin page

This commit is contained in:
PxlLoewe
2025-03-07 14:16:19 -07:00
parent c1f1ad47b7
commit 829e78a47d
25 changed files with 465 additions and 355 deletions

4
packages/ui/src/.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
declare module "*.png" {
const value: string;
export = value;
}

View File

@@ -0,0 +1,28 @@
import { BADGES } from "@repo/db";
import P1 from "./p-1.png";
import P2 from "./p-2.png";
import P3 from "./p-3.png";
import D1 from "./d-1.png";
import D2 from "./d-2.png";
import D3 from "./d-3.png";
import DAY1 from "./day-1-member.png";
const BadgeImage = {
[BADGES.P1]: P1,
[BADGES.P2]: P2,
[BADGES.P3]: P3,
[BADGES.D1]: D1,
[BADGES.D2]: D2,
[BADGES.D3]: D3,
[BADGES.DAY1]: DAY1,
};
export const Badge = ({ name }: { name: BADGES }) => {
const image = BadgeImage[name];
return (
<span className="badge">
<img src={image} />
</span>
);
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -1,20 +0,0 @@
"use client";
import { ReactNode } from "react";
interface ButtonProps {
children: ReactNode;
className?: string;
appName: string;
}
export const Button = ({ children, className, appName }: ButtonProps) => {
return (
<button
className={className}
onClick={() => alert(`Hello from your ${appName} app!`)}
>
{children}
</button>
);
};

View File

@@ -1,27 +0,0 @@
import { type JSX } from "react";
export function Card({
className,
title,
children,
href,
}: {
className?: string;
title: string;
children: React.ReactNode;
href: string;
}): JSX.Element {
return (
<a
className={className}
href={`${href}?utm_source=create-turbo&utm_medium=basic&utm_campaign=create-turbo"`}
rel="noopener noreferrer"
target="_blank"
>
<h2>
{title} <span>-&gt;</span>
</h2>
<p>{children}</p>
</a>
);
}

View File

@@ -1,11 +0,0 @@
import { type JSX } from "react";
export function Code({
children,
className,
}: {
children: React.ReactNode;
className?: string;
}): JSX.Element {
return <code className={className}>{children}</code>;
}

View File

@@ -0,0 +1,9 @@
import { Event, Participant } from "@repo/db";
export const eventCompleted = (event: Event, participant?: Participant) => {
if (!participant) return false;
if (event.finisherMoodleCourseId && !participant.finisherMoodleCurseCompleted)
return false;
if (event.hasPresenceEvents && !participant.attended) return false;
return true;
};

2
packages/ui/src/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from "./Badge/Badge";
export * from "./helper/event";