Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ButtonGroupButton } from "@databiosphere/findable-ui/lib/components/common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
import { ContentCopyIconSmall } from "@databiosphere/findable-ui/lib/components/common/CustomIcon/common/constants";
import { useFileLocation } from "@databiosphere/findable-ui/lib/hooks/useFileLocation";
import { useLoginGuard } from "@databiosphere/findable-ui/lib/providers/loginGuard/hook";
import copy from "copy-to-clipboard";
import { useEffect } from "react";
import { ProjectMatrixView } from "../../../../../../viewModelBuilders/azul/hca-dcp/common/projectMatrixMapper/entities";
Expand All @@ -16,9 +15,6 @@ export const FileLocationCopy = ({
const { url } = projectMatrixView;
const { fileUrl, isLoading, isSuccess, run } = useFileLocation(url);

// Prompt user for login before download, if required.
const { requireLogin } = useLoginGuard();

useEffect(() => {
if (fileUrl && isSuccess) {
copy(fileUrl);
Expand All @@ -30,7 +26,7 @@ export const FileLocationCopy = ({
action="Copy project matrix"
label={<ContentCopyIconSmall />}
loading={isLoading}
onClick={() => requireLogin(run)}
onClick={run}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { FileDownloadButton } from "@databiosphere/findable-ui/lib/components/co
import { ButtonGroupButton } from "@databiosphere/findable-ui/lib/components/common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
import { DownloadIconSmall } from "@databiosphere/findable-ui/lib/components/common/CustomIcon/common/constants";
import { useFileLocation } from "@databiosphere/findable-ui/lib/hooks/useFileLocation";
import { useLoginGuard } from "@databiosphere/findable-ui/lib/providers/loginGuard/hook";
import { ProjectMatrixView } from "../../../../../../viewModelBuilders/azul/hca-dcp/common/projectMatrixMapper/entities";

export interface FileLocationDownloadProps {
Expand All @@ -15,16 +14,13 @@ export const FileLocationDownload = ({
const { fileName, url } = projectMatrixView;
const { fileUrl, isLoading, run } = useFileLocation(url);

// Prompt user for login before download, if required.
const { requireLogin } = useLoginGuard();

return (
<>
<ButtonGroupButton
action="Download project matrix"
label={<DownloadIconSmall />}
loading={isLoading}
onClick={() => requireLogin(run)}
onClick={run}
/>
<FileDownloadButton fileName={fileName} fileUrl={fileUrl} />
</>
Expand Down