mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Feature: Read the docs
This commit is contained in:
parent
4b0d805c2a
commit
96d459297b
@ -16,7 +16,7 @@
|
|||||||
- group: Aquarius Py Module
|
- group: Aquarius Py Module
|
||||||
items:
|
items:
|
||||||
- title: API Reference
|
- title: API Reference
|
||||||
link: /read-the-docs/aquarius/
|
link: /references/read-the-docs/aquarius/
|
||||||
|
|
||||||
- group: provider REST API
|
- group: provider REST API
|
||||||
items:
|
items:
|
||||||
@ -26,7 +26,7 @@
|
|||||||
- group: Provider Py Module
|
- group: Provider Py Module
|
||||||
items:
|
items:
|
||||||
- title: API Reference
|
- title: API Reference
|
||||||
link: /read-the-docs/provider/
|
link: /references/read-the-docs/provider/
|
||||||
|
|
||||||
- group: react
|
- group: react
|
||||||
items:
|
items:
|
||||||
@ -36,7 +36,7 @@
|
|||||||
- group: ocean.py
|
- group: ocean.py
|
||||||
items:
|
items:
|
||||||
- title: API Reference
|
- title: API Reference
|
||||||
link: /read-the-docs/ocean-py/
|
link: /references/read-the-docs/ocean-py/
|
||||||
|
|
||||||
- group: Smart Contracts
|
- group: Smart Contracts
|
||||||
items:
|
items:
|
||||||
@ -51,4 +51,4 @@
|
|||||||
- group: Ocean Subgraph
|
- group: Ocean Subgraph
|
||||||
items:
|
items:
|
||||||
- title: Readme References
|
- title: Readme References
|
||||||
link: /read-the-docs/ocean-subgraph/
|
link: /references/read-the-docs/ocean-subgraph/
|
||||||
|
@ -132,13 +132,12 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
await createSwaggerPages(createPage)
|
await createSwaggerPages(createPage)
|
||||||
|
|
||||||
// API: ocean.js
|
// API: ocean.js
|
||||||
const lastRelease =
|
const lastRelease = result.data.oceanJs.repository.releases.edges.filter(
|
||||||
result.data.oceanJs.repository.releases.edges.filter(
|
({ node }) =>
|
||||||
({ node }) =>
|
!node.isPrerelease &&
|
||||||
!node.isPrerelease &&
|
!node.isDraft &&
|
||||||
!node.isDraft &&
|
node.releaseAssets.edges.length > 0
|
||||||
node.releaseAssets.edges.length > 0
|
)[0].node.releaseAssets.edges[0].node
|
||||||
)[0].node.releaseAssets.edges[0].node
|
|
||||||
|
|
||||||
await createTypeDocPage(
|
await createTypeDocPage(
|
||||||
createPage,
|
createPage,
|
||||||
@ -266,13 +265,13 @@ const createReadTheDocsPage = async (createPage, name, list) => {
|
|||||||
'./src/templates/Markdown/MarkdownList.jsx'
|
'./src/templates/Markdown/MarkdownList.jsx'
|
||||||
)
|
)
|
||||||
createPage({
|
createPage({
|
||||||
path: `/read-the-docs/${name}`,
|
path: `/references/read-the-docs/${name}`,
|
||||||
matchPath: `/read-the-docs/${name}/*`,
|
matchPath: `/references/read-the-docs/${name}/*`,
|
||||||
component: markdownListTemplate,
|
component: markdownListTemplate,
|
||||||
context: {
|
context: {
|
||||||
markdownList: list,
|
markdownList: list,
|
||||||
name: name,
|
name: name,
|
||||||
baseUrl: `/read-the-docs/${name}`
|
baseUrl: `/references/read-the-docs/${name}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ export default class Sidebar extends Component {
|
|||||||
{sidebarfile.map((group, i) => (
|
{sidebarfile.map((group, i) => (
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
{collapsed ? (
|
{collapsed ? (
|
||||||
group.items.some((item) => item.link === location.pathname) ? (
|
group.items.some((item) => location.pathname.startsWith(item.link)) ? (
|
||||||
<SidebarGroup
|
<SidebarGroup
|
||||||
i={i}
|
i={i}
|
||||||
group={group}
|
group={group}
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import Layout from '../../components/Layout'
|
|
||||||
import HeaderSection from '../../components/HeaderSection'
|
|
||||||
import Content from '../../components/Content'
|
|
||||||
import styles from '../../templates/Doc.module.scss'
|
|
||||||
import MarkdownTemplate from '../MarkdownTemplate'
|
import MarkdownTemplate from '../MarkdownTemplate'
|
||||||
import sidebarStyles from '../../components/Sidebar.module.scss'
|
import sidebarStyles from '../../components/Sidebar.module.scss'
|
||||||
import moduleStyles from './Markdown.module.scss'
|
import moduleStyles from './Markdown.module.scss'
|
||||||
import { generatedNestedObject } from './utils'
|
import { generatedNestedObject } from './utils'
|
||||||
import { navigate } from 'gatsby'
|
import { navigate } from 'gatsby'
|
||||||
|
import ContentWrapperTemplate from '../ContentWrapperTemplate'
|
||||||
|
|
||||||
export default function MarkdownList({ location, pageContext }) {
|
export default function MarkdownList({ data, location, pageContext }) {
|
||||||
const flattenedModules = {}
|
const flattenedModules = {}
|
||||||
const nestedModules = {}
|
const nestedModules = {}
|
||||||
pageContext.markdownList.map(({ node }) => {
|
pageContext.markdownList.map(({ node }) => {
|
||||||
@ -63,13 +60,12 @@ export default function MarkdownList({ location, pageContext }) {
|
|||||||
|
|
||||||
const keys = Object.keys(nestedModules).sort()
|
const keys = Object.keys(nestedModules).sort()
|
||||||
const children = []
|
const children = []
|
||||||
if (title) {
|
if (title)
|
||||||
children.push(
|
children.push(
|
||||||
<li key={title}>
|
<li key={title}>
|
||||||
<b>{title}</b>
|
<b>{title}</b>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
keys.forEach((element) => {
|
keys.forEach((element) => {
|
||||||
children.push(
|
children.push(
|
||||||
@ -84,19 +80,23 @@ export default function MarkdownList({ location, pageContext }) {
|
|||||||
const nestedSidebarList = sidebarList(null, nestedModules)
|
const nestedSidebarList = sidebarList(null, nestedModules)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
<HeaderSection title={pageContext.name} />
|
<ContentWrapperTemplate
|
||||||
<Content>
|
data={data}
|
||||||
<main className={styles.wrapper}>
|
path={path}
|
||||||
<aside className={styles.sidebar}>
|
location={location}
|
||||||
<div className={sidebarStyles.sidebar}>{nestedSidebarList}</div>
|
slug={pageContext.baseUrl}
|
||||||
</aside>
|
info={{
|
||||||
<article className={styles.main}>
|
title: selectedModule.frontmatter.title,
|
||||||
<MarkdownTemplate data={selectedModule} />
|
description: null,
|
||||||
</article>
|
version: selectedModule.frontmatter.version
|
||||||
</main>
|
}}
|
||||||
</Content>
|
toc={nestedSidebarList}
|
||||||
</Layout>
|
>
|
||||||
|
<MarkdownTemplate data={selectedModule} />
|
||||||
|
|
||||||
|
</ContentWrapperTemplate>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,3 +104,19 @@ MarkdownList.propTypes = {
|
|||||||
pageContext: PropTypes.object.isRequired,
|
pageContext: PropTypes.object.isRequired,
|
||||||
location: PropTypes.object.isRequired
|
location: PropTypes.object.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const MarkdownListQuery = graphql`
|
||||||
|
query {
|
||||||
|
allSectionsYaml {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
link
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user