Skip to content

Commit

Permalink
feat: Mark internal events with badge
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroWave022 committed Oct 31, 2024
1 parent 1ff7d79 commit 6bd2d07
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/app/[locale]/(default)/events/[id]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Avatar, AvatarImage } from '@/components/ui/Avatar';
import { Separator } from '@/components/ui/Separator';
import { Skeleton } from '@/components/ui/Skeleton';
import { ArrowLeftIcon, CalendarIcon, MapPinIcon } from 'lucide-react';
import { CalendarIcon, MapPinIcon } from 'lucide-react';

export default function EventDetailsLoading() {
return (
Expand Down
2 changes: 2 additions & 0 deletions src/app/[locale]/(default)/events/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Separator } from '@/components/ui/Separator';
import { events } from '@/mock-data/events';
import { CalendarIcon, MapPinIcon } from 'lucide-react';
import { notFound } from 'next/navigation';
import { Badge } from '@/components/ui/Badge';

export async function generateMetadata({
params,
Expand Down Expand Up @@ -57,6 +58,7 @@ export default async function EventDetailsPage({
<h1 className='my-4'>{event.title}</h1>
<h3>{event.subheader}</h3>
<div className='mt-4 space-y-4'>
{event.internal && <Badge className='rounded-full'>Internal</Badge>}
<div className='flex items-center gap-2'>
<CalendarIcon className='h-8 w-8' />
{
Expand Down
3 changes: 3 additions & 0 deletions src/app/[locale]/(default)/events/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default async function EventsPage({
imagePath={event.imagePath}
startTime={new Date(event.startTime)}
endTime={new Date(event.endTime)}
internal={event.internal}
locale={locale}
_active
/>
Expand All @@ -57,6 +58,7 @@ export default async function EventsPage({
imagePath={event.imagePath}
startTime={new Date(event.startTime)}
endTime={new Date(event.endTime)}
internal={event.internal}
locale={locale}
wrapperClassName='lg:last:odd:col-span-2'
cardClassName='h-full'
Expand All @@ -75,6 +77,7 @@ export default async function EventsPage({
imagePath={event.imagePath}
startTime={new Date(event.startTime)}
endTime={new Date(event.endTime)}
internal={event.internal}
locale={locale}
wrapperClassName='lg:last:odd:col-span-2'
cardClassName='h-full'
Expand Down
5 changes: 5 additions & 0 deletions src/components/events/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@/components/ui/Card';

import { Avatar, AvatarImage } from '@/components/ui/Avatar';
import { Badge } from '@/components/ui/Badge';
import { cx } from '@/lib/utils';
import { getTranslations } from 'next-intl/server';
import Link from 'next/link';
Expand All @@ -20,6 +21,7 @@ type EventCardProps = {
imagePath?: string;
startTime: Date;
endTime: Date;
internal: boolean;
locale: string;
wrapperClassName?: string;
cardClassName?: string;
Expand Down Expand Up @@ -62,6 +64,9 @@ async function EventCard(props: EventCardProps) {
<CardHeader>
<CardTitle>{props.title}</CardTitle>
<CardDescription>{props.subheader}</CardDescription>
{props.internal && (
<Badge className='mx-auto w-fit rounded-full'>Internal</Badge>
)}
</CardHeader>
<CardContent className='flex flex-col-reverse items-center gap-2 md:flex-row md:justify-between'>
<p>{props.description}</p>
Expand Down
8 changes: 8 additions & 0 deletions src/mock-data/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const events = [
endTime: '2025-01-12T19:00:00+02:00',
imagePath: '/events.jpg',
location: 'Hackerspace verkstedet',
internal: true,
},
{
id: 2,
Expand All @@ -21,6 +22,7 @@ export const events = [
endTime: '2025-01-14T20:30:00+02:00',
imagePath: '/events.jpg',
location: 'R50',
internal: false,
},
{
id: 3,
Expand All @@ -32,6 +34,7 @@ export const events = [
endTime: '2025-01-16T17:30:00+02:00',
imagePath: '/events.jpg',
location: 'Smia',
internal: false,
},
{
id: 4,
Expand All @@ -44,6 +47,7 @@ export const events = [
endTime: '2025-01-22T21:00:00+02:00',
imagePath: '/events.jpg',
location: 'Hackerspace verkstedet',
internal: false,
},
{
id: 5,
Expand All @@ -56,6 +60,7 @@ export const events = [
endTime: '2025-01-22T19:30:00+02:00',
imagePath: '/events.jpg',
location: 'Hackerspace verkstedet',
internal: false,
},
{
id: 6,
Expand All @@ -67,6 +72,7 @@ export const events = [
endTime: '2024-10-09T17:30:00+02:00',
imagePath: '/events.jpg',
location: 'R51',
internal: true,
},
{
id: 7,
Expand All @@ -78,6 +84,7 @@ export const events = [
endTime: '2024-10-11T19:00:00+02:00',
imagePath: '/events.jpg',
location: 'Hackerspace verkstedet',
internal: true,
},
{
id: 8,
Expand All @@ -90,5 +97,6 @@ export const events = [
endTime: '2024-10-14T20:00:00+02:00',
imagePath: '/events.jpg',
location: 'R50',
internal: false,
},
];

0 comments on commit 6bd2d07

Please sign in to comment.