1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Fix typo error

This commit is contained in:
KY Lau 2021-06-11 08:43:00 +08:00
parent ebcc316aa2
commit 96131cba7d
9 changed files with 33 additions and 33 deletions

View File

@ -8,5 +8,5 @@ GATSBY_NETWORK="rinkeby"
#GATSBY_PORTIS_ID="xxx" #GATSBY_PORTIS_ID="xxx"
#GATSBY_ALLOW_FIXED_PRICING="true" #GATSBY_ALLOW_FIXED_PRICING="true"
#GATSBY_ALLOW_DYNAMIC_PRICING="true" #GATSBY_ALLOW_DYNAMIC_PRICING="true"
#GATSBY_ALLOW_ADVANCE_SETTINGS="true" #GATSBY_ALLOW_ADVANCED_SETTINGS="true"
#GATSBY_CREDENTIAL_TYPE="address" #GATSBY_CREDENTIAL_TYPE="address"

View File

@ -45,7 +45,7 @@ module.exports = {
allowFixedPricing: process.env.GATSBY_ALLOW_FIXED_PRICING || 'true', allowFixedPricing: process.env.GATSBY_ALLOW_FIXED_PRICING || 'true',
allowDynamicPricing: process.env.GATSBY_ALLOW_DYNAMIC_PRICING || 'true', allowDynamicPricing: process.env.GATSBY_ALLOW_DYNAMIC_PRICING || 'true',
// Used to show or hide advance settings button in asset details page // Used to show or hide advanced settings button in asset details page
allowAdvanceSettings: process.env.GATSBY_ALLOW_ADVANCE_SETTINGS || 'false', allowAdvancedSettings: process.env.GATSBY_ALLOW_ADVANCED_SETTINGS || 'false',
credentialType: process.env.GATSBY_CREDENTIAL_TYPE || 'address' credentialType: process.env.GATSBY_CREDENTIAL_TYPE || 'address'
} }

View File

@ -1,10 +1,10 @@
import { DDO, Credentials, CredentialType } from '@oceanprotocol/lib' import { DDO, Credentials, CredentialType } from '@oceanprotocol/lib'
import React, { ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import { AdvanceSettingsForm } from '../../../../models/FormEditCredential' import { AdvancedSettingsForm } from '../../../../models/FormEditCredential'
import { useOcean } from '../../../../providers/Ocean' import { useOcean } from '../../../../providers/Ocean'
import DebugOutput from '../../../atoms/DebugOutput' import DebugOutput from '../../../atoms/DebugOutput'
export interface AdvanceSettings { export interface AdvancedSettings {
credentail: Credentials credentail: Credentials
isOrderDisabled: boolean isOrderDisabled: boolean
} }
@ -14,12 +14,12 @@ export default function DebugEditCredential({
ddo, ddo,
credentialType credentialType
}: { }: {
values: AdvanceSettingsForm values: AdvancedSettingsForm
ddo: DDO ddo: DDO
credentialType: CredentialType credentialType: CredentialType
}): ReactElement { }): ReactElement {
const { ocean } = useOcean() const { ocean } = useOcean()
const [advanceSettings, setAdvanceSettings] = useState<AdvanceSettings>() const [advancedSettings, setAdvancedSettings] = useState<AdvancedSettings>()
useEffect(() => { useEffect(() => {
if (!ocean) return if (!ocean) return
@ -31,7 +31,7 @@ export default function DebugEditCredential({
values.allow, values.allow,
values.deny values.deny
) )
setAdvanceSettings({ setAdvancedSettings({
credentail: newDdo.credentials, credentail: newDdo.credentials,
isOrderDisabled: values.isOrderDisabled isOrderDisabled: values.isOrderDisabled
}) })
@ -42,7 +42,7 @@ export default function DebugEditCredential({
return ( return (
<> <>
<DebugOutput title="Collected Form Values" output={values} /> <DebugOutput title="Collected Form Values" output={values} />
<DebugOutput title="Transformed Form Values" output={advanceSettings} /> <DebugOutput title="Transformed Form Values" output={advancedSettings} />
</> </>
) )
} }

View File

@ -8,19 +8,19 @@ import MetadataFeedback from '../../../molecules/MetadataFeedback'
import { graphql, useStaticQuery } from 'gatsby' import { graphql, useStaticQuery } from 'gatsby'
import { useWeb3 } from '../../../../providers/Web3' import { useWeb3 } from '../../../../providers/Web3'
import { useOcean } from '../../../../providers/Ocean' import { useOcean } from '../../../../providers/Ocean'
import FormAdvanceSettings from './FormAdvanceSettings' import FormAdvancedSettings from './FormAdvancedSettings'
import { import {
AdvanceSettingsForm, AdvancedSettingsForm,
getInitialValues, getInitialValues,
validationSchema validationSchema
} from '../../../../models/FormEditCredential' } from '../../../../models/FormEditCredential'
import DebugEditAdvanceSettings from './DebugEditAdvanceSettings' import DebugEditCredential from './DebugEditAdvancedSettings'
import { useSiteMetadata } from '../../../../hooks/useSiteMetadata' import { useSiteMetadata } from '../../../../hooks/useSiteMetadata'
const contentQuery = graphql` const contentQuery = graphql`
query EditAvanceSettingsQuery { query EditAvanceSettingsQuery {
content: allFile( content: allFile(
filter: { relativePath: { eq: "pages/editAdvanceSettings.json" } } filter: { relativePath: { eq: "pages/editAdvancedSettings.json" } }
) { ) {
edges { edges {
node { node {
@ -57,7 +57,7 @@ function getDefaultCredentialType(credentialType: string): CredentialType {
} }
} }
export default function EditAdvanceSettings({ export default function EditAdvancedSettings({
setShowEdit setShowEdit
}: { }: {
setShowEdit: (show: boolean) => void setShowEdit: (show: boolean) => void
@ -78,7 +78,7 @@ export default function EditAdvanceSettings({
const credentialType = getDefaultCredentialType(appConfig.credentialType) const credentialType = getDefaultCredentialType(appConfig.credentialType)
async function handleSubmit( async function handleSubmit(
values: Partial<AdvanceSettingsForm>, values: Partial<AdvancedSettingsForm>,
resetForm: () => void resetForm: () => void
) { ) {
try { try {
@ -140,7 +140,7 @@ export default function EditAdvanceSettings({
<> <>
<p className={styles.description}>{content.description}</p> <p className={styles.description}>{content.description}</p>
<article className={styles.grid}> <article className={styles.grid}>
<FormAdvanceSettings <FormAdvancedSettings
data={content.form.data} data={content.form.data}
setShowEdit={setShowEdit} setShowEdit={setShowEdit}
/> />
@ -148,7 +148,7 @@ export default function EditAdvanceSettings({
{debug === true && ( {debug === true && (
<div className={styles.grid}> <div className={styles.grid}>
<DebugEditAdvanceSettings <DebugEditCredential
values={values} values={values}
ddo={ddo} ddo={ddo}
credentialType={credentialType} credentialType={credentialType}

View File

@ -6,9 +6,9 @@ import Input from '../../../atoms/Input'
import { FormFieldProps } from '../../../../@types/Form' import { FormFieldProps } from '../../../../@types/Form'
import { useOcean } from '../../../../providers/Ocean' import { useOcean } from '../../../../providers/Ocean'
import { useWeb3 } from '../../../../providers/Web3' import { useWeb3 } from '../../../../providers/Web3'
import { AdvanceSettingsForm } from '../../../../models/FormEditCredential' import { AdvancedSettingsForm } from '../../../../models/FormEditCredential'
export default function FormAdvanceSettings({ export default function FormAdvancedSettings({
data, data,
setShowEdit setShowEdit
}: { }: {
@ -21,7 +21,7 @@ export default function FormAdvanceSettings({
isValid, isValid,
validateField, validateField,
setFieldValue setFieldValue
}: FormikContextType<Partial<AdvanceSettingsForm>> = useFormikContext() }: FormikContextType<Partial<AdvancedSettingsForm>> = useFormikContext()
function handleFieldChange( function handleFieldChange(
e: ChangeEvent<HTMLInputElement>, e: ChangeEvent<HTMLInputElement>,

View File

@ -17,7 +17,7 @@ import MetaMain from './MetaMain'
import EditHistory from './EditHistory' import EditHistory from './EditHistory'
import { useWeb3 } from '../../../providers/Web3' import { useWeb3 } from '../../../providers/Web3'
import styles from './index.module.css' import styles from './index.module.css'
import EditAdvanceSettings from '../AssetActions/Edit/EditAdvanceSettings' import EditAdvancedSettings from '../AssetActions/Edit/EditAdvancedSettings'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata' import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
export interface AssetContentProps { export interface AssetContentProps {
@ -50,7 +50,7 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
const [showPricing, setShowPricing] = useState(false) const [showPricing, setShowPricing] = useState(false)
const [showEdit, setShowEdit] = useState<boolean>() const [showEdit, setShowEdit] = useState<boolean>()
const [showEditCompute, setShowEditCompute] = useState<boolean>() const [showEditCompute, setShowEditCompute] = useState<boolean>()
const [showEditAdvanceSettings, setShowEditAdvanceSettings] = const [showEditAdvancedSettings, setShowEditAdvancedSettings] =
useState<boolean>() useState<boolean>()
const [isOwner, setIsOwner] = useState(false) const [isOwner, setIsOwner] = useState(false)
const { ddo, price, metadata, type } = useAsset() const { ddo, price, metadata, type } = useAsset()
@ -75,17 +75,17 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
setShowEditCompute(true) setShowEditCompute(true)
} }
function handleEditAdvanceSettingsButton() { function handleEditAdvancedSettingsButton() {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
setShowEditAdvanceSettings(true) setShowEditAdvancedSettings(true)
} }
return showEdit ? ( return showEdit ? (
<Edit setShowEdit={setShowEdit} /> <Edit setShowEdit={setShowEdit} />
) : showEditCompute ? ( ) : showEditCompute ? (
<EditComputeDataset setShowEdit={setShowEditCompute} /> <EditComputeDataset setShowEdit={setShowEditCompute} />
) : showEditAdvanceSettings ? ( ) : showEditAdvancedSettings ? (
<EditAdvanceSettings setShowEdit={setShowEditAdvanceSettings} /> <EditAdvancedSettings setShowEdit={setShowEditAdvancedSettings} />
) : ( ) : (
<article className={styles.grid}> <article className={styles.grid}>
<div> <div>
@ -115,13 +115,13 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
<Button style="text" size="small" onClick={handleEditButton}> <Button style="text" size="small" onClick={handleEditButton}>
Edit Metadata Edit Metadata
</Button> </Button>
{appConfig.allowAdvanceSettings === 'true' && ( {appConfig.allowAdvancedSettings === 'true' && (
<> <>
<span className={styles.separator}>|</span> <span className={styles.separator}>|</span>
<Button <Button
style="text" style="text"
size="small" size="small"
onClick={handleEditAdvanceSettingsButton} onClick={handleEditAdvancedSettingsButton}
> >
Edit Advanced Settings Edit Advanced Settings
</Button> </Button>

View File

@ -27,7 +27,7 @@ interface UseSiteMetadata {
portisId: string portisId: string
allowFixedPricing: string allowFixedPricing: string
allowDynamicPricing: string allowDynamicPricing: string
allowAdvanceSettings: string allowAdvancedSettings: string
credentialType: string credentialType: string
} }
} }
@ -61,7 +61,7 @@ const query = graphql`
portisId portisId
allowFixedPricing allowFixedPricing
allowDynamicPricing allowDynamicPricing
allowAdvanceSettings allowAdvancedSettings
credentialType credentialType
} }
} }

View File

@ -7,13 +7,13 @@ import {
} from '@oceanprotocol/lib' } from '@oceanprotocol/lib'
import * as Yup from 'yup' import * as Yup from 'yup'
export interface AdvanceSettingsForm { export interface AdvancedSettingsForm {
allow: string[] allow: string[]
deny: string[] deny: string[]
isOrderDisabled: boolean isOrderDisabled: boolean
} }
export const validationSchema: Yup.SchemaOf<AdvanceSettingsForm> = export const validationSchema: Yup.SchemaOf<AdvancedSettingsForm> =
Yup.object().shape({ Yup.object().shape({
allow: Yup.array().nullable(), allow: Yup.array().nullable(),
deny: Yup.array().nullable(), deny: Yup.array().nullable(),
@ -52,7 +52,7 @@ function getAssetCredentials(
export function getInitialValues( export function getInitialValues(
ddo: DDO, ddo: DDO,
credentailType: CredentialType credentailType: CredentialType
): AdvanceSettingsForm { ): AdvancedSettingsForm {
const allowCredential = getAssetCredentials( const allowCredential = getAssetCredentials(
ddo.credentials, ddo.credentials,
credentailType, credentailType,