diff --git a/src/components/pages/Roles/RoleCard.tsx b/src/components/pages/Roles/RoleCard.tsx index 58eef1aeb7..68f9980ac5 100644 --- a/src/components/pages/Roles/RoleCard.tsx +++ b/src/components/pages/Roles/RoleCard.tsx @@ -16,9 +16,11 @@ import { EditBadgeStatus, RoleEditProps, RoleProps, SablierPayment } from './typ export function AvatarAndRoleName({ wearerAddress, name, + payments, }: { wearerAddress: string | undefined; name: string; + payments?: SablierPayment[]; }) { const { addressPrefix } = useNetworkConfig(); const { daoName: accountDisplayName } = useGetDAOName({ @@ -59,6 +61,37 @@ export function AvatarAndRoleName({ > {wearerAddress ? accountDisplayName : t('unassigned')} + {payments && ( + + + {t('activePayments')} + + + + {payments.length} + + + + )} ); @@ -156,25 +189,15 @@ export function RoleCard({ - - {payments && - payments.map((payment, index) => ( - - ))} ); } diff --git a/src/components/pages/Roles/RolesTable.tsx b/src/components/pages/Roles/RolesTable.tsx index 08516bf7ff..3b164c70a4 100644 --- a/src/components/pages/Roles/RolesTable.tsx +++ b/src/components/pages/Roles/RolesTable.tsx @@ -1,6 +1,5 @@ -import { Box, Flex, Icon, Image, Table, Tbody, Td, Text, Th, Thead, Tr } from '@chakra-ui/react'; +import { Box, Flex, Icon, Table, Tbody, Td, Text, Th, Thead, Tr } from '@chakra-ui/react'; import { PencilLine } from '@phosphor-icons/react'; -import { formatDuration, intervalToDuration } from 'date-fns'; import { useFormikContext } from 'formik'; import { useTranslation } from 'react-i18next'; import { Address, Hex, getAddress, zeroAddress } from 'viem'; @@ -9,7 +8,6 @@ import useAvatar from '../../../hooks/utils/useAvatar'; import { useNetworkConfig } from '../../../providers/NetworkConfig/NetworkConfigProvider'; import { DecentTree, useRolesStore } from '../../../store/roles'; import { getChainIdFromPrefix } from '../../../utils/url'; -import EtherscanLink from '../../ui/links/EtherscanLink'; import Avatar from '../../ui/page/Header/Avatar'; import EditBadge from './EditBadge'; import { RoleCardLoading, RoleCardNoRoles } from './RolePageCard'; @@ -22,6 +20,8 @@ function RolesHeader() { sx={{ th: { padding: '0.75rem', + textTransform: 'none', + fontWeight: 'normal', }, }} bg="white-alpha-04" @@ -30,33 +30,25 @@ function RolesHeader() { textStyle="label-base" color="neutral-7" > - {t('role')} - {t('member')} - {t('payment')} - {t('payment')} + + {t('role')} + + {t('member')} + + {t('activePayments')} + ); } -function RoleNameColumn({ roleName }: { roleName: string }) { - return ( - - - - {roleName} - - - - ); -} - function RoleNameEditColumn({ roleName, editStatus, @@ -65,7 +57,10 @@ function RoleNameEditColumn({ editStatus?: EditBadgeStatus; }) { return ( - + - + + {wearerAddress ? ( )} - - - {wearerAddress ? accountDisplayName : t('unassigned')} - - + {wearerAddress ? accountDisplayName : t('unassigned')} + ); } -function PaymentColumn({ payment }: { payment: SablierPayment | undefined }) { - const { t } = useTranslation(['roles']); - const format = ['years', 'days', 'hours']; - const endDate = - payment?.scheduleFixedDate?.endDate && - formatDuration( - intervalToDuration({ - start: payment.scheduleFixedDate.startDate, - end: payment.scheduleFixedDate.endDate, - }), - { format }, - ); - const cliffDate = - payment?.scheduleFixedDate?.cliffDate && - formatDuration( - intervalToDuration({ - start: payment.scheduleFixedDate.startDate, - end: payment.scheduleFixedDate.cliffDate, - }), - { format }, - ); +function PaymentsColumn({ payments }: { payments?: SablierPayment[] }) { + const { t } = useTranslation('common'); return ( - - {payment ? ( - - - {payment.asset.symbol} - {payment.amount?.value} - - {payment.asset.symbol} - - - {endDate && `${t('after')} ${endDate}`} - - - {cliffDate && `${t('cliff')} ${t('after')} ${cliffDate}`} + + {payments ? ( + + {payments.length} ) : ( - - {t('n/a')} - + t('none') )} ); @@ -224,10 +176,16 @@ export function RolesRow({ name, wearerAddress, payments, handleRoleClick, hatId transition="all ease-out 300ms" onClick={() => handleRoleClick(hatId)} > - + + {name} + - - + ); } @@ -257,8 +215,7 @@ export function RolesRowEdit({ editStatus={editStatus} /> - - + ); } diff --git a/src/i18n/locales/en/common.json b/src/i18n/locales/en/common.json index 22af9c8665..e54e6c4cd2 100644 --- a/src/i18n/locales/en/common.json +++ b/src/i18n/locales/en/common.json @@ -110,5 +110,6 @@ "show": "Show", "hide": "Hide", "poweredBy": "Powered by", - "goTo": "Go to" + "goTo": "Go to", + "none": "None" } diff --git a/src/i18n/locales/en/roles.json b/src/i18n/locales/en/roles.json index f3ee922839..39fd5b823a 100644 --- a/src/i18n/locales/en/roles.json +++ b/src/i18n/locales/en/roles.json @@ -54,6 +54,7 @@ "hours": "Hours", "cliff": "Cliff", "cliffSubTitle": "How long until the assets are claimable?", + "activePayments": "Active Payments", "payments": "Payments", "payment": "Payment", "withdraw": "Withdraw",