From c06bd1d7366abc2773e29ba782dd3b526b5b6d7b Mon Sep 17 00:00:00 2001 From: Siarhei Iukou Date: Mon, 21 Oct 2024 15:29:29 +0300 Subject: [PATCH] EPMRPP-96345 || Code Review fix - 1 --- .../organizationCard/organizationCard.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/pages/instance/organizationsPage/organizationsPanelView/organizationCard/organizationCard.jsx b/app/src/pages/instance/organizationsPage/organizationsPanelView/organizationCard/organizationCard.jsx index 91904a0fbd..7a26c9d2f3 100644 --- a/app/src/pages/instance/organizationsPage/organizationsPanelView/organizationCard/organizationCard.jsx +++ b/app/src/pages/instance/organizationsPage/organizationsPanelView/organizationCard/organizationCard.jsx @@ -41,7 +41,7 @@ import { messages } from '../../messages'; import styles from './organizationCard.scss'; const cx = classNames.bind(styles); -const THREE_MONTHS = 1000 * 60 * 60 * 24 * 30 * 3; +const THREE_MONTHS_IN_MS = 1000 * 60 * 60 * 24 * 30 * 3; export const OrganizationCard = ({ organization }) => { const { formatMessage } = useIntl(); @@ -53,9 +53,10 @@ export const OrganizationCard = ({ organization }) => { const usersCount = organization.relationships.users.meta.count; const projectsCount = organization.relationships.projects.meta.count; - const lastLaunch = organization.relationships.launches.meta.last_occurred_at; - const { value: relativeTime, unit } = getRelativeUnits(new Date(lastLaunch)); - const isOutdated = lastLaunch && Date.now() - new Date(lastLaunch).getTime() > THREE_MONTHS; + const lastLaunchDate = organization.relationships.launches.meta.last_occurred_at; + const { value: relativeTime, unit } = getRelativeUnits(new Date(lastLaunchDate)); + const isOutdated = + lastLaunchDate && Date.now() - new Date(lastLaunchDate).getTime() > THREE_MONTHS_IN_MS; const cartInfo = [ { @@ -74,7 +75,7 @@ export const OrganizationCard = ({ organization }) => { icon: LastUpdateIcon, className: cx('last-update'), content: formatMessage(messages.latestLaunch), - bottomElement: lastLaunch ? ( + bottomElement: lastLaunchDate ? ( ) : ( formatMessage(messages.noLaunches)