From 2cdd0d0259a6c0a003de51be0f57bae20a7d86fd Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 25 Nov 2022 02:29:49 -0500 Subject: [PATCH] time ago in words for in progress tab per harmeet feedback --- .../TableCellWithTimeAgoInWords.tsx | 17 ++++++ .../components/TasksForMyOpenProcesses.tsx | 9 ++- .../src/components/TasksWaitingForMe.tsx | 9 ++- .../components/TasksWaitingForMyGroups.tsx | 9 ++- spiffworkflow-frontend/src/helpers/timeago.js | 58 +++++++++++++++++++ 5 files changed, 87 insertions(+), 15 deletions(-) create mode 100644 spiffworkflow-frontend/src/components/TableCellWithTimeAgoInWords.tsx create mode 100644 spiffworkflow-frontend/src/helpers/timeago.js diff --git a/spiffworkflow-frontend/src/components/TableCellWithTimeAgoInWords.tsx b/spiffworkflow-frontend/src/components/TableCellWithTimeAgoInWords.tsx new file mode 100644 index 000000000..754c37fb5 --- /dev/null +++ b/spiffworkflow-frontend/src/components/TableCellWithTimeAgoInWords.tsx @@ -0,0 +1,17 @@ +// @ts-ignore +import { TimeAgo } from '../helpers/timeago'; +import { convertSecondsToFormattedDateTime } from '../helpers'; + +type OwnProps = { + time_in_seconds: number; +}; + +export default function TableCellWithTimeAgoInWords({ + time_in_seconds, +}: OwnProps) { + return ( + + {time_in_seconds ? TimeAgo.inWords(time_in_seconds) : '-'} + + ); +} diff --git a/spiffworkflow-frontend/src/components/TasksForMyOpenProcesses.tsx b/spiffworkflow-frontend/src/components/TasksForMyOpenProcesses.tsx index 95e082e72..05121c861 100644 --- a/spiffworkflow-frontend/src/components/TasksForMyOpenProcesses.tsx +++ b/spiffworkflow-frontend/src/components/TasksForMyOpenProcesses.tsx @@ -10,6 +10,7 @@ import { } from '../helpers'; import HttpService from '../services/HttpService'; import { PaginationObject } from '../interfaces'; +import TableCellWithTimeAgoInWords from './TableCellWithTimeAgoInWords'; const PER_PAGE_FOR_TASKS_ON_HOME_PAGE = 5; const paginationQueryParamPrefix = 'tasks_for_my_open_processes'; @@ -73,11 +74,9 @@ export default function MyOpenProcesses() { rowToUse.created_at_in_seconds ) || '-'} - - {convertSecondsToFormattedDateTime( - rowToUse.updated_at_in_seconds - ) || '-'} - +