From 8566b4c3daa57feef7786733ee0e552219035a79 Mon Sep 17 00:00:00 2001 From: Johannes <72809645+jobenjada@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:32:12 -0700 Subject: [PATCH] fix: survey list spacing and loading (#4003) --- .../surveys/components/SurveyCard.tsx | 65 +++++++++---------- .../surveys/components/SurveyDropdownMenu.tsx | 15 +++-- .../surveys/components/SurveyList.tsx | 4 +- .../surveys/components/SurveyLoading.tsx | 15 +++-- packages/lib/time.ts | 5 +- 5 files changed, 55 insertions(+), 49 deletions(-) diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyCard.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyCard.tsx index 406fe4cc97..ffd9b73762 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyCard.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyCard.tsx @@ -71,41 +71,40 @@ export const SurveyCard = ({ }, [survey.status, survey.id, environment.id]); return ( - -
-
{survey.name}
-
-
- {surveyStatusLabel}{" "} -
-
- {survey.responseCount} -
-
- -
+ +
+
+
{survey.name}
+
+
+ {surveyStatusLabel}{" "} +
+
+ {survey.responseCount} +
+
+ +
-
- {convertDateString(survey.createdAt.toString())} +
+ {convertDateString(survey.createdAt.toString())} +
+
+ {timeSince(survey.updatedAt.toString())} +
+
+ {survey.creator ? survey.creator.name : "-"} +
-
- {timeSince(survey.updatedAt.toString())} -
-
- {survey.creator ? survey.creator.name : "-"} -
-
+
e.stopPropagation()}> -
+
Open options
diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyList.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyList.tsx index f259a62dfb..495676eac8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyList.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyList.tsx @@ -137,8 +137,8 @@ export const SurveysList = ({ {surveys.length > 0 ? (
-
-
Name
+
+
Name
Status
Responses
Type
diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyLoading.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyLoading.tsx index 751ca87894..7d16e907e2 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyLoading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/components/SurveyLoading.tsx @@ -2,20 +2,21 @@ export const SurveyLoading = () => { return ( -
+
{[1, 2, 3, 4, 5].map((i) => { return (
+ className="relative flex h-16 flex-col justify-between rounded-xl border border-slate-200 bg-white p-4 shadow-sm transition-all ease-in-out">
-
+
+
+
+
+
+
-
-
-
-
); })} diff --git a/packages/lib/time.ts b/packages/lib/time.ts index beb2315947..a33813a202 100644 --- a/packages/lib/time.ts +++ b/packages/lib/time.ts @@ -1,5 +1,4 @@ -import { formatDistance } from "date-fns"; -import { intlFormat } from "date-fns"; +import { formatDistance, intlFormat } from "date-fns"; export const convertDateString = (dateString: string) => { if (!dateString) { @@ -10,7 +9,7 @@ export const convertDateString = (dateString: string) => { date, { year: "numeric", - month: "long", + month: "short", day: "numeric", }, {