1
1
import { Link } from "react-router-dom" ;
2
2
import React from "react" ;
3
3
import { StageAndDifficultySummaryIcons } from "../StageAndDifficultySummaryIcons" ;
4
- import { ShortcutResponse , Subject , ViewingContext } from "../../../../IsaacAppTypes" ;
4
+ import { Subject , ViewingContext } from "../../../../IsaacAppTypes" ;
5
5
import classNames from "classnames" ;
6
- import { Button , Col , ListGroup , ListGroupItem , Row } from "reactstrap" ;
6
+ import { Button , Col , ListGroupItem , Row } from "reactstrap" ;
7
7
import { Spacer } from "../Spacer" ;
8
8
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" ;
11
10
import { PhyHexIcon } from "../svg/PhyHexIcon" ;
12
11
import { TitleIconProps } from "../PageTitle" ;
13
12
@@ -35,9 +34,9 @@ const StatusDisplay = (props: React.HTMLAttributes<HTMLSpanElement> & {status: C
35
34
}
36
35
} ;
37
36
38
- const Tags = ( { tags } : { tags : { tag : string , url ?: string } [ ] ; } ) => {
37
+ const LinkTags = ( { linkTags } : { linkTags : { tag : string , url ?: string } [ ] ; } ) => {
39
38
return < >
40
- { tags . map ( t => t . url ?
39
+ { linkTags . map ( t => t . url ?
41
40
< Link to = { t . url } className = "card-tag" key = { t . tag } > { t . tag } </ Link > :
42
41
< div className = "card-tag" key = { t . tag } > { t . tag } </ div >
43
42
) }
@@ -68,7 +67,9 @@ export interface AbstractListViewItemProps {
68
67
subtitle ?: string ;
69
68
breadcrumb ?: string [ ] ;
70
69
status ?: CompletionState ;
71
- tags ?: ListViewTagProps [ ] ;
70
+ tags ?: string [ ]
71
+ supersededBy ?: string ;
72
+ linkTags ?: ListViewTagProps [ ] ;
72
73
testTag ?: string ;
73
74
url ?: string ;
74
75
audienceViews ?: ViewingContext [ ] ;
@@ -78,7 +79,7 @@ export interface AbstractListViewItemProps {
78
79
fullWidth ?: boolean ;
79
80
}
80
81
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 ) => {
82
83
const deviceSize = useDeviceSize ( ) ;
83
84
const isQuiz : boolean = ( previewQuizUrl && quizButton ) ? true : false ;
84
85
@@ -96,6 +97,16 @@ export const AbstractListViewItem = ({icon, title, subject, subtitle, breadcrumb
96
97
< div className = "d-flex" >
97
98
< span className = "question-link-title" > { title } </ span >
98
99
{ 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 > }
99
110
</ div >
100
111
{ subtitle && < div className = "small text-muted" >
101
112
{ subtitle }
@@ -109,8 +120,8 @@ export const AbstractListViewItem = ({icon, title, subject, subtitle, breadcrumb
109
120
{ status && ( below [ "lg" ] ( deviceSize ) || fullWidth ) && < div className = "d-flex" >
110
121
< StatusDisplay status = { status } />
111
122
</ 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 } />
114
125
</ div > }
115
126
{ previewQuizUrl && quizButton && fullWidth && < div className = "d-flex d-md-none align-items-center" >
116
127
< QuizLinks previewQuizUrl = { previewQuizUrl } quizButton = { quizButton } />
0 commit comments