Skip to content

Commit 91dc54f

Browse files
committed
Re-add superceded and no-filter tags
1 parent 992df85 commit 91dc54f

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed

src/app/components/elements/list-groups/AbstractListViewItem.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Link } from "react-router-dom";
22
import React from "react";
33
import { StageAndDifficultySummaryIcons } from "../StageAndDifficultySummaryIcons";
4-
import { ShortcutResponse, Subject, ViewingContext} from "../../../../IsaacAppTypes";
4+
import { Subject, ViewingContext} from "../../../../IsaacAppTypes";
55
import classNames from "classnames";
6-
import { Button, Col, ListGroup, ListGroupItem, Row } from "reactstrap";
6+
import { Button, Col, ListGroupItem, Row } from "reactstrap";
77
import { Spacer } from "../Spacer";
88
import { CompletionState } from "../../../../IsaacApiTypes";
9-
import { determineAudienceViews } from "../../../services/userViewingContext";
10-
import { below, TAG_ID, tags, useDeviceSize } from "../../../services";
9+
import { below, isPhy, useDeviceSize } from "../../../services";
1110
import { PhyHexIcon } from "../svg/PhyHexIcon";
1211
import { TitleIconProps } from "../PageTitle";
1312

@@ -35,9 +34,9 @@ const StatusDisplay = (props: React.HTMLAttributes<HTMLSpanElement> & {status: C
3534
}
3635
};
3736

38-
const Tags = ({tags}: {tags: {tag: string, url?: string}[];}) => {
37+
const LinkTags = ({linkTags}: {linkTags: {tag: string, url?: string}[];}) => {
3938
return <>
40-
{tags.map(t => t.url ?
39+
{linkTags.map(t => t.url ?
4140
<Link to={t.url} className="card-tag" key={t.tag}>{t.tag}</Link> :
4241
<div className="card-tag" key={t.tag}>{t.tag}</div>
4342
)}
@@ -68,7 +67,9 @@ export interface AbstractListViewItemProps {
6867
subtitle?: string;
6968
breadcrumb?: string[];
7069
status?: CompletionState;
71-
tags?: ListViewTagProps[];
70+
tags?: string[]
71+
supersededBy?: string;
72+
linkTags?: ListViewTagProps[];
7273
testTag?: string;
7374
url?: string;
7475
audienceViews?: ViewingContext[];
@@ -78,7 +79,7 @@ export interface AbstractListViewItemProps {
7879
fullWidth?: boolean;
7980
}
8081

81-
export const AbstractListViewItem = ({icon, title, subject, subtitle, breadcrumb, status, tags, testTag, url, audienceViews, previewQuizUrl, quizButton, isCard, fullWidth, ...rest}: AbstractListViewItemProps) => {
82+
export const AbstractListViewItem = ({icon, title, subject, subtitle, breadcrumb, status, tags, supersededBy, linkTags, testTag, url, audienceViews, previewQuizUrl, quizButton, isCard, fullWidth, ...rest}: AbstractListViewItemProps) => {
8283
const deviceSize = useDeviceSize();
8384
const isQuiz: boolean = (previewQuizUrl && quizButton) ? true : false;
8485

@@ -96,6 +97,16 @@ export const AbstractListViewItem = ({icon, title, subject, subtitle, breadcrumb
9697
<div className="d-flex">
9798
<span className="question-link-title">{title}</span>
9899
{testTag && <span className="quiz-level-1-tag ms-sm-2">{testTag}</span>}
100+
{isPhy && <div className="d-flex flex-column justify-self-end">
101+
{supersededBy && <a
102+
className="superseded-tag mx-1 ms-sm-3 my-1 align-self-end"
103+
href={`/questions/${supersededBy}`}
104+
onClick={(e) => e.stopPropagation()}
105+
>SUPERSEDED</a>}
106+
{tags?.includes("nofilter") && <span
107+
className="superseded-tag mx-1 ms-sm-3 my-1 align-self-end"
108+
>NO-FILTER</span>}
109+
</div>}
99110
</div>
100111
{subtitle && <div className="small text-muted">
101112
{subtitle}
@@ -109,8 +120,8 @@ export const AbstractListViewItem = ({icon, title, subject, subtitle, breadcrumb
109120
{status && (below["lg"](deviceSize) || fullWidth) && <div className="d-flex">
110121
<StatusDisplay status={status}/>
111122
</div>}
112-
{tags && <div className="d-flex py-3">
113-
<Tags tags={tags}/>
123+
{linkTags && <div className="d-flex py-3">
124+
<LinkTags linkTags={linkTags}/>
114125
</div>}
115126
{previewQuizUrl && quizButton && fullWidth && <div className="d-flex d-md-none align-items-center">
116127
<QuizLinks previewQuizUrl={previewQuizUrl} quizButton={quizButton}/>

src/app/components/elements/list-groups/ListView.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export interface ListViewCardProps {
1414
item: ShortcutResponse;
1515
icon: TitleIconProps;
1616
subject?: Subject;
17-
tagList?: ListViewTagProps[];
17+
linkTags?: ListViewTagProps[];
1818
}
1919

20-
export const ListViewCard = ({item, icon, subject, tagList, ...rest}: ListViewCardProps) => {
20+
export const ListViewCard = ({item, icon, subject, linkTags, ...rest}: ListViewCardProps) => {
2121
return <AbstractListViewItem
2222
icon={icon}
2323
title={item.title ?? ""}
2424
subject={subject}
2525
subtitle={item.subtitle}
26-
tags={tagList}
26+
linkTags={linkTags}
2727
isCard
2828
{...rest}
2929
/>;
@@ -39,6 +39,8 @@ export const QuestionListViewItem = ({item, ...rest} : {item: ShortcutResponse})
3939
icon={{type: "hex", icon: "list-icon-question", size: "sm"}}
4040
title={item.title ?? ""}
4141
subject={itemSubject}
42+
tags={item.tags}
43+
supersededBy={item.supersededBy}
4244
subtitle={item.subtitle}
4345
breadcrumb={breadcrumb}
4446
status={item.state}
@@ -126,7 +128,7 @@ export const QuickQuizListViewItem = ({item, ...rest}: {item: ShortcutResponse})
126128
subtitle={item.subtitle}
127129
breadcrumb={breadcrumb}
128130
status={item.state}
129-
testTag={"Level 1" /* Quick quizzes are currently just gameboards. This tag doesn't exist yet. */}
131+
testTag={"Level 1" /* Quick quizzes are currently just gameboards. This tag doesn't exist yet in the content. */}
130132
url={url}
131133
audienceViews={audienceViews}
132134
{...rest}
@@ -144,6 +146,8 @@ export const GenericListViewItem = ({item, ...rest}: {item: ShortcutResponse}) =
144146
title={item.title ?? ""}
145147
subject={itemSubject}
146148
subtitle={item.subtitle}
149+
tags={item.tags}
150+
supersededBy={item.supersededBy}
147151
breadcrumb={breadcrumb}
148152
status={item.state}
149153
url={url}

src/app/components/pages/Gameboard.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import {Markup} from "../elements/markup";
3636
import classNames from "classnames";
3737
import {skipToken} from "@reduxjs/toolkit/query";
3838
import {ShowLoadingQuery} from "../handlers/ShowLoadingQuery";
39+
import { ListView } from "../elements/list-groups/ListView";
40+
import { ShortcutResponse } from "../../../IsaacAppTypes";
3941

4042
const GameboardItemComponent = ({gameboard, question}: {gameboard: GameboardDTO, question: GameboardItem}) => {
4143
let itemClasses = classNames("content-summary-link text-info bg-white", {"p-3": isPhy, "p-0": isAda});

src/app/components/site/phy/HomepagePhy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const HomepagePhy = () => {
3434
item: item,
3535
icon: {type: "img", icon: `/assets/phy/icons/redesign/subject-${subject}.svg`},
3636
subject: subject,
37-
tagList: subjectTags[subject],
37+
linkTags: subjectTags[subject],
3838
};
3939

4040
return listViewSubjectCard;

0 commit comments

Comments
 (0)