Skip to content

Commit

Permalink
✨ Make venue page pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshHeng committed May 28, 2024
1 parent fec3e8f commit bf64924
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/venues/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default async function Venue({
<p>{venue.description}</p>
{venue.campus_map_url && (
<a href={venue.campus_map_url} className="text-accent" target="_blank">
Campus Map
View on Campus Map
</a>
)}

Expand Down
21 changes: 9 additions & 12 deletions src/app/venues/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ export default async function Venues() {
</strong>{' '}
across our <strong>{venues.length} venues</strong>.
</p>
<p>
You can find our full weekend&apos;s schedule here or in our printed
programmes - simply head to one of our{' '}
<a href="/venues" className="text-accent">
venues
</a>{' '}
to pick one up!
</p>
<div className="flex gap-2 justify-center flex-wrap m-4 mt-2">
<a
href="/events"
Expand All @@ -61,15 +53,20 @@ export default async function Venues() {
</div>
</div>

<div className="flex gap-4 flex-wrap justify-center">
<div className="max-w-7xl mx-auto px-4 flex gap-4 flex-wrap justify-center">
{venues.map((venue) => (
<a
key={venue.id}
href={`/venues/${venue.slug || ''}`}
className="hover:scale-105"
className="hover:scale-105 bg-accent"
>
<article className="bg-secondary p-4">
<h3 className="uppercase text-lg">{venue.name}</h3>
<article className="p-4 text-black max-w-64">
<h3 className="uppercase text-lg font-bold">{venue.name}</h3>
<p className="uppercase text-xs font-bold">
{venue._count.schedule_eventinstance} Event
{venue._count.schedule_eventinstance === 1 ? '' : 's'}
</p>
<p className="text-sm mt-1">{venue.description}</p>
</article>
</a>
))}
Expand Down
15 changes: 14 additions & 1 deletion src/lib/venues.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import prisma from '@/lib/prisma';

export function getVenues() {
return prisma.schedule_venue.findMany();
return prisma.schedule_venue.findMany({
include: {
_count: {
select: {
schedule_eventinstance: {
where: {
published: true,
parent_id: null,
},
},
},
},
},
});
}

export function getVenueCount() {
Expand Down

0 comments on commit bf64924

Please sign in to comment.