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_ALLOW_FIXED_PRICING="true"
#GATSBY_ALLOW_DYNAMIC_PRICING="true"
#GATSBY_ALLOW_ADVANCE_SETTINGS="true"
#GATSBY_ALLOW_ADVANCED_SETTINGS="true"
#GATSBY_CREDENTIAL_TYPE="address"

View File

@ -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'
}

View File

@ -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<AdvanceSettings>()
const [advancedSettings, setAdvancedSettings] = useState<AdvancedSettings>()
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 (
<>
<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 { 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<AdvanceSettingsForm>,
values: Partial<AdvancedSettingsForm>,
resetForm: () => void
) {
try {
@ -140,7 +140,7 @@ export default function EditAdvanceSettings({
<>
<p className={styles.description}>{content.description}</p>
<article className={styles.grid}>
<FormAdvanceSettings
<FormAdvancedSettings
data={content.form.data}
setShowEdit={setShowEdit}
/>
@ -148,7 +148,7 @@ export default function EditAdvanceSettings({
{debug === true && (
<div className={styles.grid}>
<DebugEditAdvanceSettings
<DebugEditCredential
values={values}
ddo={ddo}
credentialType={credentialType}

View File

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

View File

@ -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<boolean>()
const [showEditCompute, setShowEditCompute] = useState<boolean>()
const [showEditAdvanceSettings, setShowEditAdvanceSettings] =
const [showEditAdvancedSettings, setShowEditAdvancedSettings] =
useState<boolean>()
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 ? (
<Edit setShowEdit={setShowEdit} />
) : showEditCompute ? (
<EditComputeDataset setShowEdit={setShowEditCompute} />
) : showEditAdvanceSettings ? (
<EditAdvanceSettings setShowEdit={setShowEditAdvanceSettings} />
) : showEditAdvancedSettings ? (
<EditAdvancedSettings setShowEdit={setShowEditAdvancedSettings} />
) : (
<article className={styles.grid}>
<div>
@ -115,13 +115,13 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
<Button style="text" size="small" onClick={handleEditButton}>
Edit Metadata
</Button>
{appConfig.allowAdvanceSettings === 'true' && (
{appConfig.allowAdvancedSettings === 'true' && (
<>
<span className={styles.separator}>|</span>
<Button
style="text"
size="small"
onClick={handleEditAdvanceSettingsButton}
onClick={handleEditAdvancedSettingsButton}
>
Edit Advanced Settings
</Button>

View File

@ -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
}
}

View File

@ -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<AdvanceSettingsForm> =
export const validationSchema: Yup.SchemaOf<AdvancedSettingsForm> =
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,