Skip to content

Commit

Permalink
added last login time
Browse files Browse the repository at this point in the history
  • Loading branch information
kurund committed Oct 8, 2023
1 parent a29006e commit 539051d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/UI/Layout/Navigation/SideDrawer/SideDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import GlificLogo from 'assets/images/logo/Logo.svg';
import { getUserRolePermissions, getUserAccountMenus, getStaffManagementMenus } from 'context/role';
import { Tooltip } from 'components/UI/Tooltip/Tooltip';
import { WalletBalance } from 'containers/WalletBalance/WalletBalance';
import { LastLogin } from 'containers/LastLogin/LastLogin';
import { isGreaterThanLgBreakpoint } from 'common/utils';
import SideMenus from '../SideMenus/SideMenus';

Expand Down Expand Up @@ -183,6 +184,7 @@ export const SideDrawer = () => {
</div>
</div>
{drawer}
<LastLogin />
<WalletBalance fullOpen={drawerOpen} />
</Drawer>
</nav>
Expand Down
8 changes: 8 additions & 0 deletions src/containers/LastLogin/LastLogin.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.lastLogin {
position: absolute;
bottom: 26px;
font-size: 12px;
padding-left: 10px;
color: #073f24;
font-weight: 500;
}
17 changes: 17 additions & 0 deletions src/containers/LastLogin/LastLogin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import moment from 'moment';
import { useTranslation } from 'react-i18next';

import { getAuthSession } from 'services/AuthService';
import { DATE_TIME_FORMAT } from 'common/constants';

import styles from './LastLogin.module.css';

export const LastLogin = () => {
const { t } = useTranslation();
const lastLogin = getAuthSession('last_login_time');
return (
<div className={styles.lastLogin}>
{t('Last login')}: {moment(lastLogin).format(DATE_TIME_FORMAT)}
</div>
);
};
1 change: 1 addition & 0 deletions src/i18n/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
"Add New": "Add New",
"Add another list": "Add another list",
"Add another list item": "Add another list item",
"Last login": "Last login",
"Delete": "Delete",
"Sorry, no results found! Please try a different search.": "Sorry, no results found! Please try a different search.",
"Please create one.": "Please create one.",
Expand Down
5 changes: 4 additions & 1 deletion src/services/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const getAuthSession = (element?: string) => {
case 'access_token':
returnValue = JSON.parse(session).access_token;
break;
case 'last_login_time':
returnValue = JSON.parse(session).last_login_time;
break;
default:
returnValue = session;
}
Expand Down Expand Up @@ -171,7 +174,7 @@ export const getOrganizationServices = (service: string) => {
};

export const setAuthHeaders = () => {
// // add authorization header in all calls
// add authorization header in all calls
let renewTokenCalled = false;
let renewCallInProgress = false;

Expand Down

0 comments on commit 539051d

Please sign in to comment.