From 8207f15a839323404044cb91998a4353edc6608b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Mon, 22 Apr 2024 21:07:31 +0200 Subject: [PATCH] minor visual tweaks --- .../dashboards/[dashboardId]/list-reports.tsx | 9 +--- .../profiles/profile-last-seen/index.tsx | 49 ++++++++----------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/dashboards/[dashboardId]/list-reports.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/dashboards/[dashboardId]/list-reports.tsx index 5768a2f6..852d3409 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/dashboards/[dashboardId]/list-reports.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/dashboards/[dashboardId]/list-reports.tsx @@ -62,7 +62,7 @@ export function ListReports({ reports }: ListReportsProps) { Report -
+
{reports.map((report) => { const chartRange = report.range; // timeRanges[report.range]; return ( @@ -122,12 +122,7 @@ export function ListReports({ reports }: ListReportsProps) { />
-
+
( - `SELECT age('days',created_at, now()) as days, count(distinct profile_id) as count FROM events where project_id = ${escape(projectId)} group by days order by days ASC` + `SELECT age('days',created_at, now()) as days, count(distinct profile_id) as count FROM events where project_id = ${escape(projectId)} group by days order by days ASC LIMIT 51` ); - const take = 18; - const split = take / 2; - const max = Math.max(...res.map((item) => item.count)); + const maxValue = Math.max(...res.map((x) => x.count)); + const minValue = Math.min(...res.map((x) => x.count)); + const calculateRatio = (currentValue: number) => + Math.max( + 0.1, + Math.min(1, (currentValue - minValue) / (maxValue - minValue)) + ); + const renderItem = (item: Row) => ( -
+
-
-
-
+
{item.count} profiles last seen{' '} {item.days === 0 ? 'today' : `${item.days} days ago`} -
{item.days}
+
{item.days}
); + return (
Last seen
-
- {res.length >= 18 ? ( - <> - {res.slice(0, split).map(renderItem)} - {res.slice(-split).map(renderItem)} - - ) : ( - res.map(renderItem) - )} +
+ {res.map(renderItem)}
DAYS