-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create class table * simplify * quick save * create class form props * create class form * Teacher auto complete field * fix filter * fix filter * simplify * fix api call * handle query state * prefer cache value * delete env vars * feedback * use latest js package * update packages
- Loading branch information
Showing
21 changed files
with
904 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
VITE_API_BASE_URL=http://localhost:8000/api/ | ||
# Service. | ||
VITE_SERVICE_NAME=portal | ||
VITE_SERVICE_IS_ROOT=1 | ||
|
||
# Gmail. | ||
VITE_GMAIL_FILTERS_PASSWORD_RESET_REQUEST="from:[email protected] subject:Password reset request" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd "${BASH_SOURCE%/*}" | ||
cd "${BASH_SOURCE%/*}/.." | ||
|
||
rm -f ../yarn.lock | ||
rm -rf ../node_modules | ||
yarn cache clean codeforlife | ||
yarn install --production=false | ||
wget -O - https://raw.githubusercontent.com/ocadotechnology/codeforlife-workspace/main/scripts/frontend/hard-install | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd "${BASH_SOURCE%/*}" | ||
cd "${BASH_SOURCE%/*}/.." | ||
|
||
source ./setup | ||
|
||
yarn dev | ||
wget -O - https://raw.githubusercontent.com/ocadotechnology/codeforlife-workspace/main/scripts/frontend/run | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd "${BASH_SOURCE%/*}" | ||
cd "${BASH_SOURCE%/*}/.." | ||
|
||
yarn install --production=false | ||
wget -O - https://raw.githubusercontent.com/ocadotechnology/codeforlife-workspace/main/scripts/frontend/setup | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { TextField, type TextFieldProps } from "codeforlife/components/form" | ||
import { type FC } from "react" | ||
import { InputAdornment } from "@mui/material" | ||
import { PeopleAlt as PeopleAltIcon } from "@mui/icons-material" | ||
import { string as YupString } from "yup" | ||
|
||
export type ClassNameFieldProps = Omit< | ||
TextFieldProps, | ||
"type" | "name" | "schema" | ||
> & | ||
Partial<Pick<TextFieldProps, "name">> | ||
|
||
const ClassNameField: FC<ClassNameFieldProps> = ({ | ||
name = "name", | ||
label = "Last name", | ||
placeholder = "Enter a class name", | ||
InputProps = {}, | ||
...otherTextFieldProps | ||
}) => ( | ||
<TextField | ||
schema={YupString().max(200)} | ||
name={name} | ||
label={label} | ||
placeholder={placeholder} | ||
InputProps={{ | ||
endAdornment: ( | ||
<InputAdornment position="end"> | ||
<PeopleAltIcon /> | ||
</InputAdornment> | ||
), | ||
...InputProps, | ||
}} | ||
{...otherTextFieldProps} | ||
/> | ||
) | ||
|
||
export default ClassNameField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
CheckboxField, | ||
type CheckboxFieldProps, | ||
} from "codeforlife/components/form" | ||
import { type FC } from "react" | ||
|
||
export type ReadClassmatesDataFieldProps = Omit< | ||
CheckboxFieldProps, | ||
"name" | "formControlLabelProps" | ||
> & | ||
Partial<Pick<CheckboxFieldProps, "name" | "formControlLabelProps">> | ||
|
||
const ReadClassmatesDataField: FC<ReadClassmatesDataFieldProps> = ({ | ||
name = "read_classmates_data", | ||
formControlLabelProps, | ||
...otherCheckboxFieldProps | ||
}) => { | ||
const { | ||
label = "Allow students to see their classmates' progress?", | ||
...otherFormControlLabelProps | ||
} = formControlLabelProps || {} | ||
|
||
return ( | ||
<CheckboxField | ||
name={name} | ||
formControlLabelProps={{ label, ...otherFormControlLabelProps }} | ||
{...otherCheckboxFieldProps} | ||
/> | ||
) | ||
} | ||
|
||
export default ReadClassmatesDataField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ApiAutocompleteField } from "codeforlife/components/form" | ||
import { type FC } from "react" | ||
|
||
import { type ListUsersArg, useLazyListUsersQuery } from "../../api/user" | ||
|
||
export interface TeacherAutocompleteFieldProps { | ||
required?: boolean | ||
name?: string | ||
_id?: ListUsersArg["_id"] | ||
} | ||
|
||
const TeacherAutocompleteField: FC<TeacherAutocompleteFieldProps> = ({ | ||
required = false, | ||
name = "teacher", | ||
_id, | ||
}) => ( | ||
<ApiAutocompleteField | ||
useLazyListQuery={useLazyListUsersQuery} | ||
searchKey="name" | ||
filterOptions={{ type: "teacher", _id }} | ||
getOptionLabel={({ first_name, last_name }) => `${first_name} ${last_name}`} | ||
getOptionKey={({ teacher }) => teacher!.id} | ||
textFieldProps={{ required, name }} | ||
/> | ||
) | ||
|
||
export default TeacherAutocompleteField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import LastNameField, { type LastNameFieldProps } from "./LastNameField" | ||
import NewPasswordField, { | ||
type NewPasswordFieldProps, | ||
} from "./NewPasswordField" | ||
import SchoolNameField, { type SchoolNameFieldProps } from "./SchoolNameField" | ||
|
||
export { | ||
LastNameField, | ||
NewPasswordField, | ||
type LastNameFieldProps, | ||
type NewPasswordFieldProps, | ||
SchoolNameField, | ||
type SchoolNameFieldProps, | ||
} | ||
export * from "./ClassNameField" | ||
export { default as ClassNameField } from "./ClassNameField" | ||
export * from "./LastNameField" | ||
export { default as LastNameField } from "./LastNameField" | ||
export * from "./NewPasswordField" | ||
export { default as NewPasswordField } from "./NewPasswordField" | ||
export * from "./ReadClassmatesDataField" | ||
export { default as ReadClassmatesDataField } from "./ReadClassmatesDataField" | ||
export * from "./SchoolNameField" | ||
export { default as SchoolNameField } from "./SchoolNameField" | ||
export * from "./TeacherAutocompleteField" | ||
export { default as TeacherAutocompleteField } from "./TeacherAutocompleteField" |
Oops, something went wrong.