diff --git a/.env.example b/.env.example index 08a4c6ccd..b30d114ce 100644 --- a/.env.example +++ b/.env.example @@ -8,5 +8,5 @@ GATSBY_NETWORK="rinkeby" #GATSBY_PORTIS_ID="xxx" #GATSBY_ALLOW_FIXED_PRICING="true" #GATSBY_ALLOW_DYNAMIC_PRICING="true" -#GATSBY_ALLOW_ADVANCE_SETTINGS="true" +#GATSBY_ALLOW_ADVANCED_SETTINGS="true" #GATSBY_CREDENTIAL_TYPE="address" diff --git a/app.config.js b/app.config.js index e0e571849..43e4ba73c 100644 --- a/app.config.js +++ b/app.config.js @@ -45,7 +45,7 @@ module.exports = { allowFixedPricing: process.env.GATSBY_ALLOW_FIXED_PRICING || 'true', allowDynamicPricing: process.env.GATSBY_ALLOW_DYNAMIC_PRICING || 'true', - // Used to show or hide advance settings button in asset details page - allowAdvanceSettings: process.env.GATSBY_ALLOW_ADVANCE_SETTINGS || 'false', + // Used to show or hide advanced settings button in asset details page + allowAdvancedSettings: process.env.GATSBY_ALLOW_ADVANCED_SETTINGS || 'false', credentialType: process.env.GATSBY_CREDENTIAL_TYPE || 'address' } diff --git a/content/pages/editAdvanceSettings.json b/content/pages/editAdvancedSettings.json similarity index 100% rename from content/pages/editAdvanceSettings.json rename to content/pages/editAdvancedSettings.json diff --git a/src/components/organisms/AssetActions/Edit/DebugEditAdvanceSettings.tsx b/src/components/organisms/AssetActions/Edit/DebugEditAdvancedSettings.tsx similarity index 79% rename from src/components/organisms/AssetActions/Edit/DebugEditAdvanceSettings.tsx rename to src/components/organisms/AssetActions/Edit/DebugEditAdvancedSettings.tsx index 2de7713d4..5c1f03a23 100644 --- a/src/components/organisms/AssetActions/Edit/DebugEditAdvanceSettings.tsx +++ b/src/components/organisms/AssetActions/Edit/DebugEditAdvancedSettings.tsx @@ -1,10 +1,10 @@ import { DDO, Credentials, CredentialType } from '@oceanprotocol/lib' import React, { ReactElement, useEffect, useState } from 'react' -import { AdvanceSettingsForm } from '../../../../models/FormEditCredential' +import { AdvancedSettingsForm } from '../../../../models/FormEditCredential' import { useOcean } from '../../../../providers/Ocean' import DebugOutput from '../../../atoms/DebugOutput' -export interface AdvanceSettings { +export interface AdvancedSettings { credentail: Credentials isOrderDisabled: boolean } @@ -14,12 +14,12 @@ export default function DebugEditCredential({ ddo, credentialType }: { - values: AdvanceSettingsForm + values: AdvancedSettingsForm ddo: DDO credentialType: CredentialType }): ReactElement { const { ocean } = useOcean() - const [advanceSettings, setAdvanceSettings] = useState() + const [advancedSettings, setAdvancedSettings] = useState() useEffect(() => { if (!ocean) return @@ -31,7 +31,7 @@ export default function DebugEditCredential({ values.allow, values.deny ) - setAdvanceSettings({ + setAdvancedSettings({ credentail: newDdo.credentials, isOrderDisabled: values.isOrderDisabled }) @@ -42,7 +42,7 @@ export default function DebugEditCredential({ return ( <> - + ) } diff --git a/src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx b/src/components/organisms/AssetActions/Edit/EditAdvancedSettings.tsx similarity index 91% rename from src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx rename to src/components/organisms/AssetActions/Edit/EditAdvancedSettings.tsx index f8b6c0722..6c1bd2d9b 100644 --- a/src/components/organisms/AssetActions/Edit/EditAdvanceSettings.tsx +++ b/src/components/organisms/AssetActions/Edit/EditAdvancedSettings.tsx @@ -8,19 +8,19 @@ import MetadataFeedback from '../../../molecules/MetadataFeedback' import { graphql, useStaticQuery } from 'gatsby' import { useWeb3 } from '../../../../providers/Web3' import { useOcean } from '../../../../providers/Ocean' -import FormAdvanceSettings from './FormAdvanceSettings' +import FormAdvancedSettings from './FormAdvancedSettings' import { - AdvanceSettingsForm, + AdvancedSettingsForm, getInitialValues, validationSchema } from '../../../../models/FormEditCredential' -import DebugEditAdvanceSettings from './DebugEditAdvanceSettings' +import DebugEditCredential from './DebugEditAdvancedSettings' import { useSiteMetadata } from '../../../../hooks/useSiteMetadata' const contentQuery = graphql` query EditAvanceSettingsQuery { content: allFile( - filter: { relativePath: { eq: "pages/editAdvanceSettings.json" } } + filter: { relativePath: { eq: "pages/editAdvancedSettings.json" } } ) { edges { node { @@ -57,7 +57,7 @@ function getDefaultCredentialType(credentialType: string): CredentialType { } } -export default function EditAdvanceSettings({ +export default function EditAdvancedSettings({ setShowEdit }: { setShowEdit: (show: boolean) => void @@ -78,7 +78,7 @@ export default function EditAdvanceSettings({ const credentialType = getDefaultCredentialType(appConfig.credentialType) async function handleSubmit( - values: Partial, + values: Partial, resetForm: () => void ) { try { @@ -140,7 +140,7 @@ export default function EditAdvanceSettings({ <>

{content.description}

- @@ -148,7 +148,7 @@ export default function EditAdvanceSettings({ {debug === true && (
- > = useFormikContext() + }: FormikContextType> = useFormikContext() function handleFieldChange( e: ChangeEvent, diff --git a/src/components/organisms/AssetContent/index.tsx b/src/components/organisms/AssetContent/index.tsx index 4d71f7232..3f695b864 100644 --- a/src/components/organisms/AssetContent/index.tsx +++ b/src/components/organisms/AssetContent/index.tsx @@ -17,7 +17,7 @@ import MetaMain from './MetaMain' import EditHistory from './EditHistory' import { useWeb3 } from '../../../providers/Web3' import styles from './index.module.css' -import EditAdvanceSettings from '../AssetActions/Edit/EditAdvanceSettings' +import EditAdvancedSettings from '../AssetActions/Edit/EditAdvancedSettings' import { useSiteMetadata } from '../../../hooks/useSiteMetadata' export interface AssetContentProps { @@ -50,7 +50,7 @@ export default function AssetContent(props: AssetContentProps): ReactElement { const [showPricing, setShowPricing] = useState(false) const [showEdit, setShowEdit] = useState() const [showEditCompute, setShowEditCompute] = useState() - const [showEditAdvanceSettings, setShowEditAdvanceSettings] = + const [showEditAdvancedSettings, setShowEditAdvancedSettings] = useState() const [isOwner, setIsOwner] = useState(false) const { ddo, price, metadata, type } = useAsset() @@ -75,17 +75,17 @@ export default function AssetContent(props: AssetContentProps): ReactElement { setShowEditCompute(true) } - function handleEditAdvanceSettingsButton() { + function handleEditAdvancedSettingsButton() { window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) - setShowEditAdvanceSettings(true) + setShowEditAdvancedSettings(true) } return showEdit ? ( ) : showEditCompute ? ( - ) : showEditAdvanceSettings ? ( - + ) : showEditAdvancedSettings ? ( + ) : (
@@ -115,13 +115,13 @@ export default function AssetContent(props: AssetContentProps): ReactElement { - {appConfig.allowAdvanceSettings === 'true' && ( + {appConfig.allowAdvancedSettings === 'true' && ( <> | diff --git a/src/hooks/useSiteMetadata.ts b/src/hooks/useSiteMetadata.ts index 10523c738..30ed596bd 100644 --- a/src/hooks/useSiteMetadata.ts +++ b/src/hooks/useSiteMetadata.ts @@ -27,7 +27,7 @@ interface UseSiteMetadata { portisId: string allowFixedPricing: string allowDynamicPricing: string - allowAdvanceSettings: string + allowAdvancedSettings: string credentialType: string } } @@ -61,7 +61,7 @@ const query = graphql` portisId allowFixedPricing allowDynamicPricing - allowAdvanceSettings + allowAdvancedSettings credentialType } } diff --git a/src/models/FormEditCredential.ts b/src/models/FormEditCredential.ts index 50d876a13..c8da10d3a 100644 --- a/src/models/FormEditCredential.ts +++ b/src/models/FormEditCredential.ts @@ -7,13 +7,13 @@ import { } from '@oceanprotocol/lib' import * as Yup from 'yup' -export interface AdvanceSettingsForm { +export interface AdvancedSettingsForm { allow: string[] deny: string[] isOrderDisabled: boolean } -export const validationSchema: Yup.SchemaOf = +export const validationSchema: Yup.SchemaOf = Yup.object().shape({ allow: Yup.array().nullable(), deny: Yup.array().nullable(), @@ -52,7 +52,7 @@ function getAssetCredentials( export function getInitialValues( ddo: DDO, credentailType: CredentialType -): AdvanceSettingsForm { +): AdvancedSettingsForm { const allowCredential = getAssetCredentials( ddo.credentials, credentailType,