From 39c991e033555f68419cd00d5ffdb2b6139189e1 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 5 Feb 2024 17:20:00 +0530 Subject: [PATCH 1/5] [#1130] missing sidebar on profile page --- frontend/src/App.js | 8 ++++---- frontend/src/components/layout/Header.jsx | 6 +++++- frontend/src/pages/profile/style.scss | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/App.js b/frontend/src/App.js index f331c63e1..ddedaf949 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -227,15 +227,15 @@ const RouteList = () => { element={} /> } /> + } + /> } /> - } - /> } diff --git a/frontend/src/components/layout/Header.jsx b/frontend/src/components/layout/Header.jsx index 4ba39da59..a17fb5afb 100644 --- a/frontend/src/components/layout/Header.jsx +++ b/frontend/src/components/layout/Header.jsx @@ -85,7 +85,11 @@ const Header = ({ className = "header", ...props }) => { { key: "profile", label: ( - + {text?.myProfile} ), diff --git a/frontend/src/pages/profile/style.scss b/frontend/src/pages/profile/style.scss index db5c85a27..34b9e9e49 100644 --- a/frontend/src/pages/profile/style.scss +++ b/frontend/src/pages/profile/style.scss @@ -2,6 +2,7 @@ #root { #profile { + padding: 24px; .ant-card { margin-top: 20px; } From c6f093164224aeed087a27490115c473977d07e2 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 5 Feb 2024 19:49:15 +0530 Subject: [PATCH 2/5] [#1130] Change the approver comment style --- frontend/src/pages/approvals/ApprovalDetail.jsx | 14 ++++++++++---- frontend/src/pages/approvals/style.scss | 4 ++++ frontend/src/util/date.js | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/approvals/ApprovalDetail.jsx b/frontend/src/pages/approvals/ApprovalDetail.jsx index a1c43ce57..cf55dbd88 100644 --- a/frontend/src/pages/approvals/ApprovalDetail.jsx +++ b/frontend/src/pages/approvals/ApprovalDetail.jsx @@ -8,7 +8,6 @@ import { Checkbox, Button, Space, - Tag, List, Spin, } from "antd"; @@ -23,6 +22,7 @@ import { EditableCell } from "../../components"; import { isEqual, flatten } from "lodash"; import { useNotification } from "../../util/hooks"; import { HistoryTable } from "../../components"; +import { getTimeDifferenceText } from "../../util/date"; const { TextArea } = Input; const { TabPane } = Tabs; @@ -537,9 +537,15 @@ const ApprovalDetail = ({ {/* TODO: Change Avatar */} - {item.created} - {item.user.name} +
+ {item.user.name}{" "} + + {" "} + {getTimeDifferenceText( + item.created, + "YYYY-MM-DDTHH:mm:ss" + )} +
} description={item.comment} diff --git a/frontend/src/pages/approvals/style.scss b/frontend/src/pages/approvals/style.scss index db3d79108..3d7edb665 100644 --- a/frontend/src/pages/approvals/style.scss +++ b/frontend/src/pages/approvals/style.scss @@ -59,6 +59,10 @@ } } + .ant-list-item-meta-title div { + font-size: 14px; + } + .ant-table-row.table-row-expanded { color: $blue; diff --git a/frontend/src/util/date.js b/frontend/src/util/date.js index 91a17fcba..333bf89df 100644 --- a/frontend/src/util/date.js +++ b/frontend/src/util/date.js @@ -34,3 +34,17 @@ export const eraseCookieFromAllPaths = (name) => { name + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT;" + pathCurrent + ";"; } }; + +export const getTimeDifferenceText = (targetDate, format) => { + const targetDateTime = moment(targetDate, format); + const currentDateTime = moment(); + const timeDifference = currentDateTime.diff(targetDateTime, "seconds"); + const secondsInADay = 86400; // 24 hours * 60 minutes * 60 seconds + + if (timeDifference < secondsInADay) { + const hoursAgo = Math.floor(timeDifference / 3600); + return hoursAgo <= 1 ? "an hour ago" : `${hoursAgo} hours ago`; + } + const daysAgo = Math.floor(timeDifference / secondsInADay); + return daysAgo === 1 ? "a day ago" : `${daysAgo} days ago`; +}; From f05199879746fabd74fdfeb21442db82aba8a529 Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 6 Feb 2024 12:51:42 +0530 Subject: [PATCH 3/5] [#1130] Revert comment approval changes --- frontend/src/pages/approvals/ApprovalDetail.jsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/approvals/ApprovalDetail.jsx b/frontend/src/pages/approvals/ApprovalDetail.jsx index cf55dbd88..a1c43ce57 100644 --- a/frontend/src/pages/approvals/ApprovalDetail.jsx +++ b/frontend/src/pages/approvals/ApprovalDetail.jsx @@ -8,6 +8,7 @@ import { Checkbox, Button, Space, + Tag, List, Spin, } from "antd"; @@ -22,7 +23,6 @@ import { EditableCell } from "../../components"; import { isEqual, flatten } from "lodash"; import { useNotification } from "../../util/hooks"; import { HistoryTable } from "../../components"; -import { getTimeDifferenceText } from "../../util/date"; const { TextArea } = Input; const { TabPane } = Tabs; @@ -537,15 +537,9 @@ const ApprovalDetail = ({ {/* TODO: Change Avatar */} - {item.user.name}{" "} - - {" "} - {getTimeDifferenceText( - item.created, - "YYYY-MM-DDTHH:mm:ss" - )} - +
+ {item.created} + {item.user.name}
} description={item.comment} From 2381076c8dd216caed277aa14f55d829b01fcfd7 Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 6 Feb 2024 13:21:03 +0530 Subject: [PATCH 4/5] [#1130] style added in profile --- frontend/src/pages/profile/style.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/profile/style.scss b/frontend/src/pages/profile/style.scss index 34b9e9e49..1a9edf13d 100644 --- a/frontend/src/pages/profile/style.scss +++ b/frontend/src/pages/profile/style.scss @@ -6,7 +6,9 @@ .ant-card { margin-top: 20px; } - + .ant-card { + height: auto; + } h1 { text-align: left; font: normal normal 600 $font-size-large $font-family; From a402a235ad5791bec221517f7589909a3a83b3c3 Mon Sep 17 00:00:00 2001 From: ifirmawan Date: Tue, 6 Feb 2024 15:13:58 +0700 Subject: [PATCH 5/5] [#1130] Move antd card height style directly to root --- frontend/src/pages/profile/style.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/profile/style.scss b/frontend/src/pages/profile/style.scss index 1a9edf13d..4d9202670 100644 --- a/frontend/src/pages/profile/style.scss +++ b/frontend/src/pages/profile/style.scss @@ -1,14 +1,14 @@ @import "../../variables"; #root { + .ant-card { + height: auto; + } #profile { padding: 24px; .ant-card { margin-top: 20px; } - .ant-card { - height: auto; - } h1 { text-align: left; font: normal normal 600 $font-size-large $font-family;