Skip to content

Commit fe52de9

Browse files
committed
feat: show participant and feedback count
1 parent 6b7b67c commit fe52de9

File tree

2 files changed

+53
-16
lines changed

2 files changed

+53
-16
lines changed
Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
import { Retrospective } from '@prisma/client'
1+
import { Prisma } from '@prisma/client'
2+
import { IconArrowRight, IconUser } from '@tabler/icons-react'
3+
import { MessageCircle } from 'lucide-react'
24
import Link from 'next/link'
35

46
import { EditRetro } from '@/app/dashboard/retros/components/edit-retro'
7+
import { Button } from '@/app/ui/button/button'
58
import {
69
Card,
10+
CardContent,
711
CardDescription,
812
CardHeader,
913
CardTitle,
1014
} from '@/app/ui/card/card'
1115
import { RetrospectiveUpdateInput } from '@/types/retrospective'
1216
import { formatDate } from '@/utils/utils'
1317

18+
type RetroWithRelations = Prisma.RetrospectiveGetPayload<{
19+
include: {
20+
items: true
21+
participants: true
22+
}
23+
}>
24+
1425
type RetroCardProps = {
15-
retrospective: Retrospective
26+
retrospective: RetroWithRelations
1627
handleUpdateRetro: (input: RetrospectiveUpdateInput) => void
1728
}
1829

@@ -23,7 +34,7 @@ export function RetroCard({
2334
return (
2435
<Card
2536
key={retrospective.id}
26-
className='h-full w-full shadow-sm transition ease-in-out hover:scale-105'
37+
className='h-full w-full shadow-sm transition duration-200 ease-in-out hover:ring-2 hover:ring-primary hover:ring-offset-2 dark:hover:ring-secondary'
2738
>
2839
<CardHeader>
2940
<CardTitle className='flex items-baseline justify-between'>
@@ -35,19 +46,41 @@ export function RetroCard({
3546
</CardTitle>
3647
<CardDescription>{formatDate(retrospective.date)}</CardDescription>
3748
</CardHeader>
38-
<Link
39-
className='hover:cursor-pointer'
40-
href={{
41-
pathname: '/retro',
42-
query: {
43-
id: retrospective.id,
44-
name: retrospective.name,
45-
},
46-
}}
47-
aria-label='Go to retro view'
48-
>
49-
<div className='pattern-cross h-28 pattern-bg-transparent pattern-foreground pattern-opacity-5 pattern-size-4' />
50-
</Link>
49+
50+
<CardContent className='flex justify-between text-muted-foreground'>
51+
<div className='flex flex-col gap-2'>
52+
<p className='flex items-center gap-2'>
53+
<IconUser size={18} />
54+
{retrospective.participants.length}
55+
<p>Participants</p>
56+
</p>
57+
<p className='flex items-center gap-2'>
58+
<MessageCircle size={18} />
59+
{retrospective.items.length}
60+
<p>Feedback items</p>
61+
</p>
62+
</div>
63+
<Button
64+
variant='link'
65+
size='lg'
66+
className='self-end justify-self-end pr-0'
67+
>
68+
<Link
69+
className='flex items-center'
70+
href={{
71+
pathname: '/retro',
72+
query: {
73+
id: retrospective.id,
74+
name: retrospective.name,
75+
},
76+
}}
77+
aria-label='Go to retro view'
78+
>
79+
Open
80+
<IconArrowRight size={18} />
81+
</Link>
82+
</Button>
83+
</CardContent>
5184
</Card>
5285
)
5386
}

src/server/api/routers/retrospective.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export const retrospectiveRouter = createTRPCRouter({
2626

2727
return ctx.db.retrospective.findMany({
2828
where: filters,
29+
include: {
30+
items: true,
31+
participants: true,
32+
},
2933
orderBy: { date: 'desc' },
3034
})
3135
}),

0 commit comments

Comments
 (0)