Skip to content

Commit

Permalink
Merge pull request #303 from us3r-network/F-quickStartGuide-bufan
Browse files Browse the repository at this point in the history
F-quickStartGuide-bufan
  • Loading branch information
sin-bufan authored Feb 5, 2024
2 parents 4d20ad7 + e9ea3c6 commit dba5f4e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 50 deletions.
82 changes: 41 additions & 41 deletions packages/client/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { ProfileStateProvider } from '@us3r-network/profile'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import { useEffect, useState } from 'react'
import { Radio, RadioGroup } from 'react-aria-components'
// import { Radio, RadioGroup } from 'react-aria-components'
import {
NavLink,
// NavLink,
Outlet,
Route,
Routes,
Expand Down Expand Up @@ -171,25 +171,25 @@ function BuildLayout () {
const [selectModel, setSelectModel] = useState<ModelStream>()
const [selectComposite, setSelectComposite] = useState<DappCompositeDto>()
const { pathname } = useLocation()
const defaultKey = pathname.split('/build/')[1]
const PAGES = [
{
id: 'editor',
label: 'Editor'
},
{
id: 'playground',
label: 'Playground'
},
{
id: 'sdk',
label: 'SDK'
},
{
id: 'metrics',
label: 'Metrics'
}
]
// const defaultKey = pathname.split('/build/')[1]
// const PAGES = [
// {
// id: 'editor',
// label: 'Editor'
// },
// {
// id: 'playground',
// label: 'Playground'
// },
// {
// id: 'sdk',
// label: 'SDK'
// },
// {
// id: 'metrics',
// label: 'Metrics'
// }
// ]
return (
<LayoutContainer>
<DappModelAndComposites
Expand All @@ -212,7 +212,7 @@ function BuildLayout () {
selectComposite
}}
/>
<RadioGroup
{/* <RadioGroup
className='tabs'
aria-label='Build'
defaultValue={defaultKey}
Expand All @@ -222,33 +222,33 @@ function BuildLayout () {
<NavLink to={page.id}>{page.label}</NavLink>
</Radio>
))}
</RadioGroup>
</RadioGroup> */}
</div>
</LayoutContainer>
)
}

function ExploreLayout () {
const { pathname } = useLocation()
const defaultKey = pathname.split('/explore/')[1]
const PAGES = [
{
id: 'model',
label: 'Models'
},
{
id: 'composite',
label: 'Composites'
},
{
id: 'components',
label: 'Components'
}
]
// const { pathname } = useLocation()
// const defaultKey = pathname.split('/explore/')[1]
// const PAGES = [
// {
// id: 'model',
// label: 'Models'
// },
// {
// id: 'composite',
// label: 'Composites'
// },
// {
// id: 'components',
// label: 'Components'
// }
// ]
return (
<LayoutContainer>
<Outlet />
<RadioGroup
{/* <RadioGroup
className='tabs'
aria-label='Explore'
defaultValue={defaultKey}
Expand All @@ -258,7 +258,7 @@ function ExploreLayout () {
<NavLink to={page.id}>{page.label}</NavLink>
</Radio>
))}
</RadioGroup>
</RadioGroup> */}
</LayoutContainer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ import { useEffect, useState } from 'react'
import styled from 'styled-components'
import { useCeramicNodeCtx } from '../../context/CeramicNodeCtx'
import { getRuntimeDefinitionFromEncodedComposite } from '../../utils/composeDBUtils'
import { schemas } from '../../utils/composedb-types/schemas'
import CodeDownload from './CodeDownload'

export default function CompositeEditor ({
schema,
library,
encodedDefinition
}: {
schema?: string
library?: string
encodedDefinition: string
}) {
const { currCeramicNode } = useCeramicNodeCtx()
const [gqlSchema, setGqlSchema] = useState<PassedSchema>({
code: schema || '',
libraries: schemas.library
libraries: library || ''
})

const [runtimeDefinition, setRuntimeDefinition] = useState<RuntimeCompositeDefinition|null>(null)
Expand All @@ -39,9 +40,9 @@ export default function CompositeEditor ({
useEffect(() => {
setGqlSchema({
code: schema || '',
libraries: schemas.library
libraries: library || ''
})
}, [schema])
}, [library, schema])

return (
<Box>
Expand Down
1 change: 1 addition & 0 deletions packages/client/dashboard/src/container/DappEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function DappEditor () {
<div className='content-box'>
<CompositeEditor
schema={selectComposite.graphql}
library={schemas.library}
encodedDefinition={JSON.parse(selectComposite.composite)}
/>
</div>
Expand Down
10 changes: 5 additions & 5 deletions packages/client/dashboard/src/utils/composedb-types/scalars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ export const extraScalars: Record<string, ScalarWithTitle> = {
...getGraphQLScalarSchema<JSONSchema.String>('date'),
maxLength: 100,
},
// DateTime: {
// ...getGraphQLScalarSchema<JSONSchema.String>('datetime'),
// maxLength: 100,
// },
DateTime: {
...getGraphQLScalarSchema<JSONSchema.String>('datetime'),
maxLength: 100,
},
DID: { ...getGraphQLScalarSchema<JSONSchema.String>('did'), maxLength: 100 },
Latitude: getGraphQLScalarSchema('latitude'),
LocalDate: {
Expand All @@ -126,7 +126,7 @@ export const extraScalars: Record<string, ScalarWithTitle> = {
...getGraphQLScalarSchema<JSONSchema.String>('timezone'),
maxLength: 100,
},
// URI: { ...getGraphQLScalarSchema<JSONSchema.String>('uri'), maxLength: 100 },
URI: { ...getGraphQLScalarSchema<JSONSchema.String>('uri'), maxLength: 100 },
UTCOffset: {
...getGraphQLScalarSchema<JSONSchema.String>('utcoffset'),
maxLength: 100,
Expand Down

0 comments on commit dba5f4e

Please sign in to comment.