From e9794eda0f83e3f000f23bacd9ee5dccc30cd6b3 Mon Sep 17 00:00:00 2001 From: takahirohonda Date: Thu, 1 Aug 2024 09:29:11 +1000 Subject: [PATCH] Update --- apps/intermediate-next/index.d.ts | 11 ++-- .../src/app/dashboard/@events/page.tsx | 5 +- .../src/app/dashboard/@rsvps/page.tsx | 51 +++++++++++-------- .../app/dashboard/types/dashboard.types.ts | 10 ++++ apps/intermediate-next/tsconfig.json | 15 ++---- 5 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 apps/intermediate-next/src/app/dashboard/types/dashboard.types.ts diff --git a/apps/intermediate-next/index.d.ts b/apps/intermediate-next/index.d.ts index a9ab534..c645be5 100644 --- a/apps/intermediate-next/index.d.ts +++ b/apps/intermediate-next/index.d.ts @@ -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 +// } diff --git a/apps/intermediate-next/src/app/dashboard/@events/page.tsx b/apps/intermediate-next/src/app/dashboard/@events/page.tsx index 16860d2..2e0a3e0 100644 --- a/apps/intermediate-next/src/app/dashboard/@events/page.tsx +++ b/apps/intermediate-next/src/app/dashboard/@events/page.tsx @@ -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() diff --git a/apps/intermediate-next/src/app/dashboard/@rsvps/page.tsx b/apps/intermediate-next/src/app/dashboard/@rsvps/page.tsx index 265d0f2..57642c4 100644 --- a/apps/intermediate-next/src/app/dashboard/@rsvps/page.tsx +++ b/apps/intermediate-next/src/app/dashboard/@rsvps/page.tsx @@ -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) @@ -17,26 +19,33 @@ const RsvpsSlot = async () => {

{`RSVPs`}

- {data.map(({ rsvps, events, attendees }) => ( -
- {attendees.name} - - - {rsvps?.status} - - - - - - {events?.name} - - - -
- ))} + {data.map( + ({ rsvps, events, attendees }) => + rsvps && + events && ( +
+ {attendees.name} + + + {rsvps?.status} + + + + + + {events?.name} + + + +
+ ) + )}
diff --git a/apps/intermediate-next/src/app/dashboard/types/dashboard.types.ts b/apps/intermediate-next/src/app/dashboard/types/dashboard.types.ts new file mode 100644 index 0000000..42f73cc --- /dev/null +++ b/apps/intermediate-next/src/app/dashboard/types/dashboard.types.ts @@ -0,0 +1,10 @@ +export type StatusColours = { + [key: string]: + | 'primary' + | 'warning' + | 'danger' + | 'default' + | 'secondary' + | 'success' + | undefined +} diff --git a/apps/intermediate-next/tsconfig.json b/apps/intermediate-next/tsconfig.json index 1731c88..5ffa726 100644 --- a/apps/intermediate-next/tsconfig.json +++ b/apps/intermediate-next/tsconfig.json @@ -16,10 +16,7 @@ "name": "next" } ], - "types": [ - "jest", - "node" - ] + "types": ["jest", "node"] }, "include": [ "**/*.ts", @@ -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"] }