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

reorganize all the things

This commit is contained in:
Matthias Kretschmann 2021-10-13 17:48:59 +01:00
parent 28a2ba88c1
commit f951910dc2
Signed by: m
GPG Key ID: 606EEEF3C479A91F
443 changed files with 1355 additions and 11084 deletions

View File

@ -1,16 +0,0 @@
import React from 'react'
export const Center = ({ children }: { children: any }) => (
<div
style={{
height: '100vh',
maxWidth: '35rem',
margin: 'auto',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
>
{children}
</div>
)

View File

@ -1,3 +0,0 @@
module.exports = {
stories: ['../src/**/*.stories.tsx', '../tests/**/*.stories.tsx']
}

View File

@ -1,44 +0,0 @@
import React from 'react'
import { addDecorator } from '@storybook/react'
import {
createHistory,
createMemorySource,
LocationProvider
} from '@reach/router'
// Import global css with custom properties once for all stories.
import '@oceanprotocol/typographies/css/ocean-typo.css'
import '../src/global/styles.css'
// Wrapper for all stories previews
const history = createHistory(createMemorySource('/'))
addDecorator((storyFn) => (
<LocationProvider history={history}>
<div
style={{
minHeight: '100vh',
width: '100%',
padding: '2rem'
}}
>
{storyFn()}
</div>
</LocationProvider>
))
// Gatsby's Link overrides:
// Gatsby defines a global called ___loader to prevent its method calls from creating console errors you override it here
global.___loader = {
enqueue: () => {},
hovering: () => {}
}
// Gatsby internal mocking to prevent unnecessary errors in storybook testing environment
global.__PATH_PREFIX__ = ''
global.__BASE_PATH__ = ''
// This is to utilized to override the window.___navigate method Gatsby defines and uses to report what path a Link would be taking us to if it wasn't inside a storybook
window.___navigate = (pathname) => {
action('NavigateTo:')(pathname)
}

View File

@ -1,103 +0,0 @@
// https://www.gatsbyjs.org/docs/visual-testing-with-storybook/
// Make CSS modules work
// https://github.com/storybookjs/storybook/issues/4306#issuecomment-517951264
const setCssModulesRule = (rule) => {
const nextRule = rule
const cssLoader = rule.use[1]
const nextOptions = {
...cssLoader.options,
modules: {
localIdentName: '[name]__[local]___[hash:base64:5]'
}
}
cssLoader.options = nextOptions
return nextRule
}
module.exports = ({ config }) => {
const cssRules = config.module.rules.map((rule) => {
const isCssRule = rule.test.toString().indexOf('css') !== -1
let nextRule = rule
if (isCssRule) {
nextRule = setCssModulesRule(rule)
}
return nextRule
})
config.module.rules = cssRules
// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
config.module.rules[0].exclude = [/node_modules\/(?!(gatsby)\/)/]
// use installed babel-loader which is v8.0-beta (which is meant to work with @babel/core@7)
config.module.rules[0].use[0].loader = require.resolve('babel-loader')
// use @babel/preset-react for JSX and env (instead of staged presets)
config.module.rules[0].use[0].options.presets = [
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-env')
]
config.module.rules[0].use[0].options.plugins = [
// use @babel/plugin-proposal-class-properties for class arrow functions
require.resolve('@babel/plugin-proposal-class-properties'),
// use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
require.resolve('babel-plugin-remove-graphql-queries')
]
// Prefer Gatsby ES6 entrypoint (module) over commonjs (main) entrypoint
config.resolve.mainFields = ['browser', 'module', 'main']
// Handle TypeScript
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve('babel-loader'),
options: {
presets: [['react-app', { flow: false, typescript: true }]],
plugins: [
require.resolve('@babel/plugin-proposal-class-properties'),
// use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
require.resolve('babel-plugin-remove-graphql-queries')
]
}
})
config.resolve.extensions.push('.ts', '.tsx')
// 'fs' fix for squid.js
config.node = {
fs: 'empty'
}
// Handle SVGs
// Don't use Storybook's default SVG Configuration
config.module.rules = config.module.rules.map((rule) => {
if (rule.test.toString().includes('svg')) {
const test = rule.test.toString().replace('svg|', '').replace(/\//g, '')
return { ...rule, test: new RegExp(test) }
} else {
return rule
}
})
// Use SVG Configuration for SVGR yourself
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: {
removeViewBox: false
}
}
}
},
'url-loader'
]
})
return config
}

View File

@ -15,7 +15,7 @@ module.exports = {
// List of all supported chainIds. Used to populate the Chains user preferences list. // List of all supported chainIds. Used to populate the Chains user preferences list.
chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000, 1285, 246], chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000, 1285, 246],
rbacUrl: process.env.GATSBY_RBAC_URL, rbacUrl: process.env.GATSBY_RBAC_URL || '',
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx', infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx',

View File

@ -1,31 +0,0 @@
{
"description": "Update advanced settings of this data set. Updating these settings will create an on-chain transaction you have to approve in your wallet.",
"form": {
"success": "🎉 Successfully updated. 🎉",
"successAction": "Close",
"error": "Updating DDO failed.",
"data": [
{
"name": "allow",
"label": "Allow ETH Address",
"placeholder": "e.g. 0x12345678901234567890abcd",
"help": "Enter ETH address and click ADD button to append the list. Only ETH address in allow list can consume this asset. If the list is empty means anyone can download or compute this asset",
"type": "credentials"
},
{
"name": "deny",
"label": "Deny ETH Address",
"placeholder": "e.g. 0x12345678901234567890abcd",
"help": "Enter ETH address and click ADD button to append the list. If ETH address is fall under deny list, download or compute of this asset is denied",
"type": "credentials"
},
{
"name": "isOrderDisabled",
"label": "Disable Consumption",
"help": "Disable dataset being download or compute when dataset undergoing maintenance.",
"type": "checkbox",
"options": ["Disable"]
}
]
}
}

View File

@ -1,5 +1,5 @@
import wrapPageElementWithStyles from './src/helpers/wrapPageElement' import wrapPageElementWithStyles from './src/components/wrapPageElement'
import wrapRootElementWithProviders from './src/helpers/wrapRootElement' import wrapRootElementWithProviders from './src/components/wrapRootElement'
export const wrapPageElement = wrapPageElementWithStyles export const wrapPageElement = wrapPageElementWithStyles
export const wrapRootElement = wrapRootElementWithProviders export const wrapRootElement = wrapRootElementWithProviders

View File

@ -1,6 +1,7 @@
const createFields = require('./gatsby/createFields') const createFields = require('./gatsby/createFields')
const createMarkdownPages = require('./gatsby/createMarkdownPages') const createMarkdownPages = require('./gatsby/createMarkdownPages')
const execSync = require('child_process').execSync const execSync = require('child_process').execSync
const path = require('path')
// Write out repo metadata // Write out repo metadata
execSync(`node ./scripts/write-repo-metadata > repo-metadata.json`, { execSync(`node ./scripts/write-repo-metadata > repo-metadata.json`, {
@ -73,6 +74,15 @@ exports.onCreatePage = async ({ page, actions }) => {
exports.onCreateWebpackConfig = ({ actions }) => { exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({ actions.setWebpackConfig({
resolve: {
alias: {
'@shared': path.resolve(__dirname, 'src/components/@shared'),
'@hooks': path.resolve(__dirname, 'src/hooks'),
'@context': path.resolve(__dirname, 'src/context'),
'@images': path.resolve(__dirname, 'src/images'),
'@utils': path.resolve(__dirname, 'src/utils')
}
},
node: { node: {
// 'fs' fix for ocean.js // 'fs' fix for ocean.js
fs: 'empty' fs: 'empty'

View File

@ -1,5 +1,5 @@
import wrapPageElementWithStyles from './src/helpers/wrapPageElement' import wrapPageElementWithStyles from './src/components/wrapPageElement'
import wrapRootElementWithProviders from './src/helpers/wrapRootElement' import wrapRootElementWithProviders from './src/components/wrapRootElement'
export const wrapPageElement = wrapPageElementWithStyles export const wrapPageElement = wrapPageElementWithStyles
export const wrapRootElement = wrapRootElementWithProviders export const wrapRootElement = wrapRootElementWithProviders

View File

@ -4,7 +4,7 @@ async function createMarkdownPages(graphql, actions) {
const { createPage } = actions const { createPage } = actions
const markdownPageTemplate = path.resolve( const markdownPageTemplate = path.resolve(
'./src/components/templates/PageMarkdown.tsx' './src/components/@shared/Page/PageMarkdown.tsx'
) )
// Grab all markdown files with a frontmatter title defined // Grab all markdown files with a frontmatter title defined
const markdownResult = await graphql(` const markdownResult = await graphql(`

7575
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,16 +8,12 @@
"start": "gatsby develop --host 0.0.0.0", "start": "gatsby develop --host 0.0.0.0",
"build": "gatsby build && cp _redirects public/_redirects", "build": "gatsby build && cp _redirects public/_redirects",
"serve": "serve -s public/", "serve": "serve -s public/",
"jest": "NODE_ENV=test jest -c tests/unit/jest.config.js", "test-graphql": "npm run graphql:graphTypes && npm run lint",
"test-graphql": "npm run graphql:graphTypes && npm run lint && npm run jest", "test": "npm run apollo:codegen && npm run lint",
"test": "npm run apollo:codegen && npm run lint && npm run jest",
"test:watch": "npm run lint && npm run jest -- --watch",
"lint": "npm run write:repoMetadata && eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx . && npm run type-check", "lint": "npm run write:repoMetadata && eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx . && npm run type-check",
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json}' --write", "format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json}' --write",
"type-check": "tsc --noEmit", "type-check": "tsc --noEmit",
"analyze": "npm run build && source-map-explorer 'public/*.js'", "analyze": "npm run build && source-map-explorer 'public/*.js'",
"storybook": "start-storybook -p 4000 -c .storybook",
"storybook:build": "build-storybook -c .storybook -o public/storybook",
"write:repoMetadata": "node ./scripts/write-repo-metadata > repo-metadata.json", "write:repoMetadata": "node ./scripts/write-repo-metadata > repo-metadata.json",
"deploy:s3": "./scripts/deploy-s3.sh", "deploy:s3": "./scripts/deploy-s3.sh",
"postinstall": "husky install", "postinstall": "husky install",
@ -100,8 +96,6 @@
"@graphql-codegen/typescript-operations": "^1.18.3", "@graphql-codegen/typescript-operations": "^1.18.3",
"@graphql-codegen/typescript-react-apollo": "2.3.0", "@graphql-codegen/typescript-react-apollo": "2.3.0",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"@types/chart.js": "^2.9.32", "@types/chart.js": "^2.9.32",
"@types/jest": "^26.0.23", "@types/jest": "^26.0.23",
"@types/js-cookie": "^2.2.7", "@types/js-cookie": "^2.2.7",
@ -127,8 +121,6 @@
"eslint-plugin-react": "^7.24.0", "eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-hooks": "^4.2.0",
"husky": "^6.0.0", "husky": "^6.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3",
"prettier": "^2.3.0", "prettier": "^2.3.0",
"pretty-quick": "^3.1.0", "pretty-quick": "^3.1.0",
"serve": "^11.3.2", "serve": "^11.3.2",

21
src/@types/Compute.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
// declaring into global scope to be able to use this as
// ambiant types despite the above imports
declare global {
interface ComputeJobMetaData extends ComputeJob {
assetName: string
assetDtSymbol: string
networkId: number
}
interface AlgorithmOption {
did: string
name: string
}
interface ComputePrivacyForm {
allowAllPublishedAlgorithms: boolean
publisherTrustedAlgorithms: string[]
}
}

View File

@ -1,4 +0,0 @@
export interface AlgorithmOption {
did: string
name: string
}

View File

@ -1,7 +0,0 @@
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
export interface ComputeJobMetaData extends ComputeJob {
assetName: string
assetDtSymbol: string
networkId: number
}

50
src/@types/Form.d.ts vendored
View File

@ -1,26 +1,30 @@
import { AssetSelectionAsset } from '../../molecules/FormFields/AssetSelection' import { AssetSelectionAsset } from '@shared/Form/FormFields/AssetSelection'
export interface FormFieldProps { // declaring into global scope to be able to use this as
label: string // ambiant types despite the above imports
name: string declare global {
type?: string interface FormFieldProps {
options?: string[] | AssetSelectionAsset[] label: string
sortOptions?: boolean name: string
required?: boolean type?: string
multiple?: boolean options?: string[] | AssetSelectionAsset[]
disabled?: boolean sortOptions?: boolean
help?: string required?: boolean
placeholder?: string multiple?: boolean
pattern?: string disabled?: boolean
min?: string help?: string
disclaimer?: string placeholder?: string
disclaimerValues?: string[] pattern?: string
advanced?: boolean min?: string
} disclaimer?: string
disclaimerValues?: string[]
advanced?: boolean
}
export interface FormContent { interface FormContent {
title: string title: string
description?: string description?: string
success: string success: string
data: FormFieldProps[] data: FormFieldProps[]
}
} }

View File

@ -1,74 +1,29 @@
import { import {
Metadata, Metadata,
File,
AdditionalInformation, AdditionalInformation,
ServiceMetadata EditableMetadataLinks
} from '@oceanprotocol/lib' } from '@oceanprotocol/lib'
import { DataTokenOptions } from '../hooks/usePublish'
import { PriceOptions } from '../hooks/usePricing'
export interface AdditionalInformationMarket extends AdditionalInformation { // declaring into global scope to be able to use this as
links?: File[] // ambiant types despite the above imports
termsAndConditions: boolean declare global {
} interface AdditionalInformationMarket extends AdditionalInformation {
termsAndConditions: boolean
}
export interface MetadataMarket extends Metadata { interface MetadataMarket extends Metadata {
// While required for this market, Aquarius/Plecos will keep this as optional // While required for this market, Aquarius/Plecos will keep this as optional
// allowing external pushes of assets without `additionalInformation`. // allowing external pushes of assets without `additionalInformation`.
// Making it optional here helps safeguarding against those assets. // Making it optional here helps safeguarding against those assets.
additionalInformation?: AdditionalInformationMarket additionalInformation?: AdditionalInformationMarket
} }
export interface PriceOptionsMarket extends PriceOptions { interface MetadataEditForm {
weightOnOcean: string name: string
// easier to keep this as number for Yup input validation description: string
swapFee: number timeout: string
} price?: number
links?: string | EditableMetadataLinks[]
export interface MetadataPublishFormDataset { author?: string
// ---- required fields ---- }
name: string
description: string
files: string | File[]
author: string
timeout: string
dataTokenOptions: DataTokenOptions
access: 'Download' | 'Compute' | string
termsAndConditions: boolean
// ---- optional fields ----
tags?: string
links?: string | EditableMetadataLinks[]
providerUri?: string
}
export interface MetadataPublishFormAlgorithm {
// ---- required fields ----
name: string
description: string
files: string | File[]
author: string
dockerImage: string
algorithmPrivacy: boolean
timeout: string
dataTokenOptions: DataTokenOptions
termsAndConditions: boolean
// ---- optional fields ----
image: string
containerTag: string
entrypoint: string
tags?: string
providerUri?: string
}
export interface MetadataEditForm {
name: string
description: string
timeout: string
price?: number
links?: string | EditableMetadataLinks[]
author?: string
}
export interface ServiceMetadataMarket extends ServiceMetadata {
attributes: MetadataMarket
} }

23
src/@types/Price.d.ts vendored Normal file
View File

@ -0,0 +1,23 @@
interface BestPrice {
type: 'pool' | 'exchange' | 'free' | ''
address: string
value: number
isConsumable?: 'true' | 'false' | ''
ocean?: number
oceanSymbol?: string
datatoken?: number
datatokenSymbol?: string
exchangeId?: string
pools: string[]
}
interface PriceOptions {
price: number
dtAmount: number
oceanAmount: number
type: 'fixed' | 'dynamic' | 'free' | string
weightOnDataToken: string
weightOnOcean: string
// easier to keep this as number for Yup input validation
swapFee: number
}

View File

@ -1,9 +1,9 @@
export interface ProfileLink { interface ProfileLink {
name: string name: string
value: string value: string
} }
export interface Profile { interface Profile {
did?: string did?: string
name?: string name?: string
accountEns?: string accountEns?: string
@ -13,7 +13,7 @@ export interface Profile {
links?: ProfileLink[] links?: ProfileLink[]
} }
export interface ResponseData3Box { interface ResponseData3Box {
name: string name: string
description: string description: string
website: string website: string

View File

@ -1,9 +1,9 @@
export interface PoolBalance { interface PoolBalance {
ocean: string ocean: string
datatoken: string datatoken: string
} }
export interface UserBalance { interface UserBalance {
eth: string eth: string
ocean: string ocean: string
} }

View File

@ -1,5 +1,5 @@
.actions { .actions {
composes: container from './AssetActions/Pool/index.module.css'; /* composes: container from './AssetActions/Pool/index.module.css'; */
border-top: 1px solid var(--border-color); border-top: 1px solid var(--border-color);
margin-top: calc(var(--spacer) / 1.5); margin-top: calc(var(--spacer) / 1.5);
padding: calc(var(--spacer) / 1.5); padding: calc(var(--spacer) / 1.5);
@ -12,7 +12,7 @@
} }
.title { .title {
composes: title from './AssetActions/Pool/index.module.css'; /* composes: title from './AssetActions/Pool/index.module.css'; */
margin-bottom: 0; margin-bottom: 0;
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -1,7 +1,7 @@
import React, { ReactElement, useState } from 'react' import React, { ReactElement, useState } from 'react'
import Button from '../atoms/Button' import Button from '@shared/atoms/Button'
import styles from './AssetActionHistoryTable.module.css' import styles from './AssetActionHistoryTable.module.css'
import { ReactComponent as Caret } from '../../images/caret.svg' import { ReactComponent as Caret } from '@images/caret.svg'
import { ReactNode } from 'react-markdown' import { ReactNode } from 'react-markdown'
export default function AssetActionHistoryTable({ export default function AssetActionHistoryTable({

View File

@ -1,5 +1,5 @@
.display { .display {
composes: selection from './FormFields/AssetSelection.module.css'; composes: selection from '@shared/Form/FormFields/AssetSelection.module.css';
} }
.display [class*='loaderWrap'] { .display [class*='loaderWrap'] {
@ -7,14 +7,14 @@
} }
.scroll { .scroll {
composes: scroll from './FormFields/AssetSelection.module.css'; composes: scroll from '@shared/Form/FormFields/AssetSelection.module.css';
margin-top: 0; margin-top: 0;
border-top: none; border-top: none;
width: 100%; width: 100%;
} }
.row { .row {
composes: row from './FormFields/AssetSelection.module.css'; composes: row from '@shared/Form/FormFields/AssetSelection.module.css';
} }
.row:last-child { .row:last-child {
@ -35,7 +35,7 @@
} }
.title { .title {
composes: title from './FormFields/AssetSelection.module.css'; composes: title from '@shared/Form/FormFields/AssetSelection.module.css';
} }
.hover:hover { .hover:hover {
@ -43,7 +43,7 @@
} }
.price { .price {
composes: price from './FormFields/AssetSelection.module.css'; composes: price from '@shared/Form/FormFields/AssetSelection.module.css';
} }
.price [class*='symbol'] { .price [class*='symbol'] {
@ -51,9 +51,9 @@
} }
.did { .did {
composes: did from './FormFields/AssetSelection.module.css'; composes: did from '@shared/Form/FormFields/AssetSelection.module.css';
} }
.empty { .empty {
composes: empty from './FormFields/AssetSelection.module.css'; composes: empty from '@shared/Form/FormFields/AssetSelection.module.css';
} }

View File

@ -1,10 +1,10 @@
import React from 'react' import React from 'react'
import Dotdotdot from 'react-dotdotdot' import Dotdotdot from 'react-dotdotdot'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import PriceUnit from '../atoms/Price/PriceUnit' import PriceUnit from '@shared/atoms/Price/PriceUnit'
import Loader from '../atoms/Loader' import Loader from '@shared/atoms/Loader'
import styles from './AssetComputeList.module.css' import styles from './AssetComputeList.module.css'
import { AssetSelectionAsset } from './FormFields/AssetSelection' import { AssetSelectionAsset } from '@shared/Form/FormFields/AssetSelection'
function Empty() { function Empty() {
return <div className={styles.empty}>No assets found.</div> return <div className={styles.empty}>No assets found.</div>

View File

@ -1,13 +1,13 @@
import AssetTeaser from '../molecules/AssetTeaser' import AssetTeaser from '@shared/AssetTeaser/AssetTeaser'
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import Pagination from '../molecules/Pagination' import Pagination from '@shared/Pagination'
import styles from './AssetList.module.css' import styles from './AssetList.module.css'
import { DDO } from '@oceanprotocol/lib' import { DDO } from '@oceanprotocol/lib'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import { getAssetsBestPrices, AssetListPrices } from '../../utils/subgraph' import { getAssetsBestPrices, AssetListPrices } from '../../../utils/subgraph'
import Loader from '../atoms/Loader' import Loader from '../atoms/Loader'
import { useUserPreferences } from '../../providers/UserPreferences' import { useUserPreferences } from '../../../context/UserPreferences'
import { useIsMounted } from '../../hooks/useIsMounted' import { useIsMounted } from '../../../hooks/useIsMounted'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -1,10 +1,10 @@
import { DDO } from '@oceanprotocol/lib' import { DDO } from '@oceanprotocol/lib'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import React, { ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import { getAssetsNames } from '../../utils/aquarius' import { getAssetsNames } from '../../../utils/aquarius'
import styles from './AssetListTitle.module.css' import styles from './AssetListTitle.module.css'
import axios from 'axios' import axios from 'axios'
import { useSiteMetadata } from '../../hooks/useSiteMetadata' import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
export default function AssetListTitle({ export default function AssetListTitle({
ddo, ddo,

View File

@ -8,7 +8,6 @@ import Publisher from '../atoms/Publisher'
import AssetType from '../atoms/AssetType' import AssetType from '../atoms/AssetType'
import NetworkName from '../atoms/NetworkName' import NetworkName from '../atoms/NetworkName'
import styles from './AssetTeaser.module.css' import styles from './AssetTeaser.module.css'
import { BestPrice } from '../../models/BestPrice'
declare type AssetTeaserProps = { declare type AssetTeaserProps = {
ddo: DDO ddo: DDO

View File

@ -1,8 +1,7 @@
import React, { ReactElement, useState, FormEvent, ChangeEvent } from 'react' import React, { ReactElement, useState, FormEvent, ChangeEvent } from 'react'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata' import { useSiteMetadata } from '@hooks/useSiteMetadata'
import Input from '../../atoms/Input' import Input from '@shared/Form/Input'
import Button from '../../atoms/Button' import Button from '@shared/atoms/Button'
import { FormContent, FormFieldProps } from '../../../@types/Form'
import { Field } from 'formik' import { Field } from 'formik'
import styles from './AdvancedSettings.module.css' import styles from './AdvancedSettings.module.css'

View File

@ -58,11 +58,11 @@
} }
.radio { .radio {
composes: radio from '../../atoms/Input/InputElement.module.css'; composes: radio from '@shared/Form/Input/InputElement.module.css';
} }
.checkbox { .checkbox {
composes: checkbox from '../../atoms/Input/InputElement.module.css'; composes: checkbox from '@shared/Form/Input/InputElement.module.css';
} }
.title { .title {

View File

@ -2,10 +2,10 @@ import React, { ChangeEvent, useState } from 'react'
import Dotdotdot from 'react-dotdotdot' import Dotdotdot from 'react-dotdotdot'
import slugify from 'slugify' import slugify from 'slugify'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import PriceUnit from '../../atoms/Price/PriceUnit' import PriceUnit from '@shared/atoms/Price/PriceUnit'
import { ReactComponent as External } from '../../../images/external.svg' import { ReactComponent as External } from '@images/external.svg'
import InputElement from '../../atoms/Input/InputElement' import InputElement from '@shared/Form/Input/InputElement'
import Loader from '../../atoms/Loader' import Loader from '@shared/atoms/Loader'
import styles from './AssetSelection.module.css' import styles from './AssetSelection.module.css'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -1,6 +1,6 @@
import React, { ChangeEvent } from 'react' import React, { ChangeEvent } from 'react'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import Loader from '../../atoms/Loader' import Loader from '@shared/atoms/Loader'
import styles from './BoxSelection.module.css' import styles from './BoxSelection.module.css'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -2,8 +2,8 @@ import React, { ReactElement, useState, useEffect } from 'react'
import { useField } from 'formik' import { useField } from 'formik'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import CustomInput from './URLInput/Input' import CustomInput from './URLInput/Input'
import { useOcean } from '../../../providers/Ocean' import { useOcean } from '../../../../context/Ocean'
import { InputProps } from '../../atoms/Input' import { InputProps } from '@shared/Form/Input'
export default function CustomProvider(props: InputProps): ReactElement { export default function CustomProvider(props: InputProps): ReactElement {
const [field, meta, helpers] = useField(props.name) const [field, meta, helpers] = useField(props.name)

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import styles from './RefreshName.module.css' import styles from './RefreshName.module.css'
import Button from '../../../atoms/Button' import Button from '@shared/atoms/Button'
import { ReactComponent as Refresh } from '../../../../images/refresh.svg' import { ReactComponent as Refresh } from '@images/refresh.svg'
export default function RefreshName({ export default function RefreshName({
generateName generateName

View File

@ -1,7 +1,7 @@
import { useField } from 'formik' import { useField } from 'formik'
import React, { ReactElement, useEffect } from 'react' import React, { ReactElement, useEffect } from 'react'
import { utils } from '@oceanprotocol/lib' import { utils } from '@oceanprotocol/lib'
import { InputProps } from '../../../atoms/Input' import { InputProps } from '@shared/Form/Input'
import RefreshName from './RefreshName' import RefreshName from './RefreshName'
import styles from './index.module.css' import styles from './index.module.css'

View File

@ -1,7 +1,7 @@
import React, { ReactElement, useEffect } from 'react' import React, { ReactElement, useEffect } from 'react'
import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File' import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File'
import { prettySize } from '../../../../utils' import { prettySize } from '@utils/index'
import cleanupContentType from '../../../../utils/cleanupContentType' import cleanupContentType from '@utils/cleanupContentType'
import styles from './Info.module.css' import styles from './Info.module.css'
import { useField, useFormikContext } from 'formik' import { useField, useFormikContext } from 'formik'

View File

@ -1,14 +1,13 @@
import React, { ReactElement, useState, useEffect } from 'react' import React, { ReactElement, useState, useEffect } from 'react'
import axios from 'axios'
import { useField } from 'formik' import { useField } from 'formik'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import FileInfo from './Info' import FileInfo from './Info'
import CustomInput from '../URLInput/Input' import CustomInput from '../URLInput/Input'
import { InputProps } from '../../../atoms/Input' import { InputProps } from '@shared/Form/Input'
import { fileinfo } from '../../../../utils/provider' import { fileinfo } from '@utils/provider'
import { useWeb3 } from '../../../../providers/Web3' import { useWeb3 } from '@context/Web3'
import { getOceanConfig } from '../../../../utils/ocean' import { getOceanConfig } from '@utils/ocean'
import { useCancelToken } from '../../../../hooks/useCancelToken' import { useCancelToken } from '@hooks/useCancelToken'
export default function FilesInput(props: InputProps): ReactElement { export default function FilesInput(props: InputProps): ReactElement {
const [field, meta, helpers] = useField(props.name) const [field, meta, helpers] = useField(props.name)

View File

@ -1,5 +1,5 @@
.terms { .terms {
composes: content from '../../templates/PageMarkdown.module.css'; composes: content from '@shared/Page/PageMarkdown.module.css';
padding: calc(var(--spacer) / 2); padding: calc(var(--spacer) / 2);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);

View File

@ -1,6 +1,6 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import { InputProps } from '../../atoms/Input' import { InputProps } from '@shared/Form/Input'
import InputElement from '../../atoms/Input/InputElement' import InputElement from '@shared/Form/Input/InputElement'
import styles from './Terms.module.css' import styles from './Terms.module.css'
import { graphql, useStaticQuery } from 'gatsby' import { graphql, useStaticQuery } from 'gatsby'

View File

@ -0,0 +1,3 @@
.input {
composes: input from '@shared/Form/Input/InputElement.module.css';
}

View File

@ -1,9 +1,9 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import Button from '../../../atoms/Button' import Button from '@shared/atoms/Button'
import { FieldInputProps, useField } from 'formik' import { FieldInputProps, useField } from 'formik'
import Loader from '../../../atoms/Loader' import Loader from '@shared/atoms/Loader'
import styles from './Input.module.css' import styles from './Input.module.css'
import InputGroup from '../../../atoms/Input/InputGroup' import InputGroup from '@shared/Form/Input/InputGroup'
export default function URLInput({ export default function URLInput({
submitText, submitText,

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import styles from './Disclaimer.module.css' import styles from './Disclaimer.module.css'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import Alert from '../Alert' import Alert from '@shared/atoms/Alert'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -1,6 +1,6 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import styles from './Help.module.css' import styles from './Help.module.css'
import Markdown from '../Markdown' import Markdown from '@shared/atoms/Markdown'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -2,18 +2,15 @@ import React, { ReactElement } from 'react'
import slugify from '@sindresorhus/slugify' import slugify from '@sindresorhus/slugify'
import styles from './InputElement.module.css' import styles from './InputElement.module.css'
import { InputProps } from '.' import { InputProps } from '.'
import FilesInput from '../../molecules/FormFields/FilesInput' import FilesInput from '../FormFields/FilesInput'
import CustomProvider from '../../molecules/FormFields/CustomProvider' import CustomProvider from '../FormFields/CustomProvider'
import Terms from '../../molecules/FormFields/Terms' import Terms from '../FormFields/Terms'
import BoxSelection, { import BoxSelection, { BoxSelectionOption } from '../FormFields/BoxSelection'
BoxSelectionOption import Datatoken from '../FormFields/Datatoken'
} from '../../molecules/FormFields/BoxSelection'
import Datatoken from '../../molecules/FormFields/Datatoken'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import AssetSelection, { import AssetSelection, {
AssetSelectionAsset AssetSelectionAsset
} from '../../molecules/FormFields/AssetSelection' } from '../FormFields/AssetSelection'
import Credentials from '../../molecules/FormFields/Credential'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)
@ -147,8 +144,6 @@ export default function InputElement({
{...props} {...props}
/> />
) )
case 'credentials':
return <Credentials name={name} {...field} {...props} />
default: default:
return prefix || postfix ? ( return prefix || postfix ? (
<div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}> <div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}>

View File

@ -1,6 +1,6 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import Markdown from '../atoms/Markdown' import Markdown from '@shared/atoms/Markdown'
import Tooltip from '../atoms/Tooltip' import Tooltip from '@shared/atoms/Tooltip'
import styles from './NumberUnit.module.css' import styles from './NumberUnit.module.css'
interface NumberUnitProps { interface NumberUnitProps {

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import styles from './PageHeader.module.css' import styles from './PageHeader.module.css'
import Markdown from '../atoms/Markdown' import Markdown from '@shared/atoms/Markdown'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -1,9 +1,9 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import { graphql, PageProps } from 'gatsby' import { graphql, PageProps } from 'gatsby'
import Page from './Page' import Page from '.'
import styles from './PageMarkdown.module.css' import styles from './PageMarkdown.module.css'
import Container from '../atoms/Container' import Container from '@shared/atoms/Container'
import PrivacyPolicyHeader from '../molecules/PrivacyHeader' import PrivacyPolicyHeader from '../../Privacy/PrivacyHeader'
export default function PageTemplateMarkdown(props: PageProps): ReactElement { export default function PageTemplateMarkdown(props: PageProps): ReactElement {
const { html, frontmatter, tableOfContents, fields } = (props.data as any) const { html, frontmatter, tableOfContents, fields } = (props.data as any)

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import { Helmet } from 'react-helmet' import { Helmet } from 'react-helmet'
import { useSiteMetadata } from '../../hooks/useSiteMetadata' import { useSiteMetadata } from '@hooks/useSiteMetadata'
import { isBrowser } from '../../utils' import { isBrowser } from '@utils/index'
export default function Seo({ export default function Seo({
title, title,

View File

@ -1,7 +1,7 @@
import React, { ReactNode, ReactElement } from 'react' import React, { ReactNode, ReactElement } from 'react'
import PageHeader from '../molecules/PageHeader' import PageHeader from './PageHeader'
import Seo from '../atoms/Seo' import Seo from './Seo'
import Container from '../atoms/Container' import Container from '@shared/atoms/Container'
export interface PageProps { export interface PageProps {
children: ReactNode children: ReactNode

View File

@ -1,8 +1,8 @@
import React, { useState, useEffect, ReactElement } from 'react' import React, { useState, useEffect, ReactElement } from 'react'
import ReactPaginate from 'react-paginate' import ReactPaginate from 'react-paginate'
import styles from './Pagination.module.css' import styles from './Pagination.module.css'
import { MAXIMUM_NUMBER_OF_PAGES_WITH_RESULTS } from '../../utils/aquarius' import { MAXIMUM_NUMBER_OF_PAGES_WITH_RESULTS } from '@utils/aquarius'
import { ReactComponent as Arrow } from '../../images/arrow.svg' import { ReactComponent as Arrow } from '@images/arrow.svg'
interface PaginationProps { interface PaginationProps {
totalPages?: number totalPages?: number

View File

@ -1,10 +1,10 @@
import React, { ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import { useWeb3 } from '../../providers/Web3' import { useWeb3 } from '@context/Web3'
import rbacRequest from '../../utils/rbac' import rbacRequest from '@utils/rbac'
import Alert from '../atoms/Alert' import Alert from '@shared/atoms/Alert'
import Loader from '../atoms/Loader' import Loader from '@shared/atoms/Loader'
import appConfig from '../../../app.config' import { useIsMounted } from '@hooks/useIsMounted'
import { useIsMounted } from '../../hooks/useIsMounted' import { useSiteMetadata } from '@hooks/useSiteMetadata'
export default function Permission({ export default function Permission({
eventType, eventType,
@ -13,15 +13,18 @@ export default function Permission({
eventType: string eventType: string
children: ReactElement children: ReactElement
}): ReactElement { }): ReactElement {
const url = appConfig.rbacUrl const { appConfig } = useSiteMetadata()
const url = appConfig?.rbacUrl
const [data, updateData] = useState<boolean | 'ERROR'>() const [data, updateData] = useState<boolean | 'ERROR'>()
const [errorMessage, updateError] = useState<string>() const [errorMessage, updateError] = useState<string>()
const [messageState, updateMessageState] = const [messageState, updateMessageState] =
useState<'error' | 'warning' | 'info' | 'success'>() useState<'error' | 'warning' | 'info' | 'success'>()
const { accountId } = useWeb3() const { accountId } = useWeb3()
const isMounted = useIsMounted() const isMounted = useIsMounted()
useEffect(() => { useEffect(() => {
if (url === undefined) return if (url === '') return
const controller = new AbortController() const controller = new AbortController()
const getData = async () => { const getData = async () => {
if (accountId === undefined) { if (accountId === undefined) {
@ -55,7 +58,7 @@ export default function Permission({
} }
}, [eventType, accountId, url, isMounted]) }, [eventType, accountId, url, isMounted])
if (url === undefined || data === true) { if (url === '' || data === true) {
return <>{children}</> return <>{children}</>
} }

View File

@ -1,8 +1,8 @@
import React, { useState, useEffect, ReactElement } from 'react' import React, { useState, useEffect, ReactElement } from 'react'
import { PoolTransaction } from '.' import { PoolTransaction } from '.'
import { useUserPreferences } from '../../../providers/UserPreferences' import { useUserPreferences } from '@context/UserPreferences'
import ExplorerLink from '../../atoms/ExplorerLink' import ExplorerLink from '@shared/atoms/ExplorerLink'
import { formatPrice } from '../../atoms/Price/PriceUnit' import { formatPrice } from '@shared/atoms/Price/PriceUnit'
import styles from './Title.module.css' import styles from './Title.module.css'
async function getTitle(row: PoolTransaction, locale: string) { async function getTitle(row: PoolTransaction, locale: string) {

View File

@ -1,15 +1,15 @@
import React, { ReactElement, useCallback, useEffect, useState } from 'react' import React, { ReactElement, useCallback, useEffect, useState } from 'react'
import Time from '../../atoms/Time' import Time from '@shared/atoms/Time'
import Table from '../../atoms/Table' import Table from '@shared/atoms/Table'
import AssetTitle from '../AssetListTitle' import AssetTitle from '@shared/AssetList/AssetListTitle'
import { useUserPreferences } from '../../../providers/UserPreferences' import { useUserPreferences } from '@context/UserPreferences'
import { gql } from 'urql' import { gql } from 'urql'
import { TransactionHistory_poolTransactions as TransactionHistoryPoolTransactions } from '../../../@types/apollo/TransactionHistory' import { TransactionHistory_poolTransactions as TransactionHistoryPoolTransactions } from '../../../@types/apollo/TransactionHistory'
import web3 from 'web3' import web3 from 'web3'
import { fetchDataForMultipleChains } from '../../../utils/subgraph' import { fetchDataForMultipleChains } from '@utils/subgraph'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata' import { useSiteMetadata } from '@hooks/useSiteMetadata'
import NetworkName from '../../atoms/NetworkName' import NetworkName from '@shared/atoms/NetworkName'
import { retrieveDDOListByDIDs } from '../../../utils/aquarius' import { retrieveDDOListByDIDs } from '@utils/aquarius'
import { CancelToken } from 'axios' import { CancelToken } from 'axios'
import Title from './Title' import Title from './Title'
import styles from './index.module.css' import styles from './index.module.css'

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import Tooltip from '../atoms/Tooltip' import Tooltip from '@shared/atoms/Tooltip'
import Status from '../atoms/Status' import Status from '@shared/atoms/Status'
import { useGraphSyncStatus } from '../../hooks/useGraphSyncStatus' import { useGraphSyncStatus } from '@hooks/useGraphSyncStatus'
import styles from './SyncStatus.module.css' import styles from './SyncStatus.module.css'
export default function SyncStatus(): ReactElement { export default function SyncStatus(): ReactElement {

View File

@ -1,14 +1,14 @@
import React, { ReactElement, useCallback, useEffect, useState } from 'react' import React, { ReactElement, useCallback, useEffect, useState } from 'react'
import Button from '../atoms/Button' import Button from '@shared/atoms/Button'
import { useOcean } from '../../providers/Ocean' import { useOcean } from '@context/Ocean'
import { useAsset } from '../../providers/Asset' import { useAsset } from '@context/Asset'
import Loader from '../atoms/Loader' import Loader from '@shared/atoms/Loader'
import { useWeb3 } from '../../providers/Web3' import { useWeb3 } from '@context/Web3'
import { useUserPreferences } from '../../providers/UserPreferences' import { useUserPreferences } from '@context/UserPreferences'
import Tooltip from '../atoms/Tooltip' import Tooltip from '@shared/atoms/Tooltip'
import { graphql, useStaticQuery } from 'gatsby' import { graphql, useStaticQuery } from 'gatsby'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
import { getOceanConfig } from '../../utils/ocean' import { getOceanConfig } from '@utils/ocean'
const query = graphql` const query = graphql`
query { query {

View File

@ -1,14 +1,14 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import { useWeb3 } from '../../providers/Web3' import { useWeb3 } from '@context/Web3'
import { import {
addCustomNetwork, addCustomNetwork,
getNetworkDisplayName, getNetworkDisplayName,
getNetworkDataById getNetworkDataById
} from '../../utils/web3' } from '@utils/web3'
import Button from '../atoms/Button' import Button from '@shared/atoms/Button'
import styles from './WalletNetworkSwitcher.module.css' import styles from './WalletNetworkSwitcher.module.css'
import useNetworkMetadata from '../../hooks/useNetworkMetadata' import useNetworkMetadata from '@hooks/useNetworkMetadata'
import { useAsset } from '../../providers/Asset' import { useAsset } from '@context/Asset'
export default function WalletNetworkSwitcher(): ReactElement { export default function WalletNetworkSwitcher(): ReactElement {
const { networkId, web3Provider } = useWeb3() const { networkId, web3Provider } = useWeb3()

View File

@ -1,9 +1,9 @@
import React, { ReactElement, useEffect, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import { useWeb3 } from '../../providers/Web3' import { useWeb3 } from '@context/Web3'
import Status from '../atoms/Status' import Status from '@shared/atoms/Status'
import styles from './Web3Feedback.module.css' import styles from './Web3Feedback.module.css'
import WalletNetworkSwitcher from './WalletNetworkSwitcher' import WalletNetworkSwitcher from './WalletNetworkSwitcher'
import { useGraphSyncStatus } from '../../hooks/useGraphSyncStatus' import { useGraphSyncStatus } from '@hooks/useGraphSyncStatus'
export declare type Web3Error = { export declare type Web3Error = {
status: 'error' | 'warning' | 'success' status: 'error' | 'warning' | 'success'

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import { addTokenToWallet } from '../../utils/web3' import { addTokenToWallet } from '@utils/web3'
import { useWeb3 } from '../../providers/Web3' import { useWeb3 } from '@context/Web3'
import Button from './Button' import Button from './Button'
import styles from './AddToken.module.css' import styles from './AddToken.module.css'

View File

@ -1,7 +1,7 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import Markdown from '../atoms/Markdown' import Markdown from './Markdown'
import Button from '../atoms/Button' import Button from './Button'
import styles from './AnnouncementBanner.module.css' import styles from './AnnouncementBanner.module.css'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

View File

@ -1,9 +1,9 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import styles from './AssetType.module.css' import styles from './AssetType.module.css'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import { ReactComponent as Compute } from '../../images/compute.svg' import { ReactComponent as Compute } from '@images/compute.svg'
import { ReactComponent as Download } from '../../images/download.svg' import { ReactComponent as Download } from '@images/download.svg'
import { ReactComponent as Lock } from '../../images/lock.svg' import { ReactComponent as Lock } from '@images/lock.svg'
const cx = classNames.bind(styles) const cx = classNames.bind(styles)

Some files were not shown because too many files have changed in this diff Show More