Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HTML to MUI in VRMS/client/src/components/admin/reports /index.js #1706

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions client/src/components/auth/HandleAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Redirect } from 'react-router-dom';
import { isValidToken } from '../../services/user.service';
import { authLevelRedirect } from '../../utils/authUtils';
import { Box, Typography, CircularProgress } from '@mui/material';

import '../../sass/MagicLink.scss';
import useAuth from '../../hooks/useAuth';
Expand Down Expand Up @@ -43,7 +44,7 @@ const HandleAuth = (props) => {
setIsLoaded(true);
}, [isMagicLinkValid, setIsLoaded, auth]);

if (!isLoaded) return <div>Loading...</div>;
if (!isLoaded) return <Box display="flex" justifyContent="center" alignItems="center" height="100vh"><CircularProgress /></Box>;

const Delayed = ({ children, waitBeforeShow = 500 }) => {
const [isShown, setIsShown] = useState(false);
Expand All @@ -65,12 +66,12 @@ const HandleAuth = (props) => {
}

return (
<div className="flex-container">
<Box className="flex-container">
<Delayed waitBeforeShow={1000}>
<div>Sorry, the link is not valid anymore.</div>
<Typography variant="body1">Sorry, the link is not valid anymore.</Typography>
</Delayed>
{auth?.user && <Redirect to={loginRedirect} /> /* Redirect to /welcome */}
</div>
</Box>
);
};

Expand Down
33 changes: 17 additions & 16 deletions client/src/components/dashboard/AddTeamMember.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from "react";
import { Box, Button, TextField, Typography } from "@mui/material";
import "../../sass/AddTeamMember.scss";

const AddTeamMember = (props) => {
Expand All @@ -7,17 +8,17 @@ const AddTeamMember = (props) => {
const handleInputChange = (e) => setEmail(e.currentTarget.value);

return (
<div className="flex-container">
<div className="addmember-container">
<Box className="flex-container">
<Box className="addmember-container">
<form
className="form-add-member"
autoComplete="off"
onSubmit={(e) => props.addToTeamHandler(e, email)}
>
<div className="form-row">
<div className="form-input-text">
<label htmlFor="email">Add team member:</label>
<input
<Box className="form-row">
<Box className="form-input-text">
<TextField
label = "Add team member"
type="email"
name="email"
placeholder="Email Address"
Expand All @@ -27,22 +28,22 @@ const AddTeamMember = (props) => {
autoComplete="none"
required="required"
/>
</div>
</div>
</Box>
</Box>

<div className="form-input-button">
<button
<Box className="form-input-button">
<Button
type="submit"
className="addmember-button"
>
Add
</button>
</div>
</Button>
</Box>
</form>
{props.isSuccess ? <p className="addmember-success">User Added</p> : null}
<div className="addmember-warning">{props.isError ? props.errorMessage : null}</div>
</div>
</div>
{props.isSuccess && <Typography className="addmember-success">User Added</Typography>}
{props.isError && <Typography className="addmember-warning">{props.errorMessage}</Typography>}
</Box>
</Box>
);
};

Expand Down
14 changes: 7 additions & 7 deletions client/src/components/manageProjects/editMeetingTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { findNextOccuranceOfDay } from './utilities/findNextDayOccuranceOfDay';
import { addDurationToTime } from './utilities/addDurationToTime';
import { timeConvertFromForm } from './utilities/timeConvertFromForm';
import validateEventForm from './utilities/validateEventForm';
import { IconButton, Box } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';

// This component displays current meeting times for selected project and offers the option to edit those times.
const EditMeetingTimes = ({
Expand Down Expand Up @@ -92,17 +94,15 @@ const EditMeetingTimes = ({
};

return (
<div>
<button
type="button"
className="meeting-cancel-button"
<Box>
<IconButton
onClick={() => {
setFormErrors(null);
setSelectedEvent(null);
}}
>
X
</button>
<CloseIcon />
</IconButton>
{selectedEvent && (
<EditableMeeting
key={selectedEvent.event_id}
Expand All @@ -120,7 +120,7 @@ const EditMeetingTimes = ({
handleEventDelete={handleEventDelete}
/>
)}
</div>
</Box>
);
};
export default EditMeetingTimes;
109 changes: 52 additions & 57 deletions client/src/components/user-admin/EditUsers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react';
import '../../sass/UserAdmin.scss';
import { FormGroup, FormControlLabel, Switch } from '@mui/material'
import { FormGroup, FormControlLabel, Switch, Box, Typography, Button, MenuItem, Select, List, ListItem, IconButton } from '@mui/material';
import DeleteIcon from '@mui/icons-material/Delete';

// child of UserAdmin. Displays form to update users.
const EditUsers = ({ userToEdit, backToSearch, updateUserDb, projects, updateUserActiveStatus }) => {
Expand Down Expand Up @@ -65,74 +66,68 @@ const EditUsers = ({ userToEdit, backToSearch, updateUserDb, projects, updateUse
}

return (
<div className="edit-users">
<div className="ua-row">
<div className="user-display-column-left">Name:</div>
<div className="user-display-column-right">{userName}</div>
</div>
<div className="ua-row">
<div className="user-display-column-left">Email:</div>
<div className="user-display-column-right">{userEmail}</div>
</div>
<div className="ua-row is-active-flex">
<div className="user-is-active-column-left">Is Active:</div>
<div className="is-active-flex">
<span className="active-status">{isActive.toString()}</span>
<Box className="edit-users">
<Box className="ua-row">
<Box className="user-display-column-left">Name:</Box>
<Box className="user-display-column-right">{userName}</Box>
</Box>
<Box className="ua-row">
<Box className="user-display-column-left">Email:</Box>
<Box className="user-display-column-right">{userEmail}</Box>
</Box>
<Box className="ua-row is-active-flex">
<Box className="user-is-active-column-left">Is Active:</Box>
<Box className="is-active-flex">
<Typography className="active-status">{isActive.toString()}</Typography>
<FormGroup>
<FormControlLabel control={<Switch checked={isActive} />} onClick={() => handleSetIsActive()} />
<FormControlLabel control={<Switch checked={isActive} onClick={handleSetIsActive} />} />
</FormGroup>
</div>
</div>
<div className="ua-row">
<div className="user-display-column-left">Projects:</div>
<div className="user-display-column-right">
<ul className="project-list">
{userProjectsToDisplay.map((result) => {
return (
<li key={`remove_${result[0]}`}>
{result[1]}
<button
type="button"
className="button-remove"
onClick={() => handleRemoveProject(result[0])}
>
(remove)
</button>
</li>
);
})}
</ul>
</div>
</div>
<div>
</Box>
</Box>
<Box className="ua-row">
<Box className="user-display-column-left">Projects:</Box>
<Box className="user-display-column-right">
<List className="project-list">
{userProjectsToDisplay.map((result) => (
<ListItem key={`remove_${result[0]}`} secondaryAction={
<IconButton edge="end" aria-label="delete" onClick={() => handleRemoveProject(result[0])}>
<DeleteIcon />
</IconButton>
}>
{result[1]}
</ListItem>
))}
</List>
</Box>
</Box>
<Box>
<form onSubmit={onSubmit}>
<select
<Select
className="project-select"
value={projectValue}
onChange={(event) => {
setProjectValue(event.target.value);
}}
displayEmpty
>
<option value="default">Select a project..</option>
{activeProjects.map((result) => {
return (
<option key={`select_${result[0]}`} value={result[0]}>
{result[1]}
</option>
);
})}
</select>
<button className="button-add" type="submit">
<MenuItem value="default">Select a project..</MenuItem>
{activeProjects.map((result) => (
<MenuItem key={`select_${result[0]}`} value={result[0]}>
{result[1]}
</MenuItem>
))}
</Select>
<Button className="button-add" type="submit" variant="contained" color="primary">
Add project
</button>
</Button>
</form>
<div>
<button type="button" className="button-back" onClick={backToSearch}>
<Box>
<Button className="button-back" onClick={backToSearch} variant="outlined">
Back to search
</button>
</div>
</div>
</div>
</Button>
</Box>
</Box>
</Box>
);
};

Expand Down
Loading