From 7d8d9bbfb30fe8c35ffa6c9d1684ec6d076ea018 Mon Sep 17 00:00:00 2001 From: cade Date: Thu, 27 Jun 2024 16:05:47 -0700 Subject: [PATCH] handle insights when there are no events --- app/_components/event-type-form.tsx | 2 +- app/_components/form-banner.tsx | 2 +- app/_components/input-form.tsx | 2 +- app/_components/insight-form.tsx | 1 + app/_components/module-form-section.tsx | 4 ++-- app/_components/subject-insights-page.tsx | 4 ++-- app/_components/template-form.tsx | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/_components/event-type-form.tsx b/app/_components/event-type-form.tsx index f9c5ea79..a94e2fe8 100644 --- a/app/_components/event-type-form.tsx +++ b/app/_components/event-type-form.tsx @@ -115,7 +115,7 @@ const EventTypeForm = ({ isMulti label="Inputs" name={field.name} - noOptionsMessage={() => 'Type to create a new input'} + noOptionsMessage={() => 'Type to create a new input.'} onBlur={field.onBlur} onChange={field.onChange} onCreateOption={(value) => diff --git a/app/_components/form-banner.tsx b/app/_components/form-banner.tsx index ecd300a6..86a5cd78 100644 --- a/app/_components/form-banner.tsx +++ b/app/_components/form-banner.tsx @@ -90,7 +90,7 @@ const FormBanner = ({ 'No templates'} + noOptionsMessage={() => 'No templates.'} onChange={(t) => { const template = ( t as NonNullable[0] diff --git a/app/_components/subject-insights-page.tsx b/app/_components/subject-insights-page.tsx index fa48fb01..e654bc85 100644 --- a/app/_components/subject-insights-page.tsx +++ b/app/_components/subject-insights-page.tsx @@ -39,7 +39,7 @@ const SubjectInsightsPage = async ({ getCurrentUser(), ]); - if (!subject) return null; + if (!subject || !events) return null; const isTeamMember = !!user && subject.team_id === user.id; const shareOrSubjects = isPublic ? 'share' : 'subjects'; const searchObject = new URLSearchParams(searchParams); @@ -58,7 +58,7 @@ const SubjectInsightsPage = async ({ Create insight )} - {!events?.length || !insights?.length ? ( + {!insights?.length ? ( No insights. diff --git a/app/_components/template-form.tsx b/app/_components/template-form.tsx index 822e0b1b..46ef8444 100644 --- a/app/_components/template-form.tsx +++ b/app/_components/template-form.tsx @@ -123,7 +123,7 @@ const TemplateForm = ({ isMulti label="Inputs" name={field.name} - noOptionsMessage={() => 'Type to create a new input'} + noOptionsMessage={() => 'Type to create a new input.'} onBlur={field.onBlur} onChange={(value) => field.onChange(value)} onCreateOption={(value) =>