Skip to content

Commit

Permalink
refactor: conditionally render disabled link to analytics page when u…
Browse files Browse the repository at this point in the history
…navailable

- As per: #2387 (comment)
- Move the analytics link to be the middle option to maintain groupings
- As per: #2387 (comment)
- Render a disable version of the analytics page link to covney active/inactive to improve usability
  • Loading branch information
Mike-Heneghan committed Nov 7, 2023
1 parent 1d5c304 commit b4b7e66
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions editor.planx.uk/src/pages/FlowEditor/components/PreviewBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,7 @@ const PreviewBrowser: React.FC<{
/>
</Tooltip>

<Tooltip arrow title="Open editor preview">
<Link
href={props.url.replace("/preview", "/unpublished")}
target="_blank"
rel="noopener noreferrer"
color="inherit"
>
<ExternalLink />
</Link>
</Tooltip>

{!!flowMetabaseLink && (
{flowMetabaseLink ? (
<Tooltip arrow title="Open analytics page">
<Link
href={flowMetabaseLink}
Expand All @@ -182,8 +171,25 @@ const PreviewBrowser: React.FC<{
<BarChart />
</Link>
</Tooltip>
) : (
<Tooltip arrow title="Analytics page unavailable">
<Link component={"button"} disabled>
<BarChart />
</Link>
</Tooltip>
)}

<Tooltip arrow title="Open editor preview">
<Link
href={props.url.replace("/preview", "/unpublished")}
target="_blank"
rel="noopener noreferrer"
color="inherit"
>
<ExternalLink />
</Link>
</Tooltip>

<Tooltip arrow title="Open published service">
<Link
href={props.url + "?analytics=false"}
Expand Down

0 comments on commit b4b7e66

Please sign in to comment.