1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-02 16:25:37 +01:00

tinkering

This commit is contained in:
Matthias Kretschmann 2021-01-26 21:00:30 +01:00
parent 4cd18e945e
commit 5674d78974
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 10896 additions and 48 deletions

View File

@ -154,39 +154,7 @@ const createTypeDocPage = async (createPage, name, downloadUrl) => {
component: typedocTemplate, component: typedocTemplate,
context: { context: {
slug, slug,
typedoc: await typedoc.json(), typedoc: await typedoc.json()
// We define the classes here so the data object passed as page context
// is as small as possible.
// Caveat: no live update during development when these values are changed.
//
// TODO: defining these classes for inclusion
// needs to be handled somewhere else to keep
// it generic for all TypeDoc specs
classes: [
'ocean/Ocean',
'ocean/Account',
'ocean/Assets',
'ocean/Compute',
'ocean/Versions',
'ocean/DID',
'ddo/DDO',
'metadatacache/MetadataCache',
'metadatacache/OnChainMetaDataCache',
'provider/Provider',
'datatokens/Datatokens',
'datatokens/Network',
'datatokens/Web3Provider',
'balancer/OceanPool',
'balancer/Pool',
'balancer/PoolFactory',
'exchange/FixedRateExchange',
'models/Config',
'utils/ConfigHelper',
'utils/GasUtils',
'ocean/utils/OceanUtils',
'ocean/utils/WebServiceConnector',
'utils/Logger'
]
} }
}) })
} catch (error) { } catch (error) {

10883
ocean.js.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -201,7 +201,7 @@ PropertyWrapper.propTypes = {
const Entities = ({ entities, sourceUrl }) => const Entities = ({ entities, sourceUrl }) =>
entities.map(({ name, comment, children }) => ( entities.map(({ name, comment, children }) => (
<div key={shortid.generate()} id={name && slugify(name)}> <div key={name} id={name && slugify(name)}>
<h2 className={styles.entityName}> <h2 className={styles.entityName}>
<code>{name}</code> <code>{name}</code>
</h2> </h2>

View File

@ -4,7 +4,7 @@ import slugify from 'slugify'
import shortid from 'shortid' import shortid from 'shortid'
import Scrollspy from 'react-scrollspy' import Scrollspy from 'react-scrollspy'
import Scroll from '../../components/Scroll' import Scroll from '../../components/Scroll'
import { filterByKindOfProperty } from './utils' // import { filterByKindOfProperty } from './utils'
import stylesSidebar from '../../components/Sidebar.module.scss' import stylesSidebar from '../../components/Sidebar.module.scss'
export default class Toc extends PureComponent { export default class Toc extends PureComponent {
@ -14,13 +14,13 @@ export default class Toc extends PureComponent {
subItems = (children, parentName) => subItems = (children, parentName) =>
children && children &&
children.filter(filterByKindOfProperty).map(({ name, decorators }) => { children.map(({ name, decorators }) => {
const deprecation = (decorators || []).filter( const deprecation = (decorators || []).filter(
({ name }) => name === 'deprecated' ({ name }) => name === 'deprecated'
)[0] // Assuming deprecated annotation )[0] // Assuming deprecated annotation
return ( return (
<li key={shortid.generate()}> <li key={name}>
<Scroll <Scroll
type="id" type="id"
element={`${parentName}-${name && slugify(name)}`} element={`${parentName}-${name && slugify(name)}`}
@ -39,7 +39,7 @@ export default class Toc extends PureComponent {
subIds.push( subIds.push(
children && children &&
children.filter(filterByKindOfProperty).map(({ name }) => { children.map(({ name }) => {
return `${parentName}-${name && slugify(name)}` return `${parentName}-${name && slugify(name)}`
}) })
) )

View File

@ -8,13 +8,15 @@ import HeaderSection from '../../components/HeaderSection'
import Sidebar from '../../components/Sidebar' import Sidebar from '../../components/Sidebar'
import DocHeader from '../../components/DocHeader' import DocHeader from '../../components/DocHeader'
import Seo from '../../components/Seo' import Seo from '../../components/Seo'
import { cleanTypedocData } from './utils' // import { cleanTypedocData } from './utils'
import Entities from './Entities' import Entities from './Entities'
import Toc from './Toc' import Toc from './Toc'
import stylesDoc from '../Doc.module.scss' import stylesDoc from '../Doc.module.scss'
import typedocSpecMock from '../../../ocean.js.json'
export default class TypedocTemplate extends Component { export default class TypedocTemplate extends Component {
static propTypes = { static propTypes = {
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
@ -22,11 +24,6 @@ export default class TypedocTemplate extends Component {
pageContext: PropTypes.object.isRequired pageContext: PropTypes.object.isRequired
} }
typedocCleaned = cleanTypedocData(
this.props.pageContext.typedoc,
this.props.pageContext.classes
)
// output section title as defined in sections.yml // output section title as defined in sections.yml
sectionTitle = this.props.data.allSectionsYaml.edges.map(({ node }) => { sectionTitle = this.props.data.allSectionsYaml.edges.map(({ node }) => {
// compare section against section title from sections.yml // compare section against section title from sections.yml
@ -37,8 +34,8 @@ export default class TypedocTemplate extends Component {
render() { render() {
const { location, pageContext } = this.props const { location, pageContext } = this.props
const { typedoc } = pageContext // const { typedoc } = pageContext
const { info } = typedoc const { info } = typedocSpecMock
const { title, description, version, sourceUrl } = info const { title, description, version, sourceUrl } = info
return ( return (
@ -66,7 +63,7 @@ export default class TypedocTemplate extends Component {
sidebar="references" sidebar="references"
collapsed collapsed
toc toc
tocComponent={<Toc data={this.typedocCleaned} />} tocComponent={<Toc data={typedocSpecMock.children} />}
/> />
</aside> </aside>
<article className={stylesDoc.main}> <article className={stylesDoc.main}>
@ -77,7 +74,7 @@ export default class TypedocTemplate extends Component {
/> />
<Entities <Entities
entities={this.typedocCleaned} entities={typedocSpecMock.children}
sourceUrl={sourceUrl} sourceUrl={sourceUrl}
/> />
</article> </article>