Skip to content

Commit

Permalink
fix: react-timeago issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymek committed Aug 20, 2024
1 parent 8e2ae6c commit ced8468
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/src/component/application/ApplicationChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export const ApplicationChart = ({ data }: IApplicationChartProps) => {
<StyledCell>
{environment.lastSeen && (
<TimeAgo
key={`${environment.lastSeen}`}
minPeriod={60}
date={
new Date(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const FeatureArchivedCell: VFC<IFeatureArchivedCellProps> = ({
>
<Typography noWrap variant='body2' data-loading>
<TimeAgo
key={`${archivedAt}`}
date={new Date(archivedAt)}
title=''
live={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ChangeRequestComment: FC<{ comment: IChangeRequestComment }> = ({
<Typography color='text.secondary' component='span'>
commented{' '}
<TimeAgo
key={`${comment.createdAt}`}
minPeriod={60}
date={new Date(comment.createdAt)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ChangeRequestHeader: FC<{ changeRequest: ChangeRequestType }> = ({
>
Created{' '}
<TimeAgo
key={`${changeRequest.createdAt}`}
minPeriod={60}
date={new Date(changeRequest.createdAt)}
/>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const Notification = ({

<StyledTimeAgoTypography>
<TimeAgo
key={`${notification.createdAt}`}
date={new Date(notification.createdAt)}
minPeriod={60}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const FeatureSeenCell: VFC<IFeatureSeenCellProps> = ({
condition={Boolean(lastSeenAt)}
show={
<TimeAgo
key={`${lastSeenAt}`}
date={lastSeenAt!}
title=''
live={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const LastSeenTooltip = ({
condition={Boolean(lastSeenAt)}
show={
<TimeAgo
key={`${lastSeenAt}`}
date={lastSeenAt!}
title=''
live={false}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tooltip, Typography } from '@mui/material';
import { useLocationSettings } from 'hooks/useLocationSettings';
import type { VFC } from 'react';
import type { FC } from 'react';
import { formatDateYMD } from 'utils/formatDate';
import { TextCell } from '../TextCell/TextCell';
import TimeAgo from 'react-timeago';
Expand All @@ -13,7 +13,7 @@ interface ITimeAgoCellProps {
dateFormat?: (value: string | number | Date, locale: string) => string;
}

export const TimeAgoCell: VFC<ITimeAgoCellProps> = ({
export const TimeAgoCell: FC<ITimeAgoCellProps> = ({
value,
live = false,
emptyText,
Expand All @@ -35,7 +35,12 @@ export const TimeAgoCell: VFC<ITimeAgoCellProps> = ({
variant='body2'
data-loading
>
<TimeAgo date={new Date(value)} live={live} title={''} />
<TimeAgo
key={`${value}`}
date={new Date(value)}
live={live}
title={''}
/>
</Typography>
</Tooltip>
</TextCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const FeatureEnvironmentSeen = ({
<>
{lastSeen ? (
<TimeAgo
key={`${lastSeen}`}
date={lastSeen}
title=''
live={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const LastSeenIcon: FC<{

return (
<TimeAgo
key={`${lastSeen}`}
date={lastSeen}
title=''
live={false}
Expand Down Expand Up @@ -230,6 +231,7 @@ const Environments: FC<{
</CenteredBox>
<CenteredBox>
<TimeAgo
key={`${environment.lastSeenAt}`}
minPeriod={60}
date={environment.lastSeenAt}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const ProjectArchiveCard: FC<ProjectArchiveCardProps> = ({
<p data-loading>
Archived:{' '}
<TimeAgo
key={`${archivedAt}`}
minPeriod={60}
date={
new Date(archivedAt as string)
Expand Down

0 comments on commit ced8468

Please sign in to comment.