Skip to content

Commit

Permalink
add link to restriction items
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-luger committed Nov 11, 2024
1 parent 628dae2 commit da1c3f6
Showing 1 changed file with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import DuplicateIcon from '@mui/icons-material/ControlPointDuplicate'
import DeleteIcon from '@mui/icons-material/Delete'
import { MouseEventHandler } from 'react'
import OpenInNewIcon from '@mui/icons-material/OpenInNew'
import { btoaUnicode } from '../../../../utils/Base64Utils'

interface Props {
restriction: FlipRestriction
Expand Down Expand Up @@ -87,10 +88,10 @@ export default function FlipRestrictionListEntry(props: Props) {
let newItem: Item | undefined =
items && items.length > 0
? {
tag: items[0].id,
name: items[0].dataItem.name,
iconUrl: items[0].dataItem.iconUrl
}
tag: items[0].id,
name: items[0].dataItem.name,
iconUrl: items[0].dataItem.iconUrl
}
: undefined
let newRestriction = { ...props.restriction }
newRestriction.item = newItem
Expand All @@ -100,15 +101,15 @@ export default function FlipRestrictionListEntry(props: Props) {
defaultSelected={
props.restriction.item
? [
{
dataItem: {
iconUrl: props.restriction.item.iconUrl || '',
name: props.restriction.item.name || '-'
},
id: props.restriction.item.tag || '',
label: props.restriction.item.name || '-'
} as unknown as SearchResultItem
]
{
dataItem: {
iconUrl: props.restriction.item.iconUrl || '',
name: props.restriction.item.name || '-'
},
id: props.restriction.item.tag || '',
label: props.restriction.item.name || '-'
} as unknown as SearchResultItem
]
: undefined
}
/>
Expand Down Expand Up @@ -142,7 +143,13 @@ export default function FlipRestrictionListEntry(props: Props) {
<Tooltip
type="hover"
content={
<a href={`/item/${props.restriction.item.tag}`} target="_blank" rel="noreferrer">
<a
href={`/item/${props.restriction.item.tag}${
props.restriction.itemFilter ? `${btoaUnicode(JSON.stringify(props.restriction.itemFilter))}` : ''
}`}
target="_blank"
rel="noreferrer"
>
<OpenInNewIcon />
</a>
}
Expand Down Expand Up @@ -188,9 +195,12 @@ export default function FlipRestrictionListEntry(props: Props) {
props.onRestrictionChange(newRestriction)
}}
/>
) : (props.restriction.item?.tag.startsWith('STARRED_') ? (
<p>Note that you will need to add the <code>Fragged</code> filter to select only fragged items. This currently selects both fragged and not fragged.</p>
) : null)}
) : props.restriction.item?.tag.startsWith('STARRED_') ? (
<p>
Note that you will need to add the <code>Fragged</code> filter to select only fragged items. This currently selects both fragged and
not fragged.
</p>
) : null}
<div className="ellipse">
{props.restriction.tags?.map(tag => (
<Badge
Expand Down

0 comments on commit da1c3f6

Please sign in to comment.