Skip to content

Commit 99f43fd

Browse files
authored
Merge pull request #1305 from isaacphysics/redesign/question-finder
Question Finders
2 parents c08e9f3 + d1df7f1 commit 99f43fd

40 files changed

+992
-391
lines changed
Lines changed: 40 additions & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 40 additions & 0 deletions
Loading
Lines changed: 43 additions & 0 deletions
Loading
Lines changed: 43 additions & 0 deletions
Loading
Lines changed: 18 additions & 0 deletions
Loading

src/app/components/elements/CollapsibleList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Col, Row } from "reactstrap";
33
import { Spacer } from "./Spacer";
44
import { FilterCount } from "./svg/FilterCount";
55
import classNames from "classnames";
6+
import { isAda, isPhy } from "../../services";
67

78
export interface CollapsibleListProps {
89
title?: string;
@@ -37,7 +38,7 @@ export const CollapsibleList = (props: CollapsibleListProps) => {
3738

3839
return <Col className={props.className} data-targetHeight={(headRef.current?.offsetHeight ?? 0) + (expanded ? expandedHeight : 0)}>
3940
<div className="row collapsible-head" ref={headRef}>
40-
<button className={classNames("w-100 d-flex align-items-center p-3 bg-white text-start", {"ps-4": props.asSubList})} onClick={toggle}>
41+
<button className={classNames("w-100 d-flex align-items-center p-3 text-start", {"bg-white": isAda, "bg-transparent": isPhy, "ps-4": props.asSubList})} onClick={toggle}>
4142
{title && <span>{title}</span>}
4243
<Spacer/>
4344
{(props.numberSelected ?? 0) > 0

src/app/components/elements/LLMFreeTextQuestionFeedbackView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ export default function LLMFreeTextQuestionFeedbackView({validationResponse, has
6666
<ul className="no-bullet px-2 mb-4">
6767
<li>
6868
<StyledCheckbox
69-
id="disagree" label={<p>Disagree</p>} className='"mb-4'
69+
id="disagree" label={<p>Disagree</p>}
7070
checked={feedback.disagree} onChange={() => setFeedback({...noFeedback, disagree: !feedback.disagree})}
7171
/>
7272
</li>
7373
<li>
7474
<StyledCheckbox
75-
id="partlyAgree" label={<p>Partly agree</p>} className='"mb-4'
75+
id="partlyAgree" label={<p>Partly agree</p>}
7676
checked={feedback.partlyAgree} onChange={() => setFeedback({...noFeedback, partlyAgree: !feedback.partlyAgree})}
7777
/>
7878
</li>

src/app/components/elements/PageTitle.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export interface TitleIconProps {
7474
export interface PageTitleProps {
7575
currentPageTitle: string;
7676
subTitle?: string;
77+
description?: string;
7778
disallowLaTeX?: boolean;
7879
help?: ReactElement;
7980
className?: string;
@@ -82,7 +83,7 @@ export interface PageTitleProps {
8283
preview?: boolean;
8384
icon?: TitleIconProps;
8485
}
85-
export const PageTitle = ({currentPageTitle, subTitle, disallowLaTeX, help, className, audienceViews, modalId, preview, icon}: PageTitleProps) => {
86+
export const PageTitle = ({currentPageTitle, subTitle, description, disallowLaTeX, help, className, audienceViews, modalId, preview, icon}: PageTitleProps) => {
8687
const dispatch = useAppDispatch();
8788
const openModal = useAppSelector((state: AppState) => Boolean(state?.activeModals?.length));
8889
const headerRef = useRef<HTMLHeadingElement>(null);
@@ -120,12 +121,17 @@ export const PageTitle = ({currentPageTitle, subTitle, disallowLaTeX, help, clas
120121
}
121122

122123
return <h1 id="main-heading" tabIndex={-1} ref={headerRef} className={classNames("h-title h-secondary d-sm-flex", {"align-items-center py-4": isPhy}, className)}>
123-
{icon && (
124-
icon.type === "img" ? <img src={icon.icon} alt="" className="me-3"/>
125-
: icon.type === "hex" ? <PhyHexIcon icon={icon.icon} subject={icon.subject}/> : undefined)}
126-
<div className="me-auto" data-testid={"main-heading"}>
127-
{formatPageTitle(currentPageTitle, disallowLaTeX)}
128-
{subTitle && <span className="h-subtitle d-none d-sm-block">{subTitle}</span>}
124+
<div className="me-auto">
125+
<div className="d-sm-flex align-items-center">
126+
{icon && (
127+
icon.type === "img" ? <img src={icon.icon} alt="" className="me-3"/>
128+
: icon.type === "hex" ? <PhyHexIcon icon={icon.icon} subject={icon.subject}/> : undefined)}
129+
<div className="me-auto" data-testid={"main-heading"}>
130+
{formatPageTitle(currentPageTitle, disallowLaTeX)}
131+
{subTitle && <span className="h-subtitle d-none d-sm-block">{subTitle}</span>}
132+
</div>
133+
</div>
134+
{description && <div className="h-description">{description}</div>}
129135
</div>
130136
<Helmet>
131137
<meta property="og:title" content={currentPageTitle} />

src/app/components/elements/TeacherDashboard.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { selectors, useAppSelector, useGetGroupsQuery, useGetMySetAssignmentsQue
33
import { skipToken } from '@reduxjs/toolkit/query';
44
import { Card, Col, Row } from 'reactstrap';
55
import { Link } from 'react-router-dom';
6-
import { isDefined, isLoggedIn, isTutorOrAbove, Subject, useDeviceSize } from '../../services';
7-
import { BookInfo, isaacBooks } from './modals/IsaacBooksModal';
6+
import { BookInfo, ISAAC_BOOKS, isDefined, isLoggedIn, isTutorOrAbove, Subject, useDeviceSize } from '../../services';
87
import { AssignmentDTO, RegisteredUserDTO } from '../../../IsaacApiTypes';
98
import { GroupSelector } from '../pages/Groups';
109
import { StyledDropdown } from './inputs/DropdownInput';
@@ -141,7 +140,7 @@ const BooksPanel = () => {
141140
</StyledDropdown>
142141
</div>
143142
<Row className="row-cols-3 row-cols-md-4 row-cols-lg-8 row-cols-xl-2 row-cols-xxl-3 flex-nowrap book-panel">
144-
{isaacBooks.filter(book => book.subject === subject || subject === "all")
143+
{ISAAC_BOOKS.filter(book => book.subject === subject || subject === "all")
145144
.map((book) =>
146145
<Col key={book.title} className="mb-2 me-1 p-0">
147146
<BookCard {...book}/>

src/app/components/elements/TitleAndBreadcrumb.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type TitleAndBreadcrumbProps = BreadcrumbTrailProps & PageTitleProps & {
5454
breadcrumbTitleOverride?: string;
5555
children?: ReactElement | boolean;
5656
};
57-
export const TitleAndBreadcrumb = ({modalId, children, breadcrumbTitleOverride, currentPageTitle, subTitle, disallowLaTeX, className, audienceViews, help, collectionType, intermediateCrumbs, preview, icon}: TitleAndBreadcrumbProps) => {
57+
export const TitleAndBreadcrumb = ({modalId, children, breadcrumbTitleOverride, currentPageTitle, subTitle, description, disallowLaTeX, className, audienceViews, help, collectionType, intermediateCrumbs, preview, icon}: TitleAndBreadcrumbProps) => {
5858
return <div className={classNames(className, {"title-breadcrumb-container": isPhy, "pt-4 pt-md-5": isAda})}>
5959
{isPhy && <div className="title-graphics"/>}
6060
<BreadcrumbTrail
@@ -64,7 +64,7 @@ export const TitleAndBreadcrumb = ({modalId, children, breadcrumbTitleOverride,
6464
/>
6565
{children}
6666
<PageTitle
67-
modalId={modalId} subTitle={subTitle}
67+
modalId={modalId} subTitle={subTitle} description={description}
6868
disallowLaTeX={disallowLaTeX} audienceViews={audienceViews}
6969
currentPageTitle={currentPageTitle} help={help}
7070
preview={preview} icon={icon}

src/app/components/elements/inputs/StyledCheckbox.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React, {useEffect, useMemo, useState} from "react";
22
import {Input, InputProps} from "reactstrap";
33
import {v4} from "uuid";
44
import {Spacer} from "../Spacer";
5-
import {ifKeyIsEnter} from "../../../services";
5+
import {ifKeyIsEnter, isAda} from "../../../services";
66
import classNames from "classnames";
77

88
// 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.
99

10-
export const StyledCheckbox = (props : InputProps) => {
10+
export const StyledCheckbox = (props: InputProps) => {
1111

12-
const {label, ignoreLabelHover, className, ...rest} = props;
12+
const {label, ignoreLabelHover, className, bsSize, ...rest} = props;
1313

1414
const [checked, setChecked] = useState(props.checked ?? false);
1515
const id = useMemo(() => {return (props.id ?? "") + "-" + v4();}, [props.id]);
@@ -23,10 +23,10 @@ export const StyledCheckbox = (props : InputProps) => {
2323
setChecked(props.checked ?? false);
2424
}, [props.checked]);
2525

26-
return <div className={classNames("styled-checkbox-wrapper", {"is-invalid": props.invalid})}>
26+
return <div className={classNames("styled-checkbox-wrapper", {"is-invalid": props.invalid, "checkbox-small": bsSize === "sm"})}>
2727
<div className={classNames({"me-2 my-2": label})}>
28-
{checked && <div className="tick"/>}
29-
<Input {...rest} id={id} type="checkbox" className={classNames(className ?? "", {"checked" : checked})}
28+
{isAda && checked && <div className="tick"/>}
29+
<input {...rest} id={id} type="checkbox" className={classNames(className ?? "", "d-block", {"checked": checked, "icon-checkbox-off": !className && !checked, "icon-checkbox-selected": !className && checked})}
3030
onChange={(e) => onCheckChange(e)}
3131
// If the user toggles with a keyboard, this does not change the state of the checkbox, so we need to do it manually (with modification to `target`
3232
// as this is a keyboard event, not a change event). We also prevent default to avoid submitting the outer form.

0 commit comments

Comments
 (0)