diff --git a/app/routes/admin+/_horses+/horses.edit.$horseId.tsx b/app/routes/admin+/_horses+/horses.edit.$horseId.tsx index 7aadcef..38e58d7 100644 --- a/app/routes/admin+/_horses+/horses.edit.$horseId.tsx +++ b/app/routes/admin+/_horses+/horses.edit.$horseId.tsx @@ -70,8 +70,14 @@ export async function action({ request, params }: DataFunctionArgs) { ) } - const { name, notes, status, cooldown, cooldownStartDate, cooldownEndDate } = - submission.value + const { + name, + notes = '', + status = '', + cooldown, + cooldownStartDate, + cooldownEndDate, + } = submission.value const updatedHorse = await prisma.horse.update({ where: { id: params.horseId }, @@ -278,31 +284,29 @@ export default function EditHorse() { /> ) : null} - {conflictEvents ? ( + {conflictEvents && conflictEvents.length > 0 ? ( Horse removed from {conflictEvents.length}{' '} - {conflictEvents.length > 1 ? 'events' : 'event'} + {conflictEvents.length === 1 ? 'event' : 'events'}
    - {conflictEvents - ? conflictEvents.map(e => { - const date = format(new Date(e.start), 'MMMM do, yyyy') - const link = `/calendar/${e.id}` - return ( - <> -
  • - - {e.title} - - {date} - -
  • - - ) - }) - : null} + {conflictEvents.map(e => { + const date = format(new Date(e.start), 'MMMM do, yyyy') + const link = `/calendar/${e.id}` + return ( + <> +
  • + + {e.title} - + {date} + +
  • + + ) + })}