added Badges to Dashboard, warning for full events
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Badge } from "@repo/ui";
|
||||
|
||||
import { Award } from "lucide-react";
|
||||
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
|
||||
import { Badge } from "../../_components/Badge/Badge";
|
||||
|
||||
export const Badges = async () => {
|
||||
const session = await getServerSession();
|
||||
@@ -15,13 +14,11 @@ export const Badges = async () => {
|
||||
<Award className="w-4 h-4" /> Verdiente Abzeichen
|
||||
</span>
|
||||
</h2>
|
||||
{session.user.badges.map((badge) => {
|
||||
return (
|
||||
<div className="badge badge-primary badge-outline">
|
||||
<Badge name={badge} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{session.user.badges.map((badge, i) => {
|
||||
return <Badge name={badge} key={`${badge} - ${i}`} />;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -41,6 +41,26 @@ export default async () => {
|
||||
},
|
||||
});
|
||||
|
||||
const appointments = await prisma.eventAppointment.findMany({
|
||||
where: {
|
||||
appointmentDate: {
|
||||
gte: new Date(),
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Participants: {
|
||||
where: {
|
||||
userId: user.id,
|
||||
},
|
||||
},
|
||||
_count: {
|
||||
select: {
|
||||
Participants: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const filteredEvents = events.filter((event) => {
|
||||
console.log;
|
||||
if (eventCompleted(event, event.participants[0])) return false;
|
||||
@@ -64,6 +84,7 @@ export default async () => {
|
||||
{filteredEvents.map((event) => {
|
||||
return (
|
||||
<KursItem
|
||||
appointments={appointments}
|
||||
selectedAppointments={userAppointments}
|
||||
user={user}
|
||||
event={event}
|
||||
|
||||
Reference in New Issue
Block a user