From e0e4ec7522549e71d3468f6a0f0c504cc37a0b08 Mon Sep 17 00:00:00 2001 From: wwayne Date: Thu, 25 Apr 2024 12:38:36 +0800 Subject: [PATCH 1/4] 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)} > From 6feae29fb65e1818557c2756dd618bfe5b56bc6e Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 04:52:14 +0000 Subject: [PATCH 2/4] [autofix.ci] apply automated fixes --- .../activities/components/activity.tsx | 247 +++++++++--------- ee/tabby-ui/components/date-range-picker.tsx | 2 +- 2 files changed, 128 insertions(+), 121 deletions(-) diff --git a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx index 27a4550a20c7..3dacaae937d2 100644 --- a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx +++ b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx @@ -1,13 +1,13 @@ 'use client' import React from 'react' +import { capitalize } from 'lodash-es' import moment from 'moment' import { useTheme } from 'next-themes' 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' @@ -144,141 +144,148 @@ export default function Activity() {

- View a log of code completion events. Tracing the progression from initiation to final insertion. + View a log of code completion events. Tracing the progression + from initiation to final insertion.

{!fetching && (
- + +
+
+ +
-
- - - - All members - {members.map(member => ( - - {member.email} + + + + + All members - ))} - - - + {members.map(member => ( + + {member.email} + + ))} + + + - -
+ + )} - <> - - {(!data?.userEvents.edges || - data?.userEvents.edges.length === 0) && ( - - -

- No data available for the chosen dates -

-

- Please try a different date range -

-
- )} - - {data?.userEvents.edges && data?.userEvents.edges.length > 0 && ( - <> - - - - - Event - User - Time - - - - {userEvents?.edges - .sort( - (a, b) => - new Date(b.node.createdAt).getTime() - - new Date(a.node.createdAt).getTime() - ) - .map(userEvent => ( - - ))} - -
+ + {(!data?.userEvents.edges || + data?.userEvents.edges.length === 0) && ( + + +

+ No data available for the chosen dates +

+

+ Please try a different date range +

- - )} -
+ )} - {(data?.userEvents.pageInfo?.hasNextPage || - data?.userEvents.pageInfo?.hasPreviousPage) && ( -
-
- {' '} - Page {page} -
-
- - + {data?.userEvents.edges && + data?.userEvents.edges.length > 0 && ( + <> + + + + + + Event + + + User + + + Time + + + + + {userEvents?.edges + .sort( + (a, b) => + new Date(b.node.createdAt).getTime() - + new Date(a.node.createdAt).getTime() + ) + .map(userEvent => ( + + ))} + +
+
+ + )} + + + {(data?.userEvents.pageInfo?.hasNextPage || + data?.userEvents.pageInfo?.hasPreviousPage) && ( +
+
+ {' '} + Page {page} +
+
+ + +
-
- )} + )} - -
diff --git a/ee/tabby-ui/components/date-range-picker.tsx b/ee/tabby-ui/components/date-range-picker.tsx index 7e1a3cc0f28c..14e66172a28c 100644 --- a/ee/tabby-ui/components/date-range-picker.tsx +++ b/ee/tabby-ui/components/date-range-picker.tsx @@ -148,7 +148,7 @@ export default function DateRangePicker({ onOpenChange={onDateFilterOpenChange} > setShowDateFilter(!showDateFilter)} > From 09111a66c8c0f71ef7653e2c7d27f9db73e8f789 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Wed, 24 Apr 2024 21:53:59 -0700 Subject: [PATCH 3/4] Update ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx --- ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx index 3dacaae937d2..8f6226f5fc76 100644 --- a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx +++ b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx @@ -144,8 +144,7 @@ export default function Activity() {

- View a log of code completion events. Tracing the progression - from initiation to final insertion. +View raw events generated by team members' activities while interacting with Tabby.

{!fetching && ( From cd8ddce4d6c8c35c350e6c7520e841b11cbaad08 Mon Sep 17 00:00:00 2001 From: wwayne Date: Thu, 25 Apr 2024 13:21:08 +0800 Subject: [PATCH 4/4] fix lint --- .../app/(dashboard)/activities/components/activity.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx index 8f6226f5fc76..b7b8f0e2ef32 100644 --- a/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx +++ b/ee/tabby-ui/app/(dashboard)/activities/components/activity.tsx @@ -143,9 +143,7 @@ export default function Activity() {
-

-View raw events generated by team members' activities while interacting with Tabby. -

+

{`View raw events generated by team members' activities while interacting with Tabby.`}

{!fetching && (