feat: add image opening functionality to DownloadActionBar (#725)
* feat: add image opening functionality to DownloadActionBar and Share components --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -14,6 +14,7 @@ interface Props {
|
|||||||
onDownload: () => void
|
onDownload: () => void
|
||||||
onUpdateFeed: () => void
|
onUpdateFeed: () => void
|
||||||
hasIndexDocument: boolean
|
hasIndexDocument: boolean
|
||||||
|
isImage: boolean
|
||||||
loading: boolean
|
loading: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ export function DownloadActionBar({
|
|||||||
onDownload,
|
onDownload,
|
||||||
onUpdateFeed,
|
onUpdateFeed,
|
||||||
hasIndexDocument,
|
hasIndexDocument,
|
||||||
|
isImage,
|
||||||
loading,
|
loading,
|
||||||
}: Props): ReactElement {
|
}: Props): ReactElement {
|
||||||
return (
|
return (
|
||||||
@@ -33,6 +35,11 @@ export function DownloadActionBar({
|
|||||||
View Website
|
View Website
|
||||||
</SwarmButton>
|
</SwarmButton>
|
||||||
)}
|
)}
|
||||||
|
{isImage && (
|
||||||
|
<SwarmButton onClick={onOpen} iconType={Link} disabled={loading}>
|
||||||
|
Open Image
|
||||||
|
</SwarmButton>
|
||||||
|
)}
|
||||||
<SwarmButton onClick={onDownload} iconType={Download} disabled={loading} loading={loading}>
|
<SwarmButton onClick={onDownload} iconType={Download} disabled={loading} loading={loading}>
|
||||||
Download
|
Download
|
||||||
</SwarmButton>
|
</SwarmButton>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export function Share(): ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onOpen() {
|
function onOpen() {
|
||||||
window.open(`${apiUrl}/bzz/${hash}/`, '_blank')
|
window.open(`${apiUrl}/bzz/${hash}/`, '_blank', 'noopener,noreferrer')
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClose() {
|
function onClose() {
|
||||||
@@ -239,6 +239,7 @@ export function Share(): ReactElement {
|
|||||||
onDownload={onDownload}
|
onDownload={onDownload}
|
||||||
onUpdateFeed={onUpdateFeed}
|
onUpdateFeed={onUpdateFeed}
|
||||||
hasIndexDocument={Boolean(metadata?.isWebsite)}
|
hasIndexDocument={Boolean(metadata?.isWebsite)}
|
||||||
|
isImage={Boolean(metadata?.isImage)}
|
||||||
loading={downloading}
|
loading={downloading}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user