Skip to content

Commit

Permalink
[rebase] Migrated Access Request page, needs public endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalcengio authored and micheal-w-wells committed Oct 19, 2023
1 parent 35e9d46 commit 9313474
Show file tree
Hide file tree
Showing 3 changed files with 776 additions and 11 deletions.
12 changes: 7 additions & 5 deletions appv2/src/UI/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { Browser } from "@capacitor/browser";
import { LayerPickerBasic } from './Map/LayerPickerBasic';
import { NewRecord } from './Map/Buttons/NewRecord';
import NewRecordDialog from './Map/Buttons/NewRecordDialog';
import AccessRequestPage from './Overlay/AccessRequest/AccessRequestPage';

// URL listener so that the auth saga can redirect to the correct page
const URL_LISTENER = (props) => {
Expand Down Expand Up @@ -147,11 +148,12 @@ const OverlayContentMemo = React.memo((props: any) => {
path="/Batch/list/:id"
render={(props) => <BatchView match={props.match as any} history={undefined} location={undefined} />}
/>
<Route path="/Batch/new" render={(props) => <BatchCreateNew />} />
<Route path="/Batch/templates" render={(props) => <BatchTemplates />} />
<Route path="/Reports" render={(props) => <EmbeddedReportsPage />} />
<Route path="/Training" render={(props) => <TrainingPage />} />
<Route path="/Legend" render={(props) => <LegendsPopup />} />
<Route path="/Batch/new" render={(props) => <BatchCreateNew/>}/>
<Route path="/Batch/templates" render={(props) => <BatchTemplates/>}/>
<Route path="/Reports" render={(props) => <EmbeddedReportsPage/>}/>
<Route path="/Training" render={(props) => <TrainingPage/>}/>
<Route path="/Legend" render={(props) => <LegendsPopup/>}/>
<Route path="/AccessRequest" render={(props) => <AccessRequestPage/>}/>
<ThemeProvider theme={theme}>
<Route path="/Admin" render={(props) => <UserAccessPage />} />
</ThemeProvider>
Expand Down
35 changes: 29 additions & 6 deletions appv2/src/UI/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ const AdminPanelMemo = React.memo((props) => {
});

const LoginOrOutMemo = React.memo((props) => {
const dispatch = useDispatch();
const history = useHistory();
const authenticated = useSelector((state: any) => state?.Auth?.authenticated);
const activated = useSelector((state: any) => state?.UserInfo?.activated);
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const openMenu = Boolean(anchorEl);
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
Expand All @@ -214,11 +218,30 @@ const LoginOrOutMemo = React.memo((props) => {
};

const navToUpdateRequest = () => {
return null;
history.push({
pathname: '/AccessRequest',
state: {
updateInfo: true
}
});
dispatch({
type: TOGGLE_PANEL,
payload: { panelOpen: true, fullScreen: true }
});
}

const authenticated = useSelector((state: any) => state?.Auth?.authenticated);
const activated = useSelector((state: any) => state?.UserInfo?.activated);
const requestAccess = async () => {
if (!authenticated) {
dispatch({ type: AUTH_SIGNIN_REQUEST });
} else {
history.push('/AccessRequest');
dispatch({
type: TOGGLE_PANEL,
payload: { panelOpen: true, fullScreen: true }
});
}
};

return <Box sx={{ flexGrow: 0, float: 'right', marginRight: '1rem' }}>
<IconButton onClick={handleClick} size="small">
<Avatar></Avatar>
Expand All @@ -231,16 +254,16 @@ const LoginOrOutMemo = React.memo((props) => {
elevation: 3
}}
transformOrigin={{ horizontal: 'right', vertical: 'top' }}>
{/* {showLoggedInTabs && ( */}
{activated &&
<MenuItem onClick={navToUpdateRequest}>
<ListItemIcon>
<AssignmentIcon />
</ListItemIcon>
Update My Info
</MenuItem>
{/* )} */}
}
{!activated &&
<MenuItem onClick={navToUpdateRequest}>
<MenuItem onClick={requestAccess}>
<ListItemIcon>
<AssignmentIcon />
</ListItemIcon>
Expand Down
Loading

0 comments on commit 9313474

Please sign in to comment.