diff --git a/src/components/UI/Layout/Navigation/SideDrawer/SideDrawer.tsx b/src/components/UI/Layout/Navigation/SideDrawer/SideDrawer.tsx index 3ff5a6c02..875e60e58 100644 --- a/src/components/UI/Layout/Navigation/SideDrawer/SideDrawer.tsx +++ b/src/components/UI/Layout/Navigation/SideDrawer/SideDrawer.tsx @@ -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'; @@ -183,6 +184,7 @@ export const SideDrawer = () => { {drawer} + diff --git a/src/containers/LastLogin/LastLogin.module.css b/src/containers/LastLogin/LastLogin.module.css new file mode 100644 index 000000000..a771c8f9d --- /dev/null +++ b/src/containers/LastLogin/LastLogin.module.css @@ -0,0 +1,8 @@ +.lastLogin { + position: absolute; + bottom: 26px; + font-size: 12px; + padding-left: 10px; + color: #073f24; + font-weight: 500; +} diff --git a/src/containers/LastLogin/LastLogin.tsx b/src/containers/LastLogin/LastLogin.tsx new file mode 100644 index 000000000..8ed011ca3 --- /dev/null +++ b/src/containers/LastLogin/LastLogin.tsx @@ -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 ( +
+ {t('Last login')}: {moment(lastLogin).format(DATE_TIME_FORMAT)} +
+ ); +}; diff --git a/src/i18n/en/en.json b/src/i18n/en/en.json index eaad5da6b..68aaf4240 100644 --- a/src/i18n/en/en.json +++ b/src/i18n/en/en.json @@ -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.", diff --git a/src/services/AuthService.tsx b/src/services/AuthService.tsx index 7cf550ba4..9c66fbd60 100644 --- a/src/services/AuthService.tsx +++ b/src/services/AuthService.tsx @@ -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; } @@ -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;