Skip to content

Commit

Permalink
edit school error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
lsylcy0307 committed Dec 6, 2023
2 parents ed7a76a + 50b6d4b commit e74d316
Show file tree
Hide file tree
Showing 67 changed files with 15,758 additions and 12,943 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ yarn.lock
.env.test.local
.env.production.local

.vscode
.tool-versions
.vscode
66 changes: 33 additions & 33 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"autoFix": true,
"language": "typescript"
},
{
"autoFix": true,
"language": "typescriptreact"
}
],
"prettier.eslintIntegration": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"autoFix": true,
"language": "typescript"
},
}
{
"autoFix": true,
"language": "typescriptreact"
}
],
"prettier.eslintIntegration": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
9 changes: 9 additions & 0 deletions client/public/first_session.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions client/public/ten_sessions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions client/public/vowels.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 63 additions & 2 deletions client/src/Admin/AdminAddBlockPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ interface submitState {
startTime: string;
endTime: string;
zoom: string;
absenceNotification: string;
exitTicket: string;
teacher: IUser | null;
pairs: [IUser | null, IStudent | null][];
coachesInBlock: string[];
Expand All @@ -47,6 +49,8 @@ export function submitError({
startTime,
endTime,
zoom,
absenceNotification,
exitTicket,
teacher,
pairs,
coachesInBlock,
Expand All @@ -59,6 +63,8 @@ export function submitError({
startTime === '' ||
endTime === '' ||
zoom === '' ||
absenceNotification === '' ||
exitTicket === '' ||
teacher === null
) {
return 'Please fill out all fields';
Expand Down Expand Up @@ -119,6 +125,8 @@ function AdminAddBlockPage() {
const [startTime, setStartTime] = useState('');
const [endTime, setEndTime] = useState('');
const [zoom, setZoom] = useState('');
const [absenceNotification, setAbsenceNotification] = useState('');
const [exitTicket, setExitTicket] = useState('');
const [teachers, setTeachers] = useState<IUser[]>([]);
const [coaches, setCoaches] = useState([]);
const [students, setStudents] = useState<IStudent[]>([]);
Expand All @@ -130,6 +138,7 @@ function AdminAddBlockPage() {
]);

const [error, setError] = useState('');
const [nameError, setNameError] = useState('');

const users = useData('admin/all');
const studentList = useData('student/all');
Expand Down Expand Up @@ -187,7 +196,14 @@ function AdminAddBlockPage() {
const handleNameChange = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => {
setName(event.target.value as string);
const newName = event.target.value;

if (newName.length <= 26) {
setName(newName);
setNameError('');
} else {
setNameError('Name cannot exceed 26 characters');
}
};

const handleStartTimeChange = (
Expand All @@ -207,6 +223,16 @@ function AdminAddBlockPage() {
) => {
setZoom(event.target.value as string);
};
const handleAbsenceNotiChange = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => {
setAbsenceNotification(event.target.value as string);
};
const handleExitTicketChange = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => {
setExitTicket(event.target.value as string);
};

const displayName = (user: IUser | null) => {
if (user === null) {
Expand Down Expand Up @@ -238,6 +264,8 @@ function AdminAddBlockPage() {
setTeacher(null);
setPairs([[null, null]]);
setZoom('');
setAbsenceNotification('');
setExitTicket('');
};

const handleSubmit = () => {
Expand All @@ -247,6 +275,8 @@ function AdminAddBlockPage() {
startTime,
endTime,
zoom,
absenceNotification,
exitTicket,
teacher,
pairs,
coachesInBlock,
Expand All @@ -264,6 +294,8 @@ function AdminAddBlockPage() {
startTime,
endTime,
zoom,
absenceNotification,
exitTicket,
pairs,
});
setAlert('Added block successfully!', AlertType.SUCCESS);
Expand Down Expand Up @@ -312,6 +344,11 @@ function AdminAddBlockPage() {
variant="standard"
placeholder="Name"
/>
{nameError && (
<Typography justifyContent="center" color="red">
{nameError}
</Typography>
)}
</Grid>
<Grid item width="1">
<Typography variant="subtitle1">Start Time</Typography>
Expand Down Expand Up @@ -343,6 +380,26 @@ function AdminAddBlockPage() {
placeholder="Zoom link"
/>
</Grid>
<Grid item width="1">
<TextField
fullWidth
value={absenceNotification}
onChange={handleAbsenceNotiChange}
label="Absence Notification Link"
variant="standard"
placeholder="Absence notification link"
/>
</Grid>
<Grid item width="1">
<TextField
fullWidth
value={exitTicket}
onChange={handleExitTicketChange}
label="Exit Ticket Link"
variant="standard"
placeholder="Exit Ticket link"
/>
</Grid>
<Grid item width="1" marginBottom="1">
<Autocomplete
disablePortal
Expand Down Expand Up @@ -478,7 +535,11 @@ function AdminAddBlockPage() {
</Grid>
{error && (
<Grid item container justifyContent="center">
<Typography justifyContent="center" color="red">
<Typography
justifyContent="center"
color="red"
style={{ paddingBottom: '20px' }}
>
{error}
</Typography>
</Grid>
Expand Down
Loading

0 comments on commit e74d316

Please sign in to comment.