From a238610522a35775ec405368cbabc1a2fb1839b8 Mon Sep 17 00:00:00 2001 From: Sushan Yadav <53527664+sushanyadav@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:31:41 +0545 Subject: [PATCH] Reskin Project Overview - Activity section (#134) * feat: reskin w/ new design system * feat: add sepeator calc in comment * chore: limit commit message to 4 line * comment fixes * chore: use Heading component --- .../projects/project/ActivityCard.tsx | 104 ++++++++++++------ .../CustomIcon/ArrowRightCircleFilledIcon.tsx | 21 ++++ .../src/components/shared/CustomIcon/index.ts | 1 + .../pages/org-slug/projects/id/Overview.tsx | 39 +++---- 4 files changed, 109 insertions(+), 56 deletions(-) create mode 100644 packages/frontend/src/components/shared/CustomIcon/ArrowRightCircleFilledIcon.tsx diff --git a/packages/frontend/src/components/projects/project/ActivityCard.tsx b/packages/frontend/src/components/projects/project/ActivityCard.tsx index 5fa5ae82..3f3cc55e 100644 --- a/packages/frontend/src/components/projects/project/ActivityCard.tsx +++ b/packages/frontend/src/components/projects/project/ActivityCard.tsx @@ -1,45 +1,85 @@ import React from 'react'; - -import { Typography, IconButton, Avatar } from '@material-tailwind/react'; - -import { relativeTimeISO } from '../../../utils/time'; +import { Link } from 'react-router-dom'; import { GitCommitWithBranch } from '../../../types'; +import { Avatar } from 'components/shared/Avatar'; +import { Button } from 'components/shared/Button'; +import { + ArrowRightCircleFilledIcon, + BranchIcon, +} from 'components/shared/CustomIcon'; +import { formatDistance } from 'date-fns'; +import { getInitials } from 'utils/geInitials'; interface ActivityCardProps { activity: GitCommitWithBranch; } const ActivityCard = ({ activity }: ActivityCardProps) => { + const formattedDate = formatDistance( + new Date(activity.commit.author!.date!), + new Date(), + { + addSuffix: true, + }, + ); + return ( -
-
- + +
+ +
+
+ + {activity.commit.author?.name} + + + + {formattedDate} + + {/* Dot */} + + +
+ +
+ + {activity.branch.name} + +
+
+

+ {activity.commit.message} +

+
+
-
- {activity.commit.author?.name} - - {relativeTimeISO(activity.commit.author!.date!)} ^{' '} - {activity.branch.name} - - - {activity.commit.message} - -
-
- - {'>'} - -
-
+ + {/* Separator calc => 100% - 36px (avatar) - 12px (padding-left) - 8px (gap) + */} +
+ ); }; diff --git a/packages/frontend/src/components/shared/CustomIcon/ArrowRightCircleFilledIcon.tsx b/packages/frontend/src/components/shared/CustomIcon/ArrowRightCircleFilledIcon.tsx new file mode 100644 index 00000000..480f70e4 --- /dev/null +++ b/packages/frontend/src/components/shared/CustomIcon/ArrowRightCircleFilledIcon.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { CustomIcon, CustomIconProps } from './CustomIcon'; + +export const ArrowRightCircleFilledIcon = (props: CustomIconProps) => { + return ( + + + + ); +}; diff --git a/packages/frontend/src/components/shared/CustomIcon/index.ts b/packages/frontend/src/components/shared/CustomIcon/index.ts index 5de3702d..2493420c 100644 --- a/packages/frontend/src/components/shared/CustomIcon/index.ts +++ b/packages/frontend/src/components/shared/CustomIcon/index.ts @@ -32,3 +32,4 @@ export * from './GitHubLogo'; export * from './ClockIcon'; export * from './HorizontalDotIcon'; export * from './WarningDiamondIcon'; +export * from './ArrowRightCircleFilledIcon'; diff --git a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx index aee25875..21f281c1 100644 --- a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx +++ b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx @@ -1,15 +1,9 @@ import React, { useEffect, useState } from 'react'; import { Domain, DomainStatus } from 'gql-client'; -import { Link, useNavigate, useOutletContext } from 'react-router-dom'; +import { useNavigate, useOutletContext } from 'react-router-dom'; import { RequestError } from 'octokit'; -import { - Typography, - Button, - Chip, - Avatar, - Tooltip, -} from '@material-tailwind/react'; +import { Typography, Chip, Avatar, Tooltip } from '@material-tailwind/react'; import ActivityCard from '../../../../components/projects/project/ActivityCard'; import { relativeTimeMs } from '../../../../utils/time'; @@ -17,6 +11,8 @@ import { useOctokit } from '../../../../context/OctokitContext'; import { GitCommitWithBranch, OutletContextType } from '../../../../types'; import { useGQLClient } from '../../../../context/GQLClientContext'; import { formatAddress } from '../../../../utils/format'; +import { Button } from 'components/shared/Button'; +import { Heading } from 'components/shared/Heading'; const COMMITS_PER_PAGE = 4; @@ -107,9 +103,9 @@ const OverviewTabPanel = () => { }, [project]); return ( -
-
-
+
+
+
{ /> @@ -179,21 +174,17 @@ const OverviewTabPanel = () => {
No current deployment found
)}
-
-
- - Activity - - +
-
+
{activities.map((activity, index) => { return ( - - - + ); })}