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

95 15 min notif #141

Merged
merged 7 commits into from
Aug 2, 2023
Merged
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
13 changes: 7 additions & 6 deletions src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const NavBar = ({ handleLogout, isLoggedIn, token, loading }) => {
setAnchorEl(null);
};

// don't need, call in the session state from session storage
useEffect(() => {
if (isLoggedIn) {
axios
Expand Down Expand Up @@ -130,7 +131,7 @@ const NavBar = ({ handleLogout, isLoggedIn, token, loading }) => {
type="submit"
component={Link}
to="/register"
// color="inherit"
// color="inherit"
>
Sign up
</Button>
Expand All @@ -140,7 +141,7 @@ const NavBar = ({ handleLogout, isLoggedIn, token, loading }) => {
type="submit"
component={Link}
to="/login"
// color="inherit"
// color="inherit"
>
Log in
</Button>
Expand All @@ -166,10 +167,10 @@ const NavBar = ({ handleLogout, isLoggedIn, token, loading }) => {
style={
loading
? {
backgroundColor: "black",
color: "yellow",
width: "20px",
}
backgroundColor: "black",
color: "yellow",
width: "20px",
}
: {}
}
>
Expand Down
157 changes: 54 additions & 103 deletions src/pages/Profile/ProfileMentee.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ export default function ProfileMentee({ token, pk, setAuth }) {
.then((res) => {
setFirstName(
res.data.first_name.charAt(0).toUpperCase() +
res.data.first_name.slice(1)
res.data.first_name.slice(1)
);
setLastName(
res.data.last_name.charAt(0).toUpperCase() +
res.data.last_name.slice(1)
res.data.last_name.slice(1)
);
if (res.data.phone_number) {
setPhoneNumber(
Expand Down Expand Up @@ -114,7 +114,7 @@ export default function ProfileMentee({ token, pk, setAuth }) {
setChecked15Min(res.data.fifteen_minute_alert);
setChecked60Min(res.data.sixty_minute_alert);
});
}, [token, pk]);
}, [token, pk]);

// handle Switch functionality
const handleSessionConf = (event) => {
Expand All @@ -123,12 +123,12 @@ export default function ProfileMentee({ token, pk, setAuth }) {
.patch(`${process.env.REACT_APP_BE_URL}/notificationsettings/${pk}/`, {
session_confirmed: event.target.checked,
},
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
}

const handleSessionCanc = (event) => {
Expand All @@ -137,12 +137,12 @@ export default function ProfileMentee({ token, pk, setAuth }) {
.patch(`${process.env.REACT_APP_BE_URL}/notificationsettings/${pk}/`, {
session_canceled: event.target.checked,
},
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
}

const handle15Min = (event) => {
Expand All @@ -151,12 +151,12 @@ export default function ProfileMentee({ token, pk, setAuth }) {
.patch(`${process.env.REACT_APP_BE_URL}/notificationsettings/${pk}/`, {
fifteen_minute_alert: event.target.checked,
},
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
}

const handle60Min = (event) => {
Expand All @@ -165,12 +165,12 @@ export default function ProfileMentee({ token, pk, setAuth }) {
.patch(`${process.env.REACT_APP_BE_URL}/notificationsettings/${pk}/`, {
sixty_minute_alert: event.target.checked,
},
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
{
headers: {
Authorization: `Token ${token}`,
"Content-Type": "application/json",
},
});
}


Expand All @@ -196,91 +196,42 @@ export default function ProfileMentee({ token, pk, setAuth }) {
Notifications:
</Typography>

<Grid container direction={"row"} spacing={2}>
<Grid marginRight={"rem"} marginLeft={"4rem"} width={"30rem"}>
<Grid item>
{/* <FormControl width="1rem">
<InputLabel id="demo-simple-select-label">
Time
</InputLabel>{" "}
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
// value={age}
// label="Age"
// onChange={handleChange}
>
<MenuItem value={10}>15 Mintues</MenuItem>
<MenuItem value={20}>30 Mintues</MenuItem>
<MenuItem value={45}>45 Minutes</MenuItem>
<MenuItem value={60}>60 Minutes</MenuItem>
</Select>
</FormControl> */}

<Grid item>
<br></br>
</Grid>
<Grid item>
<Typography fontSize={"18px"} paddingTop={"1.2rem"}>
Notify me when a mentor confirms a session
</Typography>
</Grid>
<Grid item>
<Typography fontSize={"18px"} paddingTop={".75rem"}>
Notify me when a mentor cancels a session
</Typography>
</Grid>
<Grid sx={{ marginLeft: "4rem", width: "35rem" }} >

{/* Commenting out notification options until we're ready to use them */}
{/* <Grid item>
<Typography fontSize={"18px"} paddingTop={".75rem"}>
Notify me 15 minutes before a session
</Typography>
</Grid>
<Grid item>
<Typography fontSize={"18px"} paddingTop={".75rem"}>
Notify me 60 minutes before a session
</Typography>
</Grid> */}
</Grid>
{/* <Typography variant="h6">Email Notifications</Typography> */}

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"}>
Notify me when a mentor confirms a session
</Typography>
<FormControlLabel control={<IOSSwitch checked={checkedSessionConf} onChange={handleSessionConf} />} />
</Grid>
<Grid marginRight={"2rem"}>
<Typography variant="h6">Email Notifications</Typography>

<Grid item textAlign={"center"}>
<FormControlLabel control={<IOSSwitch checked={checkedSessionConf} onChange={handleSessionConf} /> } />
<Grid item marginTop={"1rem"}>
<FormControlLabel control={<IOSSwitch checked={checkedSessionCanc} onChange={handleSessionCanc} />} />
</Grid>
<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"}>
Notify me when a mentor cancels a session
</Typography>
<FormControlLabel control={<IOSSwitch checked={checkedSessionCanc} onChange={handleSessionCanc} />} />
</Grid>

{/* Commenting out notification options until we're ready to use them */}
{/* <Grid item>
<FormControlLabel control={<Switch checked={checked15Min} onChange={handle15Min} />} />
</Grid>
<Grid item>
<FormControlLabel control={<Switch checked={checked60Min} onChange={handle60Min} />} />
</Grid> */}
</Grid>
<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"} color={"#CCCCCC"}>
Notify me 15 minutes before a session
</Typography>
<FormControlLabel disabled control={<IOSSwitch checked={checked15Min} onChange={handle15Min} />} />
</Grid >

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"} color={"#CCCCCC"}>
Notify me 60 minutes before a session
</Typography>
<FormControlLabel disabled control={<IOSSwitch checked={checked60Min} onChange={handle60Min} />} />
</Grid>
{/* <Grid>
<Typography variant="h6">Text Notifications</Typography>

<Grid item textAlign={"center"}>
<FormControlLabel control={<Switch />} />
<Grid Item>
<FormControlLabel control={<Switch />} />
</Grid>
<Grid item>
<FormControlLabel control={<Switch />} />
</Grid>
<Grid item>
<FormControlLabel control={<Switch />} />
</Grid>
</Grid>
</Grid> */}
</Grid>
</Box>
</Box>
</Box>
</Box >
);
}
48 changes: 39 additions & 9 deletions src/pages/Profile/ProfileMentor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export default function ProfileMentor({ token, pk, setAuth }) {
.then((res) => {
setFirstName(
res.data.first_name.charAt(0).toUpperCase() +
res.data.first_name.slice(1)
res.data.first_name.slice(1)
);
setLastName(
res.data.last_name.charAt(0).toUpperCase() +
res.data.last_name.slice(1)
res.data.last_name.slice(1)
);
if (res.data.phone_number) {
setPhoneNumber(
Expand Down Expand Up @@ -274,13 +274,12 @@ export default function ProfileMentor({ token, pk, setAuth }) {
<Typography variant="h4" paddingLeft={"1rem"}>
Notifications:
</Typography>
{/* spacing should be 12 perhaps */}
<Grid container direction={"row"} spacing={2}>
<Grid marginRight={"rem"} marginLeft={"4rem"} width={"35rem"}>
<Grid sx={{ marginLeft: "4rem", width: "35rem" }}>
<Grid item>
<Grid item>
<br></br>
</Grid>
<Grid item display={"flex"} justifyContent={"space-between"}>

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"} marginTop={"1.5rem"}>
<Typography fontSize={"18px"} alignSelf={"center"}>
Notify me when a mentee schedules a session
</Typography>
Expand All @@ -293,7 +292,8 @@ export default function ProfileMentor({ token, pk, setAuth }) {
}
/>
</Grid>
<Grid item display={"flex"} justifyContent={"space-between"}>

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"} alignSelf={"center"}>
Notify me when a session is confirmed
</Typography>
Expand All @@ -306,7 +306,8 @@ export default function ProfileMentor({ token, pk, setAuth }) {
}
/>
</Grid>
<Grid item display={"flex"} justifyContent={"space-between"}>

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"} alignSelf={"center"}>
Notify me when a mentee cancels a session
</Typography>
Expand All @@ -319,6 +320,35 @@ export default function ProfileMentor({ token, pk, setAuth }) {
}
/>
</Grid>

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"} alignSelf={"center"} color={"#CCCCCC"}>
Notify me 15 minutes before a session
</Typography>
<FormControlLabel disabled
control={
<IOSSwitch
checked={checked15Min}
onChange={handle15Min}
/>
}
/>
</Grid>

<Grid item display={"flex"} justifyContent={"space-between"} marginBottom={".5rem"}>
<Typography fontSize={"18px"} alignSelf={"center"} color={"#CCCCCC"}>
Notify me 60 minutes before a session
</Typography>
<FormControlLabel disabled
control={
<IOSSwitch
checked={checked60Min}
onChange={handle60Min}
/>
}
/>
</Grid>

<Box sx={{ marginTop: "4rem" }}></Box>
</Grid>
</Grid>
Expand Down