Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app): Disable derivatives tab if ToS not accepted #2994

Merged
merged 1 commit into from
Feb 29, 2024
Merged
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
Expand Up @@ -115,6 +115,7 @@
: `/datasets/${datasetId}/derivatives`}
icon="fa-cubes"
label="Derivatives"
disable={!agree}

Check warning on line 118 in packages/openneuro-app/src/scripts/dataset/components/DatasetTools.tsx

View check run for this annotation

Codecov / codecov/patch

packages/openneuro-app/src/scripts/dataset/components/DatasetTools.tsx#L118

Added line #L118 was not covered by tests
/>
)}
<DatasetToolButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from "react"
import { Navigate, useParams } from "react-router-dom"
import DownloadS3Derivative from "../download/download-derivative-s3"
import DownloadDataLadDerivative from "../download/download-derivative-datalad"
import { DatasetPageBorder } from "./styles/dataset-page-border"
import { HeaderRow3 } from "./styles/header-row"
import { useAgreement } from "../../components/agreement"

interface DerivativeElementProps {
name: string
Expand Down Expand Up @@ -38,6 +40,12 @@
}

const Derivatives = ({ derivatives }: DerivativesProps): JSX.Element => {
const { datasetId, tag: snapshotTag } = useParams()
const [agreed] = useAgreement()
// If the derivatives page is directly visited without the agreement, return to the dataset page
if (!agreed) {
return <Navigate to={`/datasets/${datasetId}`} replace={true} />
}

Check warning on line 48 in packages/openneuro-app/src/scripts/dataset/routes/derivatives.tsx

View check run for this annotation

Codecov / codecov/patch

packages/openneuro-app/src/scripts/dataset/routes/derivatives.tsx#L43-L48

Added lines #L43 - L48 were not covered by tests
return (
<DatasetPageBorder>
<HeaderRow3>Available Derivatives</HeaderRow3>
Expand Down
Loading