Skip to content

Commit

Permalink
fix: link to asset terms (#661)
Browse files Browse the repository at this point in the history
* fix: update asset terms and conditions wording and handling in forms

* fix: simplify options and actions handling in TermsAndConditionsCheckbox

* refactor: rename 'actions' to 'licence' in TermsAndConditionsCheckbox and update handling

* fix: correct spelling of 'licence' to 'license' in TermsAndConditionsCheckbox and related components

* fix: update 'license' to 'licenses' in TermsAndConditionsCheckbox and related components
  • Loading branch information
KevinRohlf authored Feb 6, 2025
1 parent 9b98aa6 commit 95278e1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions content/pages/startComputeDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
},
"assetTermsAndConditions": {
"name": "assetTermsAndConditions",
"options": ["Asset Terms and Conditions"],
"prefixes": ["I agree to the"]
"prefixes": ["I acknowledge that the asset is made available under"],
"postfixes": ["license and agree to the terms"]
}
}
}
4 changes: 2 additions & 2 deletions content/pages/startDownloadDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"assetTermsAndConditions": {
"name": "assetTermsAndConditions",
"options": ["Asset Terms and Conditions"],
"prefixes": ["I agree to the"]
"prefixes": ["I acknowledge that the asset is made available under"],
"postfixes": ["license and agree to the terms"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export default function FormStartCompute({
/>
<TermsAndConditionsCheckbox
{...content.form.portalTermsAndConditions}
actions={[appConfig.defaultTermsAndConditionsUrl]}
licenses={[appConfig.defaultTermsAndConditionsUrl]}
disabled={isLoading}
onChange={() =>
setPortalTermsAndConditions(
Expand All @@ -407,7 +407,7 @@ export default function FormStartCompute({
/>
<TermsAndConditionsCheckbox
{...content.form.assetTermsAndConditions}
actions={[asset?.metadata?.license]}
licenses={[asset?.metadata?.license]}
disabled={isLoading}
onChange={() =>
setAssetTermsAndConditions(
Expand Down
4 changes: 2 additions & 2 deletions src/components/Asset/AssetActions/Download/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ export default function Download({
)}
<TermsAndConditionsCheckbox
{...content.form.portalTermsAndConditions}
actions={[defaultTermsAndConditionsUrl]}
licenses={[defaultTermsAndConditionsUrl]}
disabled={isLoading}
/>
<TermsAndConditionsCheckbox
{...content.form.assetTermsAndConditions}
actions={[asset?.metadata?.license]}
licenses={[asset?.metadata?.license]}
disabled={isLoading}
/>
</div>
Expand Down
20 changes: 14 additions & 6 deletions src/components/Asset/AssetActions/TermsAndConditionsCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@ import styles from './index.module.css'

export default function TermsAndConditionsCheckbox({
name,
actions,
licenses,
onChange,
disabled,
options,
prefixes
prefixes,
postfixes
}: {
name: string
actions: any
licenses: string[]
onChange?: (termsAndConditions: boolean) => void
disabled: boolean
options: string[]
options?: string[]
prefixes: string[]
postfixes?: string[]
}) {
return (
<Field
name={name}
type="checkbox"
options={options}
options={
options ||
licenses.map((option) =>
option.includes('http') ? 'a custom' : `the ${option}`
)
}
prefixes={prefixes}
actions={actions}
postfixes={postfixes}
actions={licenses?.filter((action) => action.includes('http'))}
component={Input}
disabled={disabled}
{...(onChange && { onChange })}
Expand Down

0 comments on commit 95278e1

Please sign in to comment.