Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirohonda committed Jul 31, 2024
1 parent 1a64383 commit e9794ed
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 39 deletions.
11 changes: 6 additions & 5 deletions apps/intermediate-next/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '*.svg' {
const content: any
export const ReactComponent: any
export default content
}
// not required for this project...
// declare module '*.svg' {
// const content: any
// export const ReactComponent: any
// export default content
// }
5 changes: 3 additions & 2 deletions apps/intermediate-next/src/app/dashboard/@events/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { getEventsForDashboard } from '../../../utils/events'
import { getCurrentUser } from '../../../utils/users'
import { Chip } from '@nextui-org/react'
import Link from 'next/link'
import { type StatusColours } from '../types/dashboard.types'

const statusColors = {
draft: 'warning',
live: 'success',
started: 'primary',
ended: 'disabled',
ended: 'secondary',
canceled: 'danger',
}
} satisfies StatusColours

const EventsRsvp = async () => {
const user = await getCurrentUser()
Expand Down
51 changes: 30 additions & 21 deletions apps/intermediate-next/src/app/dashboard/@rsvps/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { getRsvpsForDashboard } from '../../../utils/rsvps'
import { getCurrentUser } from '../../../utils/users'
import { Chip } from '@nextui-org/react'
import Link from 'next/link'
import { type StatusColours } from '../types/dashboard.types'

const statusColors = {
going: 'primary',
maybe: 'warning',
'not-going': 'danger',
}
} satisfies StatusColours

const RsvpsSlot = async () => {
const user = await getCurrentUser()
const data = await getRsvpsForDashboard(user.id)
Expand All @@ -17,26 +19,33 @@ const RsvpsSlot = async () => {
<div className="w-full">
<h2 className="text-center text-xl">{`RSVPs`}</h2>
<div className="rounded-md border border-default-100 my-8">
{data.map(({ rsvps, events, attendees }) => (
<div
key={rsvps.id}
className="border-b border-default-100 p-2 flex gap-2"
>
<span>{attendees.name}</span>
<span>
<Chip size="sm" color={statusColors[rsvps?.status]}>
{rsvps?.status}
</Chip>
</span>
<span>
<Link href={`/dashboard/events/${events.id}`}>
<Chip size="sm" variant="faded">
{events?.name}
</Chip>
</Link>
</span>
</div>
))}
{data.map(
({ rsvps, events, attendees }) =>
rsvps &&
events && (
<div
key={rsvps.id}
className="border-b border-default-100 p-2 flex gap-2"
>
<span>{attendees.name}</span>
<span>
<Chip
size="sm"
color={rsvps?.status && statusColors[rsvps.status]}
>
{rsvps?.status}
</Chip>
</span>
<span>
<Link href={`/dashboard/events/${events.id}`}>
<Chip size="sm" variant="faded">
{events?.name}
</Chip>
</Link>
</span>
</div>
)
)}
</div>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions apps/intermediate-next/src/app/dashboard/types/dashboard.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export type StatusColours = {
[key: string]:
| 'primary'
| 'warning'
| 'danger'
| 'default'
| 'secondary'
| 'success'
| undefined
}
15 changes: 4 additions & 11 deletions apps/intermediate-next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
"name": "next"
}
],
"types": [
"jest",
"node"
]
"types": ["jest", "node"]
},
"include": [
"**/*.ts",
Expand All @@ -29,12 +26,8 @@
"../../apps/intermediate-next/.next/types/**/*.ts",
"../../dist/apps/intermediate-next/.next/types/**/*.ts",
"next-env.d.ts",
".next/types/**/*.ts"
".next/types/**/*.ts",
"postcss.config.mjs"
],
"exclude": [
"node_modules",
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts"
]
"exclude": ["node_modules", "jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
}

0 comments on commit e9794ed

Please sign in to comment.