Skip to content

Commit

Permalink
feature/govt-consent-message (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJJackson committed Aug 28, 2024
1 parent df5a571 commit 44986c7
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hhd-ui",
"version": "0.17.2",
"version": "0.17.3",
"private": true,
"dependencies": {
"@ag-grid-community/client-side-row-model": "^30.0.3",
Expand Down
42 changes: 30 additions & 12 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import { connect } from 'redux-bundler-react';
import { ToastContainer } from 'react-toastify';

import DeclinedConsent from './app-pages/DeclinedConsent.jsx';
import DoDConsentNotice from './app-pages/DoDConsentNotice.jsx';
import Modal from './app-components/modal';
import NavBar from './app-components/navigation';
import PageContent from './app-components/pageContent';
import { getAcceptedValue, setUserAccepted } from './userService.ts';

import 'react-toastify/dist/ReactToastify.css';
import 'react-tooltip/dist/react-tooltip.css';
import './css/bootstrap/css/bootstrap.water.min.css';

import './css/ms/css/mapskin.min.css';
import './css/index.scss';

export default connect('selectRoute', ({ route: Route }) => (
<>
<NavBar theme='primary' />
<ToastContainer autoClose={3500} hideProgressBar={false} />
<PageContent>
<Route />
</PageContent>
<Modal closeWithEscape />
</>
));
export default connect('selectRoute', ({ route: Route }) => {
const [acceptedState, setAcceptedState] = useState(getAcceptedValue());

useEffect(() => {
setUserAccepted(acceptedState);
}, [acceptedState]);

return (
<>
{acceptedState === 'true' ? (
<>
<NavBar theme='primary' />
<ToastContainer autoClose={3500} hideProgressBar={false} />
<PageContent>
<Route />
</PageContent>
<Modal closeWithEscape />
</>
) : acceptedState === 'false' ? (
<DeclinedConsent setAcceptedState={setAcceptedState} />
) : (
<DoDConsentNotice setAcceptedState={setAcceptedState} />
)}
</>
);
});
41 changes: 41 additions & 0 deletions src/app-pages/DeclinedConsent.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Button } from '@mui/material';
import React from 'react';

import bg1 from '../img/bg-1.jpg';
import { Timeline } from '@mui/icons-material';

const DeclinedConsent = ({ setAcceptedState }) => {

return (
<>
<div
className='hero'
style={{ backgroundImage: `url(${bg1})` }}
>
<div className='d-flex justify-content-center align-items-center flex-column h-100 m-auto'>
<h1 className='text-light'>
<Timeline sx={{ paddingRight: '5px', paddingBottom: '5px', fontSize: '40px' }} />
MIDAS
</h1>
<h4 className='text-light'>
Monitoring Instrumentation Data Acquisition System
</h4>
</div>
</div>
<div className='d-flex justify-content-center mt-3'>
You must agree to the prior terms to access this site. Click&nbsp;
<Button
className='p-0 m-0'
size='small'
variant='text'
onClick={() => setAcceptedState(null)}
>
here
</Button>
&nbsp;to go back or close this window.
</div>
</>
);
};

export default DeclinedConsent;
32 changes: 32 additions & 0 deletions src/app-pages/DoDConsentNotice.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import { Button } from '@mui/material';

const DoDConsentNotice = ({ setAcceptedState }) => {
return (
<span className='notice-background'>
<div className='notice-container'>
<div className='pb-2'>
<h5 className='pb-2'>You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only.</h5>
<h6 className='pb-2'>By using this IS (which includes any device attached to this IS), you consent to the following conditions:</h6>
<ul>
<li className='pb-1'>The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.</li>
<li className='pb-1'>At any time, the USG may inspect and seize data stored on this IS.</li>
<li className='pb-1'>Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose.</li>
<li className='pb-1'>This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy.</li>
<li className='pb-1'>Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See <a target='_blank' rel='noreferrer' href='https://www.my.af.mil/afp/netstorage/login_page_files_cloud_one/dod-user-agreement.html'>User Agreement</a> for details.</li>
</ul>
</div>
<div className='notice-footer'>
<Button color='secondary' size='small' onClick={() => setAcceptedState('false')}>
Decline
</Button>
<Button color='success' variant='contained' disableElevation size='small' onClick={() => setAcceptedState('true')}>
I Agree
</Button>
</div>
</div>
</span>
);
};

export default DoDConsentNotice;
41 changes: 41 additions & 0 deletions src/css/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,44 @@ footer.modal-footer {
.text-dark {
color: #222 !important;
}

.notice-background {
display: flex;
position: absolute;
left: 0;
top: 0;
background-color: #444;
height: 100vh;
width: 100vw;
}

.notice-container {
padding: 1rem;
border-radius: 8px;
position: relative;
background-color: white;
margin: auto auto;
width: 600px;
height: 75%;
overflow: scroll;
}

.notice-footer {
position: absolute;
bottom: 10px;
display: flex;
justify-content: space-between;
width: 95%;
}

@media only screen and (max-width: 768px) {
/* For mobile phones: */
.notice-container {
width: 90vw;
}

.notice-footer {
width: 100%;
position: relative;
}
}
7 changes: 7 additions & 0 deletions src/userService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ _kc.onAuthRefreshError = () => {
console.error(err);
}
};

const acceptedKey = 'isUserAccepted';

export const getAcceptedValue = () => sessionStorage.getItem(acceptedKey);
export const setUserAccepted = (val: string) => {
sessionStorage.setItem(acceptedKey, val);
};

0 comments on commit 44986c7

Please sign in to comment.