36 | {year} Copyright ©{' '} 37 | Ahmed Alatawi. All 38 | rights reserved under{' '} 39 | 40 | MIT license 41 | 42 | . 43 |
44 | 45 | Give this{' '} 46 | 47 | repo 48 | {' '} 49 | a ⭐ 50 | 51 |46 | Don't have an account yet?{' '} 47 | 48 | Signup 49 | 50 |
51 |66 | Already have an account?{' '} 67 | 68 | Login 69 | 70 |
71 |Your login session will expire in {timeLeft} second(s).
28 | } 29 | 30 | export default Timer 31 | -------------------------------------------------------------------------------- /src/components/UserIdleTimer/UserIdleTimer.tsx: -------------------------------------------------------------------------------- 1 | import { useContext, useState } from 'react' 2 | import { useIdleTimer } from 'react-idle-timer' 3 | import AuthContext from '@/store/auth-context' 4 | import Timer from '../Timer/Timer' 5 | import Modal from '../ui/Modal/Modal' 6 | 7 | type Props = { 8 | onLogout: () => void 9 | } 10 | 11 | const UserIdleTimer = ({ onLogout }: Props) => { 12 | const [displayModal, setDisplayModal] = useState{content}
54 |
55 |
56 | posted by: {createdBy}{' '}
57 | {createdAt ? `on ${formatDateTime(createdAt)}` : null}
58 |
59 | {updatedAt ? (
60 | new Date(updatedAt).getTime() !==
61 | new Date(createdAt ?? '').getTime() ? (
62 |
64 |
65 | updated on: {formatDateTime(updatedAt)}
66 |
67 |
{content}
26 |
27 |
28 | posted by: {createdBy}{' '}
29 | {createdAt ? `on ${formatDateTime(createdAt)}` : null}
30 |
31 | {updatedAt ? (
32 | new Date(updatedAt).getTime() !==
33 | new Date(createdAt ?? '').getTime() ? (
34 |
36 |
37 | updated on: {formatDateTime(updatedAt)}
38 |
39 |