Skip to content

Commit a15aa9d

Browse files
committed
Move FT progress bar to be between the breadcrumbs and the title
1 parent d43b463 commit a15aa9d

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

src/app/components/elements/FastTrackProgress.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const fastTrackStates: LevelTag[] = ['ft_top_ten', 'ft_upper', 'ft_lower'];
1717
function getFastTrackLevel(tags?: string[]): LevelTag {
1818
if (!tags) throw new Error("Unknown level for undefined tags");
1919
for (let state of fastTrackStates) {
20-
if (tags.indexOf(state) != -1) {
20+
if (tags.includes(state)) {
2121
return state;
2222
}
2323
}
@@ -439,10 +439,10 @@ export function FastTrackProgress({doc, search}: {doc: IsaacFastTrackQuestionPag
439439
/>;
440440
}
441441

442-
function createQuestionRow(conceptQuestions: AugmentedQuestion[], fastTrackLevel: string, conceptRowIndex: number) {
442+
function createQuestionRow(questions: AugmentedQuestion[], fastTrackLevel: string, conceptRowIndex: number) {
443443
return <g key={fastTrackLevel + '-question-hexagons'}
444444
transform={'translate(0,' + conceptRowIndex * (6 * hexagon.quarterHeight + 2 * hexagon.padding) + ')'}>
445-
{conceptQuestions.map((question, columnIndex) => (
445+
{questions.map((question, columnIndex) => (
446446
<g key={question.id} className={fastTrackLevel + '-question-hexagon'}
447447
transform={'translate(' + columnIndex * 2 * (hexagon.halfWidth + hexagon.padding) + ', 0)'}>
448448
{createQuestionHexagon(question)}
@@ -464,7 +464,7 @@ export function FastTrackProgress({doc, search}: {doc: IsaacFastTrackQuestionPag
464464
}
465465

466466
function renderProgress(progress: Progress) {
467-
return <RS.Row className="mt-sm-3">
467+
return <RS.Row className="my-sm-3">
468468
<RS.Col cols={12} md={3} lg={4}>
469469
<h4>{gameboard.title}</h4>
470470
<div className="d-none d-md-block">

src/app/components/elements/TitleAndBreadcrumb.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from "react";
1+
import React, {ReactElement} from "react";
22
import {BreadcrumbTrailProps, BreadcrumbTrail} from "./BreadcrumbTrail";
33
import {PageTitleProps, PageTitle} from "./PageTitle";
44

55
type TitleAndBreadcrumbProps = BreadcrumbTrailProps & PageTitleProps & {
66
breadcrumbTitleOverride?: string;
7+
children?: ReactElement | boolean;
78
};
89

910
export const TitleAndBreadcrumb = (props: TitleAndBreadcrumbProps) => {
@@ -13,6 +14,7 @@ export const TitleAndBreadcrumb = (props: TitleAndBreadcrumbProps) => {
1314
}
1415
return <React.Fragment>
1516
<BreadcrumbTrail {...breadcrumbProps} />
17+
{props.children}
1618
<PageTitle {...props} />
1719
</React.Fragment>;
1820
};

src/app/components/pages/Question.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,15 @@ export const Question = withRouter(({questionIdOverride, match, location}: Quest
7777

7878
return <div className={`pattern-01 ${doc.subjectId || ""}`}>
7979
<Container>
80-
{isFastTrack && <FastTrackProgress doc={doc} search={location.search} />}
81-
{/*Print options*/}
8280
{/*High contrast option*/}
8381
<TitleAndBreadcrumb
8482
currentPageTitle={title}
85-
intermediateCrumbs={[
86-
...navigation.breadcrumbHistory,
87-
...getTags(doc.tags)
88-
]}
83+
intermediateCrumbs={[...navigation.breadcrumbHistory, ...getTags(doc.tags)]}
8984
collectionType={navigation.collectionType}
9085
level={doc.level}
91-
/>
86+
>
87+
{isFastTrack && <FastTrackProgress doc={doc} search={location.search} />}
88+
</TitleAndBreadcrumb>
9289
<div className="no-print d-flex align-items-center">
9390
<EditContentButton doc={doc} />
9491
<div className="question-actions question-actions-leftmost mt-3">
@@ -139,7 +136,7 @@ export const Question = withRouter(({questionIdOverride, match, location}: Quest
139136

140137
<NavigationLinks navigation={navigation}/>
141138

142-
{doc.relatedContent && doc.type !== "isaacFastTrackQuestionPage" && <RelatedContent content={doc.relatedContent} parentPage={doc} />}
139+
{doc.relatedContent && !isFastTrack && <RelatedContent content={doc.relatedContent} parentPage={doc} />}
143140
</Col>
144141
</Row>
145142
</Container>

src/app/services/fastTrack.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
const fastTrackStates = ['ft_top_ten', 'ft_upper', 'ft_lower'];
2-
3-
export function getFastTrackLevel(tags: string[] | undefined) {
4-
if (!tags) return;
5-
for (let state of fastTrackStates) {
6-
if (tags.indexOf(state) != -1) {
7-
return state;
8-
}
9-
}
10-
}
11-
121
export function makeUrl(url: string, queryParams?: { [p: string]: string | undefined }) {
132
function valueIsNotUndefined(v: [string, string | undefined]): v is [string, string] {
143
return v[1] !== undefined;

0 commit comments

Comments
 (0)