From e0e4ec7522549e71d3468f6a0f0c504cc37a0b08 Mon Sep 17 00:00:00 2001 From: wwayne Date: Thu, 25 Apr 2024 12:38:36 +0800 Subject: [PATCH] fix(ui): style polishment for activities page --- .../activities/components/activity.tsx | 197 ++++++++++-------- ee/tabby-ui/components/date-range-picker.tsx | 6 +- 2 files changed, 110 insertions(+), 93 deletions(-) diff --git a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx index 61345a6a3296..27a4550a20c7 100644 --- a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx +++ b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx @@ -7,6 +7,7 @@ import { DateRange } from 'react-day-picker' import ReactJson from 'react-json-view' import { toast } from 'sonner' import { useQuery } from 'urql' +import { capitalize } from 'lodash-es' import { DEFAULT_PAGE_SIZE } from '@/lib/constants' import { graphql } from '@/lib/gql/generates' @@ -137,48 +138,59 @@ export default function Activity() { } return ( - + <>
-
-
-
- + +
+
+ +
-
- - - - All members - {members.map(member => ( - - {member.email} - - ))} - - - + + + + All members + {members.map(member => ( + + {member.email} + + ))} + + + - + +
+ )} +
- - + + <> + {(!data?.userEvents.edges || data?.userEvents.edges.length === 0) && ( @@ -194,13 +206,13 @@ export default function Activity() { {data?.userEvents.edges && data?.userEvents.edges.length > 0 && ( <> - + - Event - People - Time + Event + User + Time @@ -219,54 +231,58 @@ export default function Activity() { ))}
-
- - )} -
+ + + )} +
- {(data?.userEvents.pageInfo?.hasNextPage || - data?.userEvents.pageInfo?.hasPreviousPage) && ( -
-
- {' '} - Page {page} -
-
- - + {(data?.userEvents.pageInfo?.hasNextPage || + data?.userEvents.pageInfo?.hasPreviousPage) && ( +
+
+ {' '} + Page {page} +
+
+ + +
-
- )} + )} + + + +
-
+ ) } @@ -278,7 +294,6 @@ function ActivityRow({ members: Member[] }) { const { theme } = useTheme() - // const [members] = useAllMembers() const [isExpanded, setIsExpanded] = React.useState(false) let payloadJson @@ -321,19 +336,19 @@ function ActivityRow({ className="cursor-pointer text-sm" onClick={() => setIsExpanded(!isExpanded)} > - + - {activity.kind} + {capitalize(activity.kind)}

{tooltip}

- + {members.find(user => user.id === activity.userId)?.email || activity.userId} - + {moment(activity.createdAt).isBefore(moment().subtract(1, 'days')) ? moment(activity.createdAt).format('YYYY-MM-DD HH:mm') : moment(activity.createdAt).fromNow()} @@ -342,7 +357,7 @@ function ActivityRow({ {isExpanded && ( - + void defaultValue?: string hasToday?: boolean hasYesterday?: boolean + className?: string }) { defaultValue = defaultValue || options[0].value const defaultDate = parseDateValue(defaultValue) @@ -146,7 +148,7 @@ export default function DateRangePicker({ onOpenChange={onDateFilterOpenChange} > setShowDateFilter(!showDateFilter)} >