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

Remove unused imports detected by ESLint #1240

Merged
merged 1 commit into from
Nov 29, 2024
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
4 changes: 2 additions & 2 deletions src/app/components/content/IsaacContent.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/content/IsaacLLMFreeTextQuestion.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -98,4 +98,4 @@ const IsaacLLMFreeTextQuestion = ({doc, questionId, readonly}: IsaacQuestionProp
</div>
);
};
export default IsaacLLMFreeTextQuestion;
export default IsaacLLMFreeTextQuestion;
3 changes: 1 addition & 2 deletions src/app/components/content/IsaacNumericQuestion.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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(){},.+*/\\^×÷-]";
Expand Down
7 changes: 3 additions & 4 deletions src/app/components/content/IsaacSymbolicLogicQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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"));
Expand Down
20 changes: 15 additions & 5 deletions src/app/components/content/IsaacSymbolicQuestion.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
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";
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"));

Expand Down
16 changes: 8 additions & 8 deletions src/app/components/elements/LLMFreeTextQuestionFeedbackView.tsx
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -60,7 +60,7 @@ export default function LLMFreeTextQuestionFeedbackView({validationResponse, has
</Table>
</div>
{hasSubmitted && <>
{!sentFeedback
{!sentFeedback
? <div className="feedback-collection">
<p className="mb-4">Before submitting another response, please say whether you agree with the predicted mark.</p>
<ul className="no-bullet px-2 mb-4">
Expand Down Expand Up @@ -92,7 +92,7 @@ export default function LLMFreeTextQuestionFeedbackView({validationResponse, has
>
Send feedback
</Button>
</div>
</div>
: <div className="feedback-collection submitted">
<span className="icon-feedback-sent-tick" /> Feedback submitted
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/elements/ReportAccordionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import {logAction, useAppDispatch} from "../../state";
import {isPhy} from "../../services";

interface ReportAccordionButtonProps {
pageId?: string,
Expand Down Expand Up @@ -48,4 +47,4 @@ export const ReportAccordionButton = ({pageId, sectionId, sectionTitle, sectionI
window.open(`/contact?preset=contentProblem${getContactFormParams()}`, "_blank");
}}
/>;
};
};
2 changes: 1 addition & 1 deletion src/app/components/elements/ShareLink.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/elements/TitleAndBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
7 changes: 3 additions & 4 deletions src/app/components/elements/cards/NewsCard.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/elements/inputs/CountryInput.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/elements/inputs/StyledCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
getFilteredExamBoardOptions,
getFilteredStageOptions,
isAda,
isDefined,
isPhy,
isTutorOrAbove,
siteSpecific,
Expand All @@ -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;
Expand Down
22 changes: 8 additions & 14 deletions src/app/components/elements/inputs/UserContextPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
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,
stageLabelMap,
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();
Expand Down Expand Up @@ -52,7 +46,7 @@ export const UserContextPicker = ({className, hideLabels = true}: {className?: s

if (isAda && !isLoggedIn(user) || isStaff(user)) {
return <Col className={`d-flex flex-column w-100 px-0 mt-2 context-picker-container no-print ${className}`}>
<Row sm={12} md={7} lg={siteSpecific(7, 8)} xl={siteSpecific(7, 9)} className={`d-flex m-0 p-0 justify-content-md-end`}>
<Row sm={12} md={7} lg={siteSpecific(7, 8)} xl={siteSpecific(7, 9)} className={`d-flex m-0 p-0 justify-content-md-end`}>
{/* Stage Selector */}
<FormGroup className={`form-group w-100 d-flex justify-content-end m-0`}>
{showStageSelector && <>
Expand Down Expand Up @@ -100,14 +94,14 @@ export const UserContextPicker = ({className, hideLabels = true}: {className?: s
dispatch(transientUserContextSlice.actions.setExamBoard(e.target.value as EXAM_BOARD));
}}
>
{onlyOneBoard
? <option value={onlyOneBoard.value}>{onlyOneBoard.label}</option>
{onlyOneBoard
? <option value={onlyOneBoard.value}>{onlyOneBoard.label}</option>
: getFilteredExamBoardOptions({byStages: [currentStage], includeNullOptions: true})
.map(item => <option key={item.value} value={item.value}>{item.label}</option>)
}
</Input>
</>}

{showUnusualContextMessage && <div className="mt-2 ms-1">
<span id={`unusual-viewing-context-explanation`} className="icon-help mx-1" />
<UncontrolledTooltip placement="bottom" target={`unusual-viewing-context-explanation`}>
Expand Down
38 changes: 19 additions & 19 deletions src/app/components/elements/panels/TeacherConnections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
showErrorToast,
useAppDispatch,
useChangeMyMembershipStatusMutation,
useDeleteGroupMemberMutation,
useGetActiveAuthorisationsQuery,
useGetGroupMembershipsQuery, useGetOtherUserAuthorisationsQuery,
useGetGroupMembershipsQuery,
useGetOtherUserAuthorisationsQuery,
useLazyGetTokenOwnerQuery
} from "../../../state";
import {
Expand Down Expand Up @@ -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;
Expand All @@ -67,12 +67,12 @@ const ConnectionsHeader = ({enableSearch, setEnableSearch, setSearchText, title,
const deviceSize = useDeviceSize();

return <div className="connect-list-header">
{["xl", "lg", "xs"].indexOf(deviceSize) !== -1 ?
<>{enableSearch ?
{["xl", "lg", "xs"].indexOf(deviceSize) !== -1 ?
<>{enableSearch ?
<>
<Input type="text" autoFocus placeholder={placeholder} className="connections-search" onChange={e => setSearchText(e.target.value)}/>
<Spacer />
</> :
</> :
<h4 className={classNames("d-flex", {"ps-0" : isAda})}>
<span className={siteSpecific("icon-person-active", "icon-group-white")} />
{title}
Expand Down Expand Up @@ -166,7 +166,7 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi
}
}

return <MyAccountTab
return <MyAccountTab
leftColumn={<>
<h3>Connect to your teacher</h3>
<PageFragment fragmentId={`teacher_connections_help_${isTutorOrAbove(user) ? "teacher" : "student"}`} ifNotFound={RenderNothing} />
Expand All @@ -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<HTMLInputElement>) => setAuthenticationToken(e.target.value)}
onKeyDown={(e) => {if (e.key === 'Enter') {
processToken(e);
e.preventDefault();
processToken(e);
e.preventDefault();
}}}
/>
<Button onClick={processToken} className={classNames("py-2", {"px-0 border-dark": isPhy})} color="secondary" outline disabled={editingOtherUser}>
Expand All @@ -197,8 +197,8 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi
</Form>

<div className="connect-list" data-testid="teacher-connections">
<ConnectionsHeader
title="Teacher connections" enableSearch={enableTeacherSearch} setEnableSearch={setEnableTeacherSearch}
<ConnectionsHeader
title="Teacher connections" enableSearch={enableTeacherSearch} setEnableSearch={setEnableTeacherSearch}
setSearchText={setTeacherSearchText} placeholder="Search teachers"/>
<div className="connect-list-inner">
<ul className={classNames("teachers-connected list-unstyled my-0", {"ms-3 me-2": isPhy}, {"ms-1 me-2": isAda})}>
Expand Down Expand Up @@ -254,8 +254,8 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi
<Link to="/groups">{siteSpecific("group management page", "Manage groups")}</Link>{siteSpecific(".", " page.")}
</p>
<div className="connect-list">
<ConnectionsHeader
title="Student connections" enableSearch={enableStudentSearch} setEnableSearch={setEnableStudentSearch}
<ConnectionsHeader
title="Student connections" enableSearch={enableStudentSearch} setEnableSearch={setEnableStudentSearch}
setSearchText={setStudentSearchText} placeholder="Search students"/>
<div className="connect-list-inner">
<ul className={classNames("teachers-connected list-unstyled my-0", {"ms-3 me-2": isPhy}, {"ms-1 me-2": isAda})}>
Expand Down Expand Up @@ -319,8 +319,8 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi
</ul>
<div className="my-groups-table-section overflow-auto">
<div className="connect-list">
<ConnectionsHeader
title="Group memberships" enableSearch={enableGroupSearch} setEnableSearch={setEnableGroupSearch}
<ConnectionsHeader
title="Group memberships" enableSearch={enableGroupSearch} setEnableSearch={setEnableGroupSearch}
setSearchText={setGroupSearchText} placeholder="Search groups"/>
<div className="connect-list-inner">
<ul className={classNames("teachers-connected list-unstyled m-0")}>
Expand Down Expand Up @@ -354,7 +354,7 @@ export const TeacherConnections = ({user, authToken, editingOtherUser, userToEdi
<Col className="d-flex flex-col justify-content-end align-items-center flex-grow-0 pe-1">
{membership.membershipStatus === MEMBERSHIP_STATUS.ACTIVE && <React.Fragment>
<Button color="link" disabled={editingOtherUser} onClick={() =>
membership.group.selfRemoval
membership.group.selfRemoval
? dispatch(openActiveModal(confirmSelfRemovalModal((user as LoggedInUser).id as number, membership.group.id as number)))
: changeMyMembershipStatus({groupId: membership.group.id as number, newStatus: MEMBERSHIP_STATUS.INACTIVE})
}>
Expand Down
Loading