diff --git a/src/app/components/content/IsaacContent.tsx b/src/app/components/content/IsaacContent.tsx index d0afc96c82..f155f0df5b 100644 --- a/src/app/components/content/IsaacContent.tsx +++ b/src/app/components/content/IsaacContent.tsx @@ -1,4 +1,4 @@ -import React, {lazy, useRef} from "react"; +import React, {lazy} from "react"; import {AnvilApp} from "./AnvilApp"; import {IsaacContentValueOrChildren} from "./IsaacContentValueOrChildren"; import {IsaacQuestion} from "./IsaacQuestion"; @@ -21,8 +21,8 @@ import {isQuestion} from "../../services"; import {IsaacCodeTabs} from "./IsaacCodeTabs"; import {IsaacInteractiveCodeSnippet} from "./IsaacInteractiveCodeSnippet"; import {IsaacCallout} from "./IsaacCallout"; -import IsaacInlineRegion from "./IsaacInlineRegion"; import InlineContextProvider from "../elements/InlineContextProvider"; + const IsaacCodeSnippet = lazy(() => import("./IsaacCodeSnippet")); const classBasedLayouts = { diff --git a/src/app/components/content/IsaacLLMFreeTextQuestion.tsx b/src/app/components/content/IsaacLLMFreeTextQuestion.tsx index 0992ca32fe..9aaaa29c7a 100644 --- a/src/app/components/content/IsaacLLMFreeTextQuestion.tsx +++ b/src/app/components/content/IsaacLLMFreeTextQuestion.tsx @@ -1,10 +1,10 @@ import React from "react"; import {IsaacContentValueOrChildren} from "./IsaacContentValueOrChildren"; import {IsaacLLMFreeTextQuestionDTO, LLMFreeTextChoiceDTO} from "../../../IsaacApiTypes"; -import {Alert, FormGroup, Input} from "reactstrap"; +import {FormGroup, Input} from "reactstrap"; import {IsaacQuestionProps, ValidatedChoice} from "../../../IsaacAppTypes"; import {useCurrentQuestionAttempt} from "../../services"; -import { useCanAttemptQuestionTypeQuery } from "../../state"; +import {useCanAttemptQuestionTypeQuery} from "../../state"; interface Limit { exceeded: boolean; @@ -98,4 +98,4 @@ const IsaacLLMFreeTextQuestion = ({doc, questionId, readonly}: IsaacQuestionProp ); }; -export default IsaacLLMFreeTextQuestion; \ No newline at end of file +export default IsaacLLMFreeTextQuestion; diff --git a/src/app/components/content/IsaacNumericQuestion.tsx b/src/app/components/content/IsaacNumericQuestion.tsx index 300a6c4b18..4a43b01f55 100644 --- a/src/app/components/content/IsaacNumericQuestion.tsx +++ b/src/app/components/content/IsaacNumericQuestion.tsx @@ -1,6 +1,5 @@ import React, {FormEvent, useMemo, useState} from "react"; import {AppState, useAppSelector, useGetConstantUnitsQuery} from "../../state"; -import Rand from 'rand-seed'; import {IsaacContentValueOrChildren} from "./IsaacContentValueOrChildren"; import {IsaacNumericQuestionDTO, QuantityDTO, QuantityValidationResponseDTO} from "../../../IsaacApiTypes"; import { @@ -22,7 +21,7 @@ import {IsaacQuestionProps} from "../../../IsaacAppTypes"; import {Markup} from "../elements/markup"; import classNames from "classnames"; import QuestionInputValidation from "../elements/inputs/QuestionInputValidation"; -import { selectUnits, wrapUnitForSelect } from "../../services/numericUnits"; +import {selectUnits, wrapUnitForSelect} from "../../services/numericUnits"; export const numericInputValidator = (input: string) => { const regexStr = "[^ 0-9EXex(){},.+*/\\^×÷-]"; diff --git a/src/app/components/content/IsaacSymbolicLogicQuestion.tsx b/src/app/components/content/IsaacSymbolicLogicQuestion.tsx index e5355bf0f5..17a25219a8 100644 --- a/src/app/components/content/IsaacSymbolicLogicQuestion.tsx +++ b/src/app/components/content/IsaacSymbolicLogicQuestion.tsx @@ -4,11 +4,11 @@ import {IsaacContentValueOrChildren} from "./IsaacContentValueOrChildren"; import {IsaacSymbolicLogicQuestionDTO, LogicFormulaDTO} from "../../../IsaacApiTypes"; import katex from "katex"; import { - ifKeyIsEnter, isAda, + ifKeyIsEnter, isDefined, - isStaff, jsonHelper, - sanitiseInequalityState, siteSpecific, + sanitiseInequalityState, + siteSpecific, useCurrentQuestionAttempt, useUserPreferences } from "../../services"; @@ -18,7 +18,6 @@ import {v4 as uuid_v4} from "uuid"; import {Inequality, makeInequality} from 'inequality'; import {parseBooleanExpression, ParsingError} from 'inequality-grammar'; import {IsaacQuestionProps} from "../../../IsaacAppTypes"; -import classNames from "classnames"; import QuestionInputValidation from "../elements/inputs/QuestionInputValidation"; const InequalityModal = lazy(() => import("../elements/modals/inequality/InequalityModal")); diff --git a/src/app/components/content/IsaacSymbolicQuestion.tsx b/src/app/components/content/IsaacSymbolicQuestion.tsx index 273ad5914c..d1668d7f33 100644 --- a/src/app/components/content/IsaacSymbolicQuestion.tsx +++ b/src/app/components/content/IsaacSymbolicQuestion.tsx @@ -1,4 +1,14 @@ -import React, {ChangeEvent, lazy, Suspense, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState} from "react"; +import React, { + ChangeEvent, + lazy, + Suspense, + useCallback, + useEffect, + useLayoutEffect, + useMemo, + useRef, + useState +} from "react"; import {IsaacContentValueOrChildren} from "./IsaacContentValueOrChildren"; import {FormulaDTO, IsaacSymbolicQuestionDTO} from "../../../IsaacApiTypes"; import katex from "katex"; @@ -6,18 +16,18 @@ import { ifKeyIsEnter, isDefined, jsonHelper, - sanitiseInequalityState, parsePseudoSymbolicAvailableSymbols, - useCurrentQuestionAttempt, isAda, siteSpecific + sanitiseInequalityState, + siteSpecific, + useCurrentQuestionAttempt } from "../../services"; import {Inequality, makeInequality} from "inequality"; import {parseMathsExpression, ParsingError} from "inequality-grammar"; import _flattenDeep from 'lodash/flatMapDeep'; import {v4 as uuid_v4} from "uuid"; import {IsaacQuestionProps} from "../../../IsaacAppTypes"; -import classNames from "classnames"; import QuestionInputValidation from "../elements/inputs/QuestionInputValidation"; -import { InputGroup, Input, Button, UncontrolledTooltip } from "reactstrap"; +import {Button, Input, InputGroup, UncontrolledTooltip} from "reactstrap"; const InequalityModal = lazy(() => import("../elements/modals/inequality/InequalityModal")); diff --git a/src/app/components/elements/LLMFreeTextQuestionFeedbackView.tsx b/src/app/components/elements/LLMFreeTextQuestionFeedbackView.tsx index 3a53ec5f5d..b6417c78b4 100644 --- a/src/app/components/elements/LLMFreeTextQuestionFeedbackView.tsx +++ b/src/app/components/elements/LLMFreeTextQuestionFeedbackView.tsx @@ -1,13 +1,13 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, {useEffect, useRef, useState} from 'react'; import {LLMFreeTextQuestionValidationResponseDTO} from "../../../IsaacApiTypes"; -import {Alert, Button, Card, Table} from "reactstrap"; +import {Button, Table} from "reactstrap"; import {siteSpecific} from "../../services/siteConstants"; import {Immutable} from "immer"; -import { Link } from 'react-router-dom'; -import { StyledCheckbox } from './inputs/StyledCheckbox'; -import { logAction, selectors, useAppDispatch, useAppSelector } from '../../state'; -import { NOT_FOUND } from '../../services'; +import {Link} from 'react-router-dom'; +import {StyledCheckbox} from './inputs/StyledCheckbox'; +import {logAction, selectors, useAppDispatch, useAppSelector} from '../../state'; +import {NOT_FOUND} from '../../services'; const noFeedback = {disagree: false, partlyAgree: false, agree: false}; @@ -60,7 +60,7 @@ export default function LLMFreeTextQuestionFeedbackView({validationResponse, has {hasSubmitted && <> - {!sentFeedback + {!sentFeedback ?

Before submitting another response, please say whether you agree with the predicted mark.

+ :
Feedback submitted
diff --git a/src/app/components/elements/ReportAccordionButton.tsx b/src/app/components/elements/ReportAccordionButton.tsx index ad0da568cd..1296c3334f 100644 --- a/src/app/components/elements/ReportAccordionButton.tsx +++ b/src/app/components/elements/ReportAccordionButton.tsx @@ -1,6 +1,5 @@ import React from "react"; import {logAction, useAppDispatch} from "../../state"; -import {isPhy} from "../../services"; interface ReportAccordionButtonProps { pageId?: string, @@ -48,4 +47,4 @@ export const ReportAccordionButton = ({pageId, sectionId, sectionTitle, sectionI window.open(`/contact?preset=contentProblem${getContactFormParams()}`, "_blank"); }} />; -}; \ No newline at end of file +}; diff --git a/src/app/components/elements/ShareLink.tsx b/src/app/components/elements/ShareLink.tsx index 86c20d6f30..279c77aa60 100644 --- a/src/app/components/elements/ShareLink.tsx +++ b/src/app/components/elements/ShareLink.tsx @@ -1,5 +1,5 @@ import React, {useEffect, useRef, useState} from "react"; -import {isAda, isMobile, isPhy, isTutorOrAbove, PATHS, siteSpecific, useOutsideCallback} from "../../services"; +import {isMobile, isPhy, isTutorOrAbove, PATHS, siteSpecific, useOutsideCallback} from "../../services"; import {selectors, useAppSelector} from "../../state"; import classNames from "classnames"; diff --git a/src/app/components/elements/TitleAndBreadcrumb.tsx b/src/app/components/elements/TitleAndBreadcrumb.tsx index 552afc5b79..ac034597d9 100644 --- a/src/app/components/elements/TitleAndBreadcrumb.tsx +++ b/src/app/components/elements/TitleAndBreadcrumb.tsx @@ -2,7 +2,7 @@ import React, {ReactElement} from "react"; import {PageTitle, PageTitleProps} from "./PageTitle"; import {Breadcrumb, BreadcrumbItem} from "reactstrap"; import {Link} from "react-router-dom"; -import {CollectionType, HOME_CRUMB, isAda, isPhy, LinkInfo} from "../../services"; +import {CollectionType, HOME_CRUMB, isAda, LinkInfo} from "../../services"; import {Markup} from "./markup"; import classNames from "classnames"; diff --git a/src/app/components/elements/cards/NewsCard.tsx b/src/app/components/elements/cards/NewsCard.tsx index d390c0af4f..264f079c86 100644 --- a/src/app/components/elements/cards/NewsCard.tsx +++ b/src/app/components/elements/cards/NewsCard.tsx @@ -1,11 +1,10 @@ import React from "react"; import {Link} from "react-router-dom"; -import {Button, Card, CardBody, CardFooter, CardImg, CardProps, CardText, CardTitle, Container} from "reactstrap"; +import {Card, CardBody, CardImg, CardProps, CardText} from "reactstrap"; import {IsaacPodDTO} from "../../../../IsaacApiTypes"; -import {apiHelper, isAppLink, siteSpecific} from "../../../services"; +import {apiHelper, siteSpecific} from "../../../services"; import classNames from "classnames"; -import { ExternalLink } from "../ExternalLink"; -import { AdaCard } from "./AdaCard"; +import {AdaCard} from "./AdaCard"; interface NewsCardProps extends CardProps { newsItem: IsaacPodDTO; diff --git a/src/app/components/elements/inputs/CountryInput.tsx b/src/app/components/elements/inputs/CountryInput.tsx index 230be02d17..ba66af95d8 100644 --- a/src/app/components/elements/inputs/CountryInput.tsx +++ b/src/app/components/elements/inputs/CountryInput.tsx @@ -1,6 +1,6 @@ import {Immutable} from "immer"; import {ValidationUser} from "../../../../IsaacAppTypes"; -import {FormFeedback, FormGroup, Label} from "reactstrap"; +import {FormGroup, Label} from "reactstrap"; import classNames from "classnames"; import React, {ChangeEvent} from "react"; import {useGetCountriesQuery, useGetPriorityCountriesQuery,} from "../../../state"; diff --git a/src/app/components/elements/inputs/StyledCheckbox.tsx b/src/app/components/elements/inputs/StyledCheckbox.tsx index 0290eef3d4..4eeaac0426 100644 --- a/src/app/components/elements/inputs/StyledCheckbox.tsx +++ b/src/app/components/elements/inputs/StyledCheckbox.tsx @@ -2,7 +2,7 @@ import React, {useEffect, useMemo, useState} from "react"; import {Input, InputProps} from "reactstrap"; import {v4} from "uuid"; import {Spacer} from "../Spacer"; -import { ifKeyIsEnter, isPhy } from "../../../services"; +import {ifKeyIsEnter} from "../../../services"; import classNames from "classnames"; // A custom checkbox, dealing with mouse and keyboard input. Pass `onChange((e : ChangeEvent) => void)`, `checked: bool`, and `label: Element` as required as props to use. diff --git a/src/app/components/elements/inputs/UserContextAccountInput.tsx b/src/app/components/elements/inputs/UserContextAccountInput.tsx index 96abd5a221..768f0a9dac 100644 --- a/src/app/components/elements/inputs/UserContextAccountInput.tsx +++ b/src/app/components/elements/inputs/UserContextAccountInput.tsx @@ -7,7 +7,6 @@ import { getFilteredExamBoardOptions, getFilteredStageOptions, isAda, - isDefined, isPhy, isTutorOrAbove, siteSpecific, @@ -21,7 +20,6 @@ import classNames from "classnames"; import {Immutable} from "immer"; import {StyledDropdown} from "./DropdownInput"; import isUndefined from "lodash/isUndefined"; -import { StyledCheckbox } from "./StyledCheckbox"; interface UserContextRowProps { userContext: UserContext; diff --git a/src/app/components/elements/inputs/UserContextPicker.tsx b/src/app/components/elements/inputs/UserContextPicker.tsx index b1592ca135..3f4bc8df29 100644 --- a/src/app/components/elements/inputs/UserContextPicker.tsx +++ b/src/app/components/elements/inputs/UserContextPicker.tsx @@ -1,12 +1,12 @@ -import React, { useEffect, useState } from "react"; +import React, {useEffect, useState} from "react"; import {Col, FormGroup, Input, Label, Row, UncontrolledTooltip} from "reactstrap"; import { EXAM_BOARD, examBoardLabelMap, getFilteredExamBoardOptions, getFilteredStageOptions, - history, - isAda, isLoggedIn, + isAda, + isLoggedIn, isStaff, siteSpecific, STAGE, @@ -14,13 +14,7 @@ import { useQueryParams, useUserViewingContext } from "../../../services"; -import { - selectors, - transientUserContextSlice, - useAppDispatch, - useAppSelector, -} from "../../../state"; -import queryString from "query-string"; +import {selectors, transientUserContextSlice, useAppDispatch, useAppSelector,} from "../../../state"; export const UserContextPicker = ({className, hideLabels = true}: {className?: string; hideLabels?: boolean}) => { const dispatch = useAppDispatch(); @@ -52,7 +46,7 @@ export const UserContextPicker = ({className, hideLabels = true}: {className?: s if (isAda && !isLoggedIn(user) || isStaff(user)) { return - + {/* Stage Selector */} {showStageSelector && <> @@ -100,14 +94,14 @@ export const UserContextPicker = ({className, hideLabels = true}: {className?: s dispatch(transientUserContextSlice.actions.setExamBoard(e.target.value as EXAM_BOARD)); }} > - {onlyOneBoard - ? + {onlyOneBoard + ? : getFilteredExamBoardOptions({byStages: [currentStage], includeNullOptions: true}) .map(item => ) } } - + {showUnusualContextMessage &&
diff --git a/src/app/components/elements/panels/TeacherConnections.tsx b/src/app/components/elements/panels/TeacherConnections.tsx index ed41d7c551..9c729a4c80 100644 --- a/src/app/components/elements/panels/TeacherConnections.tsx +++ b/src/app/components/elements/panels/TeacherConnections.tsx @@ -6,9 +6,9 @@ import { showErrorToast, useAppDispatch, useChangeMyMembershipStatusMutation, - useDeleteGroupMemberMutation, useGetActiveAuthorisationsQuery, - useGetGroupMembershipsQuery, useGetOtherUserAuthorisationsQuery, + useGetGroupMembershipsQuery, + useGetOtherUserAuthorisationsQuery, useLazyGetTokenOwnerQuery } from "../../../state"; import { @@ -38,10 +38,10 @@ import { revocationConfirmationModal, tokenVerificationModal } from "../modals/TeacherConnectionModalCreators"; -import { FixedSizeList } from "react-window"; -import { Spacer } from "../Spacer"; -import { MyAccountTab } from "./MyAccountTab"; -import { Input, UncontrolledTooltip, Form, InputGroup, Button, Col } from "reactstrap"; +import {FixedSizeList} from "react-window"; +import {Spacer} from "../Spacer"; +import {MyAccountTab} from "./MyAccountTab"; +import {Button, Col, Form, Input, InputGroup, UncontrolledTooltip} from "reactstrap"; const CONNECTIONS_ROW_HEIGHT = 40; const CONNECTIONS_MAX_VISIBLE_ROWS = 10; @@ -67,12 +67,12 @@ const ConnectionsHeader = ({enableSearch, setEnableSearch, setSearchText, title, const deviceSize = useDeviceSize(); return
- {["xl", "lg", "xs"].indexOf(deviceSize) !== -1 ? - <>{enableSearch ? + {["xl", "lg", "xs"].indexOf(deviceSize) !== -1 ? + <>{enableSearch ? <> setSearchText(e.target.value)}/> - : + :

{title} @@ -166,7 +166,7 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi } } - return

Connect to your teacher

@@ -186,8 +186,8 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi type="text" placeholder="Enter your code in here" value={authToken || undefined} className="py-4" onChange={(e: React.ChangeEvent) => setAuthenticationToken(e.target.value)} onKeyDown={(e) => {if (e.key === 'Enter') { - processToken(e); - e.preventDefault(); + processToken(e); + e.preventDefault(); }}} />

; - + const getQuestionTitle = (question: GameboardItem) => { return Question: {question.title} ; }; - return assignmentId={assignment.id} progress={progress} questions={questions} header={tableHeader} getQuestionTitle={getQuestionTitle} + return assignmentId={assignment.id} progress={progress} questions={questions} header={tableHeader} getQuestionTitle={getQuestionTitle} assignmentAverages={assignmentAverages} assignmentTotalQuestionParts={assignmentTotalQuestionParts} markClasses={markClasses} markQuestionClasses={markQuestionClasses} isAssignment={true} />; @@ -295,7 +289,7 @@ export const AssignmentProgressLegend = ({showQuestionKey, id}: {showQuestionKey Colour-blind mode pageSettings.setColourBlind?.(e.currentTarget.checked)} />
- +
Table display mode pageSettings.setFormatAsPercentage?.(e.currentTarget.checked)} /> @@ -326,7 +320,7 @@ const QuizProgressLoader = ({quizAssignmentId}: { quizAssignmentId: number }) => return + thenRender={quizAssignmentWithFeedback =>
diff --git a/src/app/components/pages/AssignmentSchedule.tsx b/src/app/components/pages/AssignmentSchedule.tsx index fdb31eec25..8da6198739 100644 --- a/src/app/components/pages/AssignmentSchedule.tsx +++ b/src/app/components/pages/AssignmentSchedule.tsx @@ -15,7 +15,7 @@ import mapValues from "lodash/mapValues"; import range from "lodash/range"; import sortBy from "lodash/sortBy"; import {TitleAndBreadcrumb} from "../elements/TitleAndBreadcrumb"; -import React, {ChangeEvent, useCallback, useContext, useEffect, useMemo, useRef, useState, Fragment} from "react"; +import React, {ChangeEvent, Fragment, useCallback, useContext, useEffect, useMemo, useRef, useState} from "react"; import { Alert, Button, @@ -28,11 +28,15 @@ import { Container, Input, Label, - Row, Table + Row, + Table } from "reactstrap"; import { above, - BoardLimit, determineGameboardStagesAndDifficulties, determineGameboardSubjects, difficultyShortLabelMap, + BoardLimit, + determineGameboardStagesAndDifficulties, + determineGameboardSubjects, + difficultyShortLabelMap, formatBoardOwner, getAssignmentStartDate, isDefined, @@ -40,20 +44,29 @@ import { Item, itemise, MONTH_NAMES, - nthHourOf, PATHS, + nthHourOf, + PATHS, selectOnChange, - siteSpecific, stageLabelMap, TAG_ID, TAG_LEVEL, tags, + siteSpecific, + stageLabelMap, + TAG_ID, + TAG_LEVEL, + tags, TODAY, useDeviceSize } from "../../services"; -import {AppGroup, AssignmentScheduleContext, AssignmentBoardOrder, ValidAssignmentWithListingDate} from "../../../IsaacAppTypes"; +import { + AppGroup, + AssignmentBoardOrder, + AssignmentScheduleContext, + ValidAssignmentWithListingDate +} from "../../../IsaacAppTypes"; import {calculateHexagonProportions, Hexagon} from "../elements/svg/Hexagon"; import classNames from "classnames"; import {currentYear, DateInput} from "../elements/inputs/DateInput"; import {GameboardViewerInner} from "./Gameboard"; import {Link, useLocation} from "react-router-dom"; import {ShowLoadingQuery} from "../handlers/ShowLoadingQuery"; -import {PhyAddGameboardButtons} from "./SetAssignments"; import {StyledSelect} from "../elements/inputs/StyledSelect"; import {formatDate} from "../elements/DateString"; @@ -583,7 +596,7 @@ export const AssignmentSchedule = ({user}: {user: RegisteredUserDTO}) => { ? assignmentTimestamp : oldest; }, Date.now()) ?? Date.now() ), [assignmentsSetByMe, groupFilter, viewBy]); - + const extendBackSixMonths = (until?: Date) => setEarliestShowDate(esd => { const d = new Date(esd.valueOf()); d.setMonth(d.getMonth() - 6); diff --git a/src/app/components/pages/Groups.tsx b/src/app/components/pages/Groups.tsx index 2e0113bc26..c81662730e 100644 --- a/src/app/components/pages/Groups.tsx +++ b/src/app/components/pages/Groups.tsx @@ -13,42 +13,51 @@ import { FormFeedback, Input, InputGroup, - Label, Nav, NavItem, NavLink, - Row, Table, + Row, + Table, UncontrolledButtonDropdown, UncontrolledTooltip } from "reactstrap"; import {Link} from "react-router-dom"; import { + mutationSucceeded, resetMemberPassword, - showGroupManagersModal, - showGroupInvitationModal, - showGroupEmailModal, showAdditionalManagerSelfRemovalModal, showErrorToast, + showGroupEmailModal, + showGroupInvitationModal, + showGroupManagersModal, useAppDispatch, - mutationSucceeded, - useGetGroupsQuery, - useDeleteGroupMutation, useCreateGroupMutation, useDeleteGroupMemberMutation, - useUpdateGroupMutation, - useLazyGetGroupMembersQuery + useDeleteGroupMutation, + useGetGroupsQuery, + useLazyGetGroupMembersQuery, + useUpdateGroupMutation } from "../../state"; import {ShowLoading} from "../handlers/ShowLoading"; import sortBy from "lodash/sortBy"; import {AppGroup, AppGroupMembership} from "../../../IsaacAppTypes"; import {TitleAndBreadcrumb} from "../elements/TitleAndBreadcrumb"; -import {ifKeyIsEnter, isAda, isDefined, isPhy, isStaff, isTeacherOrAbove, siteSpecific, useDeviceSize} from "../../services"; +import { + ifKeyIsEnter, + isAda, + isDefined, + isPhy, + isStaff, + isTeacherOrAbove, + siteSpecific, + useDeviceSize +} from "../../services"; import {RegisteredUserDTO} from "../../../IsaacApiTypes"; import {ShowLoadingQuery} from "../handlers/ShowLoadingQuery"; import classNames from "classnames"; import {PageFragment} from "../elements/PageFragment"; import {RenderNothing} from "../elements/RenderNothing"; -import { StyledCheckbox } from "../elements/inputs/StyledCheckbox"; +import {StyledCheckbox} from "../elements/inputs/StyledCheckbox"; enum SortOrder { Alphabetical = "Alphabetical", @@ -142,12 +151,12 @@ const MemberInfo = ({group, member, user}: MemberInfoProps) => { Manage - {isTeacherOrAbove(user) && + {isTeacherOrAbove(user) && {!passwordRequestSent ? 'Reset Password' : 'Reset email sent'} } - {userHasAdditionalGroupPrivileges && + {userHasAdditionalGroupPrivileges && Remove } @@ -252,7 +261,7 @@ const GroupEditor = ({group, allGroups, user, createNewGroup, groupNameInputRef} const existingGroupWithConflictingName = allGroups?.find(g => g.groupName == newGroupName && (isDefined(group) ? group.id != g.id : true)); const isGroupNameInvalid = isDefined(newGroupName) && isDefined(existingGroupWithConflictingName); const isGroupNameValid = isDefined(newGroupName) && newGroupName.length > 0 && !allGroups?.some(g => g.groupName == newGroupName) && (isDefined(group) ? newGroupName !== group.groupName : true); - + return

{group ? "Manage group" : "Create group"}

diff --git a/src/app/components/pages/MyAccount.tsx b/src/app/components/pages/MyAccount.tsx index febc06acb9..8a0913f385 100644 --- a/src/app/components/pages/MyAccount.tsx +++ b/src/app/components/pages/MyAccount.tsx @@ -1,4 +1,4 @@ -import React, {useEffect, useMemo, useState, Suspense, lazy} from 'react'; +import React, {lazy, Suspense, useEffect, useMemo, useState} from 'react'; import {connect} from "react-redux"; import classnames from "classnames"; import classNames from "classnames"; @@ -44,22 +44,22 @@ import {UserPassword} from "../elements/panels/UserPassword"; import {UserEmailPreferencesPanel} from "../elements/panels/UserEmailPreferencesPanel"; import { ACCOUNT_TAB, + ACCOUNT_TABS, + ACCOUNT_TABS_ALIASES, allRequiredInformationIsPresent, history, ifKeyIsEnter, isAda, isDefined, isDobOldEnoughForSite, - isPhy, + isFirstLoginInPersistence, isStaff, - SITE_TITLE, siteSpecific, + isTeacherOrAbove, + SITE_TITLE, + siteSpecific, validateEmail, validateEmailPreferences, - validatePassword, - isTeacherOrAbove, - isFirstLoginInPersistence, - ACCOUNT_TABS, - ACCOUNT_TABS_ALIASES + validatePassword } from "../../services"; import queryString from "query-string"; import {Link, withRouter} from "react-router-dom"; @@ -69,10 +69,10 @@ import {ShowLoading} from "../handlers/ShowLoading"; import {UserBetaFeatures} from "../elements/panels/UserBetaFeatures"; import hash, {NormalOption} from "object-hash"; import {skipToken} from "@reduxjs/toolkit/query"; -import { Loading } from "../handlers/IsaacSpinner"; +import {Loading} from "../handlers/IsaacSpinner"; import {useEmailPreferenceState} from "../elements/inputs/UserEmailPreferencesInput"; -import { UserProfile } from '../elements/panels/UserProfile'; -import { UserContent } from '../elements/panels/UserContent'; +import {UserProfile} from '../elements/panels/UserProfile'; +import {UserContent} from '../elements/panels/UserContent'; import {ExigentAlert} from "../elements/ExigentAlert"; const UserMFA = lazy(() => import("../elements/panels/UserMFA")); diff --git a/src/app/components/pages/RegistrationSetDetails.tsx b/src/app/components/pages/RegistrationSetDetails.tsx index f29b4c5467..22058982a4 100644 --- a/src/app/components/pages/RegistrationSetDetails.tsx +++ b/src/app/components/pages/RegistrationSetDetails.tsx @@ -1,19 +1,8 @@ import React, {useState} from "react"; -import { - Button, - Card, - CardBody, - Col, - Container, - Form, - FormFeedback, - FormGroup, - Row, -} from "reactstrap"; +import {Button, Card, CardBody, Col, Container, Form, FormFeedback, FormGroup, Row,} from "reactstrap"; import {TitleAndBreadcrumb} from "../elements/TitleAndBreadcrumb"; import { EMAIL_PREFERENCE_DEFAULTS, - EXAM_BOARD, FIRST_LOGIN_STATE, history, isAda, @@ -23,7 +12,6 @@ import { persistence, SITE_TITLE, siteSpecific, - STAGE, trackEvent, validateCountryCode, validateEmail, @@ -38,14 +26,14 @@ import {SchoolInput} from "../elements/inputs/SchoolInput"; import {CountryInput} from "../elements/inputs/CountryInput"; import {SetPasswordInput} from "../elements/inputs/SetPasswordInput"; import {UserRole} from "../../../IsaacApiTypes"; -import {GivenNameInput, FamilyNameInput} from "../elements/inputs/NameInput"; +import {FamilyNameInput, GivenNameInput} from "../elements/inputs/NameInput"; import {EmailInput} from "../elements/inputs/EmailInput"; import {GenderInput} from "../elements/inputs/GenderInput"; import {extractErrorMessage} from "../../services/errors"; import {ExigentAlert} from "../elements/ExigentAlert"; import classNames from "classnames"; -import { StyledCheckbox } from "../elements/inputs/StyledCheckbox"; -import { DobInput } from "../elements/inputs/DobInput"; +import {StyledCheckbox} from "../elements/inputs/StyledCheckbox"; +import {DobInput} from "../elements/inputs/DobInput"; interface RegistrationSetDetailsProps { @@ -89,7 +77,7 @@ export const RegistrationSetDetails = ({role}: RegistrationSetDetailsProps) => { event.preventDefault(); setAttemptedSignUp(true); - if (familyNameIsValid && givenNameIsValid && passwordIsValid && emailIsValid && + if (familyNameIsValid && givenNameIsValid && passwordIsValid && emailIsValid && (!isAda || countryCodeIsValid) && (!isPhy || dobValidOrUnset) && ((role == 'STUDENT') || schoolIsValid) && tosAccepted ) { persistence.session.save(KEY.FIRST_LOGIN, FIRST_LOGIN_STATE.FIRST_LOGIN); diff --git a/src/app/components/pages/TutorRequest.tsx b/src/app/components/pages/TutorRequest.tsx index f725d7e608..00193d7d42 100644 --- a/src/app/components/pages/TutorRequest.tsx +++ b/src/app/components/pages/TutorRequest.tsx @@ -2,10 +2,10 @@ import React, {useEffect, useState} from 'react'; import { AppState, selectors, - useAppDispatch, useAppSelector, useGetPageFragmentQuery, - useRequestEmailVerificationMutation, useSubmitContactFormMutation + useRequestEmailVerificationMutation, + useSubmitContactFormMutation } from "../../state"; import { Alert, @@ -25,7 +25,8 @@ import { isPhy, isTutorOrAbove, selectOnChange, - SITE_TITLE, siteSpecific, + SITE_TITLE, + siteSpecific, tags, validateEmail, WEBMASTER_EMAIL @@ -34,7 +35,7 @@ import {TitleAndBreadcrumb} from "../elements/TitleAndBreadcrumb"; import {Link} from "react-router-dom"; import {IsaacContent} from "../content/IsaacContent"; import {StyledSelect} from "../elements/inputs/StyledSelect"; -import { extractErrorMessage } from '../../services/errors'; +import {extractErrorMessage} from '../../services/errors'; const warningFragmentId = "teacher_registration_warning_message"; // TUTOR have decided to keep this message diff --git a/src/app/components/pages/quizzes/QuizAttemptFeedback.tsx b/src/app/components/pages/quizzes/QuizAttemptFeedback.tsx index 5be961c697..9caa9e640d 100644 --- a/src/app/components/pages/quizzes/QuizAttemptFeedback.tsx +++ b/src/app/components/pages/quizzes/QuizAttemptFeedback.tsx @@ -1,11 +1,7 @@ -import React, {useCallback, useEffect} from "react"; -import { - clearQuizAttempt, - useAppDispatch -} from "../../../state"; +import React, {useCallback} from "react"; import {Link, useParams} from "react-router-dom"; import {ShowLoading} from "../../handlers/ShowLoading"; -import {isDefined, useCurrentQuizAttempt, useQuizAttemptFeedback} from "../../../services"; +import {isDefined, useQuizAttemptFeedback} from "../../../services"; import { myQuizzesCrumbs, QuizAttemptComponent, diff --git a/src/app/components/site/phy/HomepagePhy.tsx b/src/app/components/site/phy/HomepagePhy.tsx index 7c00b278a3..322efc9498 100644 --- a/src/app/components/site/phy/HomepagePhy.tsx +++ b/src/app/components/site/phy/HomepagePhy.tsx @@ -4,8 +4,7 @@ import {Link} from "react-router-dom"; import {Button, Col, Container, Row} from "reactstrap"; import {NewsCarousel} from "../../elements/NewsCarousel"; import {above, SITE_TITLE, useDeviceSize, useUserConsent} from "../../../services"; -import {WarningBanner} from "../../navigation/WarningBanner"; -import { HomepageYoutubeCookieHandler } from "../../handlers/InterstitialCookieHandler"; +import {HomepageYoutubeCookieHandler} from "../../handlers/InterstitialCookieHandler"; export const HomepagePhy = () => { useEffect( () => {document.title = SITE_TITLE;}, []); diff --git a/src/app/services/constants.ts b/src/app/services/constants.ts index 8366a3fdac..2ee10fc170 100644 --- a/src/app/services/constants.ts +++ b/src/app/services/constants.ts @@ -6,16 +6,13 @@ import {BooleanNotation, NOT_FOUND_TYPE} from "../../IsaacAppTypes"; import { AuthenticationProvider, BookingStatus, - ChoiceDTO, ContentDTO, Difficulty, ExamBoard, IsaacFastTrackQuestionPageDTO, IsaacQuestionPageDTO, ItemDTO, - QuantityDTO, Stage, - StringChoiceDTO, UserRole } from "../../IsaacApiTypes"; import {isPhy, siteSpecific} from "./"; diff --git a/src/app/services/search.tsx b/src/app/services/search.tsx index f2d59db41b..481a56d5d8 100644 --- a/src/app/services/search.tsx +++ b/src/app/services/search.tsx @@ -6,7 +6,7 @@ import queryString from "query-string"; import {Immutable} from "immer"; import React, {FormEvent, useEffect, useRef, useState} from "react"; import {useHistory, useLocation} from "react-router-dom"; -import {Form, FormGroup} from "reactstrap"; +import {Form} from "reactstrap"; import classNames from "classnames"; export const pushSearchToHistory = function(history: History, searchQuery: string, typesFilter: DOCUMENT_TYPE[]) { diff --git a/src/app/services/topics.ts b/src/app/services/topics.ts index 674dca186d..b80bf7ca32 100644 --- a/src/app/services/topics.ts +++ b/src/app/services/topics.ts @@ -1,15 +1,7 @@ import {ContentDTO, ContentSummaryDTO} from "../../IsaacApiTypes"; -import { - ALL_TOPICS_CRUMB, - DOCUMENT_TYPE, - documentTypePathPrefix, - LinkInfo, - NOT_FOUND, - UseUserContextReturnType -} from "./"; -import {NOT_FOUND_TYPE, PotentialUser} from "../../IsaacAppTypes"; +import {ALL_TOPICS_CRUMB, DOCUMENT_TYPE, documentTypePathPrefix, LinkInfo, NOT_FOUND} from "./"; +import {NOT_FOUND_TYPE} from "../../IsaacAppTypes"; import {CurrentTopicState} from "../state"; -import {Immutable} from "immer"; const filterForConcepts = (contents: ContentSummaryDTO[]) => { return contents.filter(content => content.type === DOCUMENT_TYPE.CONCEPT); diff --git a/src/app/state/middleware/notificationManager.ts b/src/app/state/middleware/notificationManager.ts index 2940dc81c9..c154c524dc 100644 --- a/src/app/state/middleware/notificationManager.ts +++ b/src/app/state/middleware/notificationManager.ts @@ -1,9 +1,10 @@ -import {AnyAction, Dispatch, Middleware, MiddlewareAPI} from "redux"; +import {AnyAction, Middleware, MiddlewareAPI} from "redux"; import { ACTION_TYPE, allRequiredInformationIsPresent, isDefined, - isLoggedIn, isPhy, + isLoggedIn, + isPhy, KEY, persistence, withinLast2Hours, @@ -55,7 +56,7 @@ export const notificationCheckerMiddleware: Middleware = (middlewareApi: Middlew lastQuestionId !== action.questionId && !withinLast2Hours(persistence.load(KEY.LOGIN_OR_SIGN_UP_MODAL_SHOWN_TIME)) ) { - middlewareApi.dispatch(logAction({ type: "LOGIN_MODAL_SHOWN" }) as unknown as AnyAction); // Using middlewareApi.dispatch so that thunk is handled correctly + middlewareApi.dispatch(logAction({ type: "LOGIN_MODAL_SHOWN" }) as unknown as AnyAction); // Using middlewareApi.dispatch so that thunk is handled correctly persistence.session.remove(KEY.FIRST_ANON_QUESTION); persistence.save(KEY.LOGIN_OR_SIGN_UP_MODAL_SHOWN_TIME, new Date().toString()); await dispatch(openActiveModal(loginOrSignUpModal) as any); diff --git a/src/test/components/elements/TitleAndBreadcrumb.test.tsx b/src/test/components/elements/TitleAndBreadcrumb.test.tsx index 393706dcdf..ac79f3671c 100644 --- a/src/test/components/elements/TitleAndBreadcrumb.test.tsx +++ b/src/test/components/elements/TitleAndBreadcrumb.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import {formatPageTitle} from "../../../app/components/elements/PageTitle"; import {formatBreadcrumbItemTitle} from "../../../app/components/elements/TitleAndBreadcrumb"; import {Markup} from "../../../app/components/elements/markup"; diff --git a/src/test/pages/Homepage.cy.tsx b/src/test/pages/Homepage.cy.tsx index 774b9fdf3c..e8bc4ca01c 100644 --- a/src/test/pages/Homepage.cy.tsx +++ b/src/test/pages/Homepage.cy.tsx @@ -1,7 +1,5 @@ import React from "react"; -import {MyAssignments} from "../../app/components/pages/MyAssignments"; -import {mockUser} from "../../mocks/data"; -import {isAda, PATHS} from "../../app/services"; +import {isAda} from "../../app/services"; import {HomepageCS} from "../../app/components/site/cs/HomepageCS"; import {HomepagePhy} from "../../app/components/site/phy/HomepagePhy"; @@ -33,4 +31,4 @@ it('Homepage should have no visual regressions', () => { // Assert cy.matchImage(); } -}); \ No newline at end of file +}); diff --git a/src/test/pages/MyGameboards.test.tsx b/src/test/pages/MyGameboards.test.tsx index b0c3228fd7..8b5b0481f2 100644 --- a/src/test/pages/MyGameboards.test.tsx +++ b/src/test/pages/MyGameboards.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import {screen, waitFor} from "@testing-library/react"; import {mockGameboards} from "../../mocks/data"; import {MyGameboards} from "../../app/components/pages/MyGameboards"; diff --git a/src/test/pages/UserContextReconfirmationModal.test.tsx b/src/test/pages/UserContextReconfirmationModal.test.tsx index e52b42b25b..bf4fe7a8c9 100644 --- a/src/test/pages/UserContextReconfirmationModal.test.tsx +++ b/src/test/pages/UserContextReconfirmationModal.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import {screen} from "@testing-library/react"; import {MOST_RECENT_AUGUST} from "../../app/state"; import produce from "immer"; @@ -31,4 +30,4 @@ describe("UserContextReconfirmationModal", () => { const modal = await screen.findByTestId("active-modal"); expect(modal).toHaveModalTitle("Review your details"); }); -}); \ No newline at end of file +}); diff --git a/src/test/services/assignments.test.ts b/src/test/services/assignments.test.ts index 8bf3fc84e0..2d2caf9012 100644 --- a/src/test/services/assignments.test.ts +++ b/src/test/services/assignments.test.ts @@ -4,7 +4,7 @@ import { getDistinctAssignmentGroups, getDistinctAssignmentSetters } from "../../app/services"; -import {AssignmentDTO, GameboardDTO, UserSummaryDTO} from "../../IsaacApiTypes"; +import {AssignmentDTO} from "../../IsaacApiTypes"; const threePartQuestion = { id: "three_part_question", @@ -360,4 +360,4 @@ describe("Distinct groups and assignment setters in the assignment list are foun // Assert expect(expectedDistinctGroups).toEqual(distinctGroups); }); -}); \ No newline at end of file +}); diff --git a/src/test/state/reducers.test.tsx b/src/test/state/reducers.test.tsx index 17ee006460..8fbfa524cc 100644 --- a/src/test/state/reducers.test.tsx +++ b/src/test/state/reducers.test.tsx @@ -1,5 +1,5 @@ -import {union, mapValues} from "lodash"; -import {questionDTOs, registeredUserDTOs, searchResultsList, unitsList} from "../test-factory"; +import {mapValues, union} from "lodash"; +import {questionDTOs, registeredUserDTOs, searchResultsList} from "../test-factory"; import {ACTION_TYPE} from "../../app/services"; import {Action, AppQuestionDTO, PotentialUser} from "../../IsaacAppTypes"; import {GameboardDTO} from "../../IsaacApiTypes"; @@ -12,9 +12,9 @@ import { questions, rootReducer, search, + selectors, toasts, - userSlice, - selectors + userSlice } from "../../app/state"; const ignoredTestAction: Action = {type: ACTION_TYPE.TEST_ACTION};