Skip to content

Commit 7555dc6

Browse files
committed
Merge branch 'master' of github.com:isaacphysics/isaac-react-app into feature/fasttrack-graphics
2 parents a15aa9d + 1615f24 commit 7555dc6

File tree

17 files changed

+170
-113
lines changed

17 files changed

+170
-113
lines changed

src/IsaacAppTypes.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,17 @@ export interface AppAssignmentProgress {
546546
}
547547

548548
export interface AugmentedEvent extends ApiTypes.IsaacEventPageDTO {
549-
multiDay?: boolean;
550-
expired?: boolean;
551-
withinBookingDeadline?: boolean;
552-
inProgress?: boolean;
553-
teacher?: boolean;
554-
student?: boolean;
555-
virtual?: boolean;
556-
recurring?: boolean;
549+
isMultiDay?: boolean;
550+
hasExpired?: boolean;
551+
isWithinBookingDeadline?: boolean;
552+
isInProgress?: boolean;
553+
isATeacherEvent?: boolean;
554+
isAStudentEvent?: boolean;
555+
isVirtual?: boolean;
556+
isStudentOnly?: boolean;
557+
isRecurring?: boolean;
558+
isWaitingListOnly?: boolean;
559+
isNotClosed?: boolean;
557560
field?: "physics" | "maths";
558561
}
559562

src/app/components/content/IsaacQuestion.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,14 @@ const IsaacQuestionComponent = ({doc, validationResponse, currentAttempt, canSub
256256
{(!validationResponse || !validationResponse.correct || canSubmit) && !locked &&
257257
<div className="d-flex align-items-stretch flex-column-reverse flex-sm-row flex-md-column-reverse flex-lg-row">
258258
{secondaryAction && <div
259-
className={`text-center pt-3 pb-1 w-100 w-sm-50 w-md-100 w-lg-50 ${primaryAction ? "pr-sm-2 pr-md-0 pr-lg-3" : ""}`}
259+
className={`m-auto pt-3 pb-1 w-100 w-sm-50 w-md-100 w-lg-50 ${primaryAction ? "pr-sm-2 pr-md-0 pr-lg-3" : ""}`}
260260
>
261-
<input {...secondaryAction} className="btn btn-outline-primary btn-block" />
261+
<input {...secondaryAction} className="h-100 btn btn-outline-primary btn-block" />
262262
</div>}
263263
{primaryAction && <div
264-
className={`text-center pt-3 pb-1 w-100 w-sm-50 w-md-100 w-lg-50 ${secondaryAction ? "pl-sm-2 pl-md-0 pl-lg-3" : ""}`}
264+
className={`m-auto pt-3 pb-1 w-100 w-sm-50 w-md-100 w-lg-50 ${secondaryAction ? "pl-sm-2 pl-md-0 pl-lg-3" : ""}`}
265265
>
266-
<input {...primaryAction} className="btn btn-secondary btn-block" />
266+
<input {...primaryAction} className="h-100 btn btn-secondary btn-block" />
267267
</div>}
268268
</div>
269269
}

src/app/components/elements/Accordion.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ const AccordionComponent = ({id, trustedTitle, index, children, location: {hash}
140140
}}
141141
aria-expanded={open ? "true" : "false"}
142142
>
143-
{level && <span className="accordion-level badge-secondary">Level {level}</span>}
143+
{/*TODO CS Level*/}
144+
{SITE_SUBJECT === SITE.PHY && level && <span className="accordion-level badge-secondary">Level {level}</span>}
144145
<div className="accordion-title pl-3">
145146
<RS.Row><span className="accordion-part p-3 text-secondary">Part {ALPHABET[index % ALPHABET.length]} {" "}</span>
146147
{trustedTitle && <div className="p-3"><TrustedHtml html={trustedTitle} /></div>}</RS.Row>

src/app/components/elements/EventBookingForm.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {useDispatch, useSelector} from "react-redux";
66
import {requestEmailVerification} from "../../state/actions";
77
import {UserSummaryWithEmailAddressDTO} from "../../../IsaacApiTypes";
88
import {AppState} from "../../state/reducers";
9+
import {studentOnlyEventMessage} from "../../services/events";
910

1011
interface EventBookingFormProps {
1112
event: AugmentedEvent;
@@ -97,21 +98,22 @@ export const EventBookingForm = ({event, targetUser, additionalInformation, upda
9798
onChange={event => updateAdditionalInformation({yearGroup: event.target.value})}
9899
>
99100
<option value="" />
100-
{event.student && <option value="9">Year 9</option>}
101-
{event.student && <option value="10">Year 10</option>}
102-
{event.student && <option value="11">Year 11</option>}
103-
{event.student && <option value="12">Year 12</option>}
104-
{event.student && <option value="13">Year 13</option>}
105-
<option value="TEACHER">N/A - Teacher</option>
106-
<option value="OTHER">N/A - Other</option>
101+
{event.isAStudentEvent && <option value="9">Year 9</option>}
102+
{event.isAStudentEvent && <option value="10">Year 10</option>}
103+
{event.isAStudentEvent && <option value="11">Year 11</option>}
104+
{event.isAStudentEvent && <option value="12">Year 12</option>}
105+
{event.isAStudentEvent && <option value="13">Year 13</option>}
106+
{!event.isStudentOnly && <option value="TEACHER">N/A - Teacher</option>}
107+
{!event.isStudentOnly && <option value="OTHER">N/A - Other</option>}
107108
</RS.Input>
108-
{event.teacher && additionalInformation.yearGroup == 'TEACHER' && <div className="mt-2 text-right">
109+
{event.isStudentOnly && <div className="text-muted">{studentOnlyEventMessage(event.id)}</div>}
110+
{(event.isATeacherEvent || additionalInformation.yearGroup == 'TEACHER') && <div className="mt-2 text-right">
109111
<a href="/pages/teacher_accounts" target="_blank">Click to upgrade to a teacher account</a> for free!
110112
</div>}
111113
</React.Fragment>}
112114
</div>
113115

114-
{!event.virtual && <div>
116+
{!event.isVirtual && <div>
115117
<div>
116118
<RS.Label htmlFor="medical-reqs">
117119
Dietary requirements or relevant medical conditions

src/app/components/elements/RelatedContent.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Link} from "react-router-dom";
55
import {DOCUMENT_TYPE, documentTypePathPrefix} from "../../services/constants";
66
import {connect} from "react-redux";
77
import {logAction} from "../../state/actions";
8+
import {SITE_SUBJECT, SITE} from "../../services/siteConstants";
89

910
interface RelatedContentProps {
1011
content: ContentSummaryDTO[];
@@ -61,7 +62,8 @@ export const RelatedContentComponent = ({content, parentPage, logAction}: Relate
6162
<Link to={getURLForContent(contentSummary)}
6263
onClick={() => {logAction(getEventDetails(contentSummary, parentPage))}}
6364
>
64-
{contentSummary.level && contentSummary.level != '0' ? (contentSummary.title + " (Level " + contentSummary.level + ")") : contentSummary.title}
65+
{/*TODO CS Level*/}
66+
{SITE_SUBJECT === SITE.PHY && contentSummary.level && contentSummary.level != '0' ? (contentSummary.title + " (Level " + contentSummary.level + ")") : contentSummary.title}
6567
</Link>
6668
</ListGroupItem>
6769
);

src/app/components/elements/cards/EventCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {DateString} from "../DateString";
77
import {formatEventCardDate} from "../../../services/events";
88

99
export const EventCard = ({event, pod = false}: {event: AugmentedEvent; pod?: boolean}) => {
10-
const {id, title, subtitle, eventThumbnail, location, expired, date} = event;
10+
const {id, title, subtitle, eventThumbnail, location, hasExpired, date} = event;
1111

12-
return <RS.Card className={classnames({'card-neat': true, 'disabled text-muted': expired, 'm-4': pod, 'mb-4': !pod})}>
12+
return <RS.Card className={classnames({'card-neat': true, 'disabled text-muted': hasExpired, 'm-4': pod, 'mb-4': !pod})}>
1313
{eventThumbnail && <div className={'event-card-image text-center'}>
1414
<RS.CardImg top src={eventThumbnail.src} alt="" />
1515
</div>}
@@ -25,7 +25,7 @@ export const EventCard = ({event, pod = false}: {event: AugmentedEvent; pod?: bo
2525
</span>
2626
{location && location.address && <span className='d-block my-2'>
2727
<span className="font-weight-bold">Location:</span> {" "}
28-
{!event.virtual ?
28+
{!event.isVirtual ?
2929
<span>{location.address.addressLine1}{location.address.town && `, ${location.address.town}`}</span> :
3030
<span>Online</span>
3131
}

src/app/components/handlers/PasswordResetHandler.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ const ResetPasswordHandlerComponent = ({urlToken, handleResetPassword, verifyPas
5151
<CardBody>
5252
<Form name="passwordReset">
5353
<FormGroup>
54-
<Label htmlFor="password-input">New password</Label>
55-
<Input id="password" type="password" name="password"
54+
<Label htmlFor="password">New password</Label>
55+
<Input id="password" type="password" name="password-new"
5656
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
5757
passwordDebounce(e.target.value, setPasswordFeedback);
5858
}}
@@ -71,7 +71,7 @@ const ResetPasswordHandlerComponent = ({urlToken, handleResetPassword, verifyPas
7171
</FormGroup>
7272
<FormGroup>
7373
<Label htmlFor="password-confirm">Re-enter new password</Label>
74-
<Input invalid={!isValidPassword} id="password-confirm" type="password" name="password" onBlur={(e: any) => {
74+
<Input invalid={!isValidPassword} id="password-confirm" type="password" name="password-new-confirm" onBlur={(e: any) => {
7575
validateAndSetPassword(e);
7676
(e.target.value == (document.getElementById("password") as HTMLInputElement).value) ? setCurrentPassword(e.target.value) : null}
7777
} aria-describedby="invalidPassword" required/>
@@ -83,7 +83,12 @@ const ResetPasswordHandlerComponent = ({urlToken, handleResetPassword, verifyPas
8383
<h4 role="alert" className="text-danger text-center mb-0">
8484
{errorMessage && errorMessage.type === "generalError" && errorMessage.generalError}
8585
</h4>
86-
<Button color="secondary" className="mb-2" block onClick={(e: any) => (isValidPassword && !errorMessage) ? handleResetPassword({token: urlToken, password: currentPassword}) : null}>Change Password</Button>
86+
<Button color="secondary" className="mb-2" block
87+
onClick={() => (isValidPassword && !errorMessage) ? handleResetPassword({token: urlToken, password: currentPassword}) : null}
88+
id="change-password"
89+
>
90+
Change Password
91+
</Button>
8792
</CardFooter>
8893
</Card>
8994
</div>

src/app/components/navigation/IsaacApp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ export const IsaacApp = () => {
8989
}, []);
9090

9191
useEffect(() => {
92+
const dateNow = new Date();
9293
if (showNotification(user) && notifications && notifications.length > 0) {
9394
dispatch(openActiveModal(notificationModal(notifications[0])));
94-
persistence.save(KEY.LAST_NOTIFICATION_TIME, Date.now().toString())
95+
persistence.save(KEY.LAST_NOTIFICATION_TIME, dateNow.toString())
9596
}
9697
}, [notifications, user]);
9798

src/app/components/pages/AdminEmails.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ export const AdminEmails = (props: AdminEmailsProps) => {
123123
<RS.Card className="p-3 my-3">
124124
<RS.CardTitle tag="h2">Email type</RS.CardTitle>
125125
<RS.CardBody>
126-
<RS.Label>The type of email you are sending. Users who have opted out of this type of email will not receive anything. </RS.Label>
126+
<RS.Label>The type of email you are sending.</RS.Label>
127+
<p>Users who have opted out of this type of email will
128+
not receive anything. Administrative emails cannot be opted out of and should be avoided.</p>
127129
<RS.Input
128130
id="email-type-input" type="select" defaultValue={emailType}
129131
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
@@ -134,6 +136,7 @@ export const AdminEmails = (props: AdminEmailsProps) => {
134136
<option value="ASSIGNMENTS">Assignments</option>
135137
<option value="NEWS_AND_UPDATES">News and updates</option>
136138
<option value="EVENTS">Events</option>
139+
<option value="ADMIN">Urgent administrative email</option>
137140
</RS.Input>
138141
</RS.CardBody>
139142
</RS.Card>

0 commit comments

Comments
 (0)