-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from us3r-network/scan-dev
Scan dev
Showing
12 changed files
with
1,772 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useCallback, useEffect, useState } from 'react' | ||
import { Network, Stream } from '../types' | ||
import { useCeramicCtx } from '../context/CeramicCtx' | ||
import { getStreamInfo } from '../api' | ||
import StreamTable from './StreamTable' | ||
import styled from 'styled-components' | ||
|
||
export default function DappSchemaInfo({ schema }: { schema: string }) { | ||
const [stream, setStream] = useState<Stream>() | ||
const { network } = useCeramicCtx() | ||
const [loading, setLoading] = useState(true) | ||
const loadSchemaInfo = useCallback(async () => { | ||
try { | ||
setLoading(true) | ||
const resp = await getStreamInfo(network, schema) | ||
setStream(resp.data.data) | ||
} catch (error) { | ||
console.log(error) | ||
} finally { | ||
setLoading(false) | ||
} | ||
}, [schema, network]) | ||
useEffect(() => { | ||
loadSchemaInfo() | ||
}, [loadSchemaInfo]) | ||
|
||
if (loading) return <LoadingBox>Loading...</LoadingBox> | ||
|
||
return ( | ||
<SchemaInfoContainer> | ||
{stream && <StreamTable data={stream} network={network as Network} />} | ||
</SchemaInfoContainer> | ||
) | ||
} | ||
|
||
const LoadingBox = styled.div` | ||
padding: 20px; | ||
text-align: center; | ||
color: gray; | ||
` | ||
|
||
const SchemaInfoContainer = styled.div` | ||
.name { | ||
font-size: initial !important; | ||
font-weight: initial !important; | ||
font-style: normal !important; | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.