Skip to content
Snippets Groups Projects
Commit a5c17c0f authored by David Bühler's avatar David Bühler
Browse files

[ivette] Marker info: do not show the 'remove' and 'pin' buttons at the same time.

Only shows the 'remove' button when the marker is pinned and not selected
(if it is selected, it cannot be instantly removed).
Otherwise, shows the 'pin/unpin' button.
parent 80fe5092
No related branches found
No related tags found
No related merge requests found
...@@ -145,6 +145,15 @@ function MarkInfos(props: InfoSectionProps): JSX.Element { ...@@ -145,6 +145,15 @@ function MarkInfos(props: InfoSectionProps): JSX.Element {
const filtered = allInfos.filter((info) => !fs.some((m) => m === info.id)); const filtered = allInfos.filter((info) => !fs.some((m) => m === info.id));
const infos = more ? allInfos : filtered; const infos = more ? allInfos : filtered;
const hasMore = filtered.length < allInfos.length; const hasMore = filtered.length < allInfos.length;
const pinButton =
(!props.pinned || props.selected) ?
{
icon: "PIN", selected: props.pinned, onClick: props.onPin,
title: "Pin/unpin marker information"
} : {
icon: "CIRC.CLOSE", onClick: props.onRemove,
title:"Remove marker information"
};
return ( return (
<div <div
className={`astinfo-section ${highlight}`} className={`astinfo-section ${highlight}`}
...@@ -168,15 +177,6 @@ function MarkInfos(props: InfoSectionProps): JSX.Element { ...@@ -168,15 +177,6 @@ function MarkInfos(props: InfoSectionProps): JSX.Element {
<Code className="astinfo-markercode"> <Code className="astinfo-markercode">
{kind}{descr} {kind}{descr}
</Code> </Code>
<IconButton
className="astinfo-markerbutton"
title="Pin/unpin information in sidebar"
size={9}
offset={0}
icon="PIN"
selected={props.pinned}
onClick={props.onPin}
/>
<IconButton <IconButton
style={{ display: hasMore ? undefined : 'none' }} style={{ display: hasMore ? undefined : 'none' }}
className="astinfo-markerbutton" className="astinfo-markerbutton"
...@@ -189,11 +189,9 @@ function MarkInfos(props: InfoSectionProps): JSX.Element { ...@@ -189,11 +189,9 @@ function MarkInfos(props: InfoSectionProps): JSX.Element {
/> />
<IconButton <IconButton
className="astinfo-markerbutton" className="astinfo-markerbutton"
title="Remove informations"
size={9} size={9}
offset={0} offset={0}
icon="CIRC.CLOSE" {...pinButton}
onClick={props.onRemove}
/> />
</div> </div>
{unfold && infos.map((info) => <InfoItem key={info.id} {...info} />)} {unfold && infos.map((info) => <InfoItem key={info.id} {...info} />)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment