Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1130] missing sidebar on profile page #1133

Merged
merged 7 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ const RouteList = () => {
element={<Private element={AddAssignment} alias="mobile" />}
/>
<Route exact path="form/:formId" element={<Forms />} />
<Route
path="profile"
element={<Private element={Profile} alias="profile" />}
/>
</Route>
<Route
path="/settings"
element={<Private element={Settings} alias="settings" />}
/>
<Route
path="/profile"
element={<Private element={Profile} alias="profile" />}
/>
<Route
path="/reports"
element={<Private element={Reports} alias="reports" />}
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/layout/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ const Header = ({ className = "header", ...props }) => {
{
key: "profile",
label: (
<Link key="profile" className="usermenu-menu-item" to="/profile">
<Link
key="profile"
className="usermenu-menu-item"
to="/control-center/profile"
>
{text?.myProfile}
</Link>
),
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/approvals/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
}
}

.ant-list-item-meta-title div {
font-size: 14px;
}

.ant-table-row.table-row-expanded {
color: $blue;

Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/profile/style.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
@import "../../variables";

#root {
.ant-card {
height: auto;
}
#profile {
padding: 24px;
.ant-card {
margin-top: 20px;
}

h1 {
text-align: left;
font: normal normal 600 $font-size-large $font-family;
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/util/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
};