Fix track download dropdown appearing for non-authors, and update tooltip
This commit is contained in:
parent
741ff0d488
commit
2a9e3549b5
|
@ -5,39 +5,36 @@ import {Icon, Popup, Button, Dropdown} from 'semantic-ui-react'
|
|||
export default function TrackActions({slug, isAuthor, onDownload}) {
|
||||
return (
|
||||
<>
|
||||
{isAuthor ? (
|
||||
<Dropdown text="Download" button upward>
|
||||
<Dropdown.Menu>
|
||||
<Popup
|
||||
content={
|
||||
<>
|
||||
<p>Only you, the author of this track, can download the original file.</p>
|
||||
<p>
|
||||
This is the file as it was uploaded to the server, without modifications, and it can be used with
|
||||
other tools. Exporting to other formats, and downloading modified files, will be implemented soon.
|
||||
</p>
|
||||
</>
|
||||
}
|
||||
trigger={<Dropdown.Item text="Original" onClick={() => onDownload('original.csv')} />}
|
||||
/>
|
||||
<Dropdown.Item text="Track (GPX)" onClick={() => onDownload('track.gpx')} />
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
) : (
|
||||
<>
|
||||
<Button disabled>Download</Button>
|
||||
<Popup
|
||||
content={<p>Only the author of this track can download the original file.</p>}
|
||||
trigger={<Icon name="info circle" />}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{isAuthor && (
|
||||
<Link to={`/tracks/${slug}/edit`}>
|
||||
<Button primary>Edit track</Button>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
<Dropdown text="Download" button upward>
|
||||
<Dropdown.Menu>
|
||||
<Dropdown.Item text="Original" onClick={() => onDownload('original.csv')} disabled={!isAuthor} />
|
||||
<Dropdown.Item text="Track (GPX)" onClick={() => onDownload('track.gpx')} />
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
|
||||
<Popup
|
||||
trigger={<Icon name="info circle" />}
|
||||
offset={[12, 0]}
|
||||
content={
|
||||
isAuthor ? (
|
||||
<>
|
||||
<p>Only you, the author of this track, can download the original file.</p>
|
||||
<p>
|
||||
This is the file as it was uploaded to the server, without modifications, and it can be used with other
|
||||
tools.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p>Only the author of this track can download the original file.</p>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue