Skip to content

Commit 6bd2d07

Browse files
committed
feat: Mark internal events with badge
1 parent 1ff7d79 commit 6bd2d07

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

src/app/[locale]/(default)/events/[id]/loading.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Avatar, AvatarImage } from '@/components/ui/Avatar';
21
import { Separator } from '@/components/ui/Separator';
32
import { Skeleton } from '@/components/ui/Skeleton';
4-
import { ArrowLeftIcon, CalendarIcon, MapPinIcon } from 'lucide-react';
3+
import { CalendarIcon, MapPinIcon } from 'lucide-react';
54

65
export default function EventDetailsLoading() {
76
return (

src/app/[locale]/(default)/events/[id]/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Separator } from '@/components/ui/Separator';
66
import { events } from '@/mock-data/events';
77
import { CalendarIcon, MapPinIcon } from 'lucide-react';
88
import { notFound } from 'next/navigation';
9+
import { Badge } from '@/components/ui/Badge';
910

1011
export async function generateMetadata({
1112
params,
@@ -57,6 +58,7 @@ export default async function EventDetailsPage({
5758
<h1 className='my-4'>{event.title}</h1>
5859
<h3>{event.subheader}</h3>
5960
<div className='mt-4 space-y-4'>
61+
{event.internal && <Badge className='rounded-full'>Internal</Badge>}
6062
<div className='flex items-center gap-2'>
6163
<CalendarIcon className='h-8 w-8' />
6264
{

src/app/[locale]/(default)/events/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default async function EventsPage({
4141
imagePath={event.imagePath}
4242
startTime={new Date(event.startTime)}
4343
endTime={new Date(event.endTime)}
44+
internal={event.internal}
4445
locale={locale}
4546
_active
4647
/>
@@ -57,6 +58,7 @@ export default async function EventsPage({
5758
imagePath={event.imagePath}
5859
startTime={new Date(event.startTime)}
5960
endTime={new Date(event.endTime)}
61+
internal={event.internal}
6062
locale={locale}
6163
wrapperClassName='lg:last:odd:col-span-2'
6264
cardClassName='h-full'
@@ -75,6 +77,7 @@ export default async function EventsPage({
7577
imagePath={event.imagePath}
7678
startTime={new Date(event.startTime)}
7779
endTime={new Date(event.endTime)}
80+
internal={event.internal}
7881
locale={locale}
7982
wrapperClassName='lg:last:odd:col-span-2'
8083
cardClassName='h-full'

src/components/events/EventCard.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@/components/ui/Card';
99

1010
import { Avatar, AvatarImage } from '@/components/ui/Avatar';
11+
import { Badge } from '@/components/ui/Badge';
1112
import { cx } from '@/lib/utils';
1213
import { getTranslations } from 'next-intl/server';
1314
import Link from 'next/link';
@@ -20,6 +21,7 @@ type EventCardProps = {
2021
imagePath?: string;
2122
startTime: Date;
2223
endTime: Date;
24+
internal: boolean;
2325
locale: string;
2426
wrapperClassName?: string;
2527
cardClassName?: string;
@@ -62,6 +64,9 @@ async function EventCard(props: EventCardProps) {
6264
<CardHeader>
6365
<CardTitle>{props.title}</CardTitle>
6466
<CardDescription>{props.subheader}</CardDescription>
67+
{props.internal && (
68+
<Badge className='mx-auto w-fit rounded-full'>Internal</Badge>
69+
)}
6570
</CardHeader>
6671
<CardContent className='flex flex-col-reverse items-center gap-2 md:flex-row md:justify-between'>
6772
<p>{props.description}</p>

src/mock-data/events.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const events = [
99
endTime: '2025-01-12T19:00:00+02:00',
1010
imagePath: '/events.jpg',
1111
location: 'Hackerspace verkstedet',
12+
internal: true,
1213
},
1314
{
1415
id: 2,
@@ -21,6 +22,7 @@ export const events = [
2122
endTime: '2025-01-14T20:30:00+02:00',
2223
imagePath: '/events.jpg',
2324
location: 'R50',
25+
internal: false,
2426
},
2527
{
2628
id: 3,
@@ -32,6 +34,7 @@ export const events = [
3234
endTime: '2025-01-16T17:30:00+02:00',
3335
imagePath: '/events.jpg',
3436
location: 'Smia',
37+
internal: false,
3538
},
3639
{
3740
id: 4,
@@ -44,6 +47,7 @@ export const events = [
4447
endTime: '2025-01-22T21:00:00+02:00',
4548
imagePath: '/events.jpg',
4649
location: 'Hackerspace verkstedet',
50+
internal: false,
4751
},
4852
{
4953
id: 5,
@@ -56,6 +60,7 @@ export const events = [
5660
endTime: '2025-01-22T19:30:00+02:00',
5761
imagePath: '/events.jpg',
5862
location: 'Hackerspace verkstedet',
63+
internal: false,
5964
},
6065
{
6166
id: 6,
@@ -67,6 +72,7 @@ export const events = [
6772
endTime: '2024-10-09T17:30:00+02:00',
6873
imagePath: '/events.jpg',
6974
location: 'R51',
75+
internal: true,
7076
},
7177
{
7278
id: 7,
@@ -78,6 +84,7 @@ export const events = [
7884
endTime: '2024-10-11T19:00:00+02:00',
7985
imagePath: '/events.jpg',
8086
location: 'Hackerspace verkstedet',
87+
internal: true,
8188
},
8289
{
8390
id: 8,
@@ -90,5 +97,6 @@ export const events = [
9097
endTime: '2024-10-14T20:00:00+02:00',
9198
imagePath: '/events.jpg',
9299
location: 'R50',
100+
internal: false,
93101
},
94102
];

0 commit comments

Comments
 (0)