{
onFocus={this.toggleFocus}
onBlur={this.toggleFocus}
onChange={onChange}
+ value={value}
>
{options &&
- options.map((option: string, index: number) => (
-
- ))}
+ options
+ .sort((a, b) => a.localeCompare(b))
+ .map((option: string, index: number) => (
+
+ ))}
)
diff --git a/src/components/atoms/Form/InputGroup.module.scss b/client/src/components/atoms/Form/InputGroup.module.scss
similarity index 100%
rename from src/components/atoms/Form/InputGroup.module.scss
rename to client/src/components/atoms/Form/InputGroup.module.scss
diff --git a/src/components/atoms/Form/InputGroup.tsx b/client/src/components/atoms/Form/InputGroup.tsx
similarity index 100%
rename from src/components/atoms/Form/InputGroup.tsx
rename to client/src/components/atoms/Form/InputGroup.tsx
diff --git a/src/components/atoms/Form/Label.module.scss b/client/src/components/atoms/Form/Label.module.scss
similarity index 100%
rename from src/components/atoms/Form/Label.module.scss
rename to client/src/components/atoms/Form/Label.module.scss
diff --git a/src/components/atoms/Form/Label.tsx b/client/src/components/atoms/Form/Label.tsx
similarity index 100%
rename from src/components/atoms/Form/Label.tsx
rename to client/src/components/atoms/Form/Label.tsx
diff --git a/src/components/atoms/Form/Row.module.scss b/client/src/components/atoms/Form/Row.module.scss
similarity index 100%
rename from src/components/atoms/Form/Row.module.scss
rename to client/src/components/atoms/Form/Row.module.scss
diff --git a/src/components/atoms/Form/Row.tsx b/client/src/components/atoms/Form/Row.tsx
similarity index 100%
rename from src/components/atoms/Form/Row.tsx
rename to client/src/components/atoms/Form/Row.tsx
diff --git a/src/components/atoms/Spinner.module.scss b/client/src/components/atoms/Spinner.module.scss
similarity index 90%
rename from src/components/atoms/Spinner.module.scss
rename to client/src/components/atoms/Spinner.module.scss
index 78992c6..f26db14 100644
--- a/src/components/atoms/Spinner.module.scss
+++ b/client/src/components/atoms/Spinner.module.scss
@@ -3,6 +3,7 @@
.spinner {
position: relative;
text-align: center;
+ margin-top: $spacer * $line-height;
margin-bottom: $spacer / 2;
&:before {
@@ -13,7 +14,7 @@
left: 50%;
width: 20px;
height: 20px;
- margin-top: -10px;
+ margin-top: -20px;
margin-left: -10px;
border-radius: 50%;
border: 2px solid $brand-purple;
@@ -24,7 +25,6 @@
.spinnerMessage {
color: $brand-grey-light;
- margin-top: $spacer / 2;
}
@keyframes spinner {
diff --git a/src/components/atoms/Spinner.tsx b/client/src/components/atoms/Spinner.tsx
similarity index 100%
rename from src/components/atoms/Spinner.tsx
rename to client/src/components/atoms/Spinner.tsx
diff --git a/client/src/components/molecules/AccountStatus/Indicator.module.scss b/client/src/components/molecules/AccountStatus/Indicator.module.scss
new file mode 100644
index 0000000..7d82117
--- /dev/null
+++ b/client/src/components/molecules/AccountStatus/Indicator.module.scss
@@ -0,0 +1,33 @@
+@import '../../../styles/variables';
+
+.status {
+ display: inline-block;
+ position: relative;
+ cursor: help;
+}
+
+// default: red square
+.statusIndicator {
+ width: $font-size-small;
+ height: $font-size-small;
+ display: block;
+ background: $red;
+}
+
+// yellow triangle
+.statusIndicatorCloseEnough {
+ composes: statusIndicator;
+ background: none;
+ width: 0;
+ height: 0;
+ border-left: $font-size-small / 1.7 solid transparent;
+ border-right: $font-size-small / 1.7 solid transparent;
+ border-bottom: $font-size-small solid $yellow;
+}
+
+// green circle
+.statusIndicatorActive {
+ composes: statusIndicator;
+ border-radius: 50%;
+ background: $green;
+}
diff --git a/client/src/components/molecules/AccountStatus/Indicator.tsx b/client/src/components/molecules/AccountStatus/Indicator.tsx
new file mode 100644
index 0000000..8deeacb
--- /dev/null
+++ b/client/src/components/molecules/AccountStatus/Indicator.tsx
@@ -0,0 +1,35 @@
+import React from 'react'
+import cx from 'classnames'
+import { User } from '../../../context/User'
+import styles from './Indicator.module.scss'
+
+const Indicator = ({
+ className,
+ togglePopover,
+ forwardedRef
+}: {
+ className?: string
+ togglePopover: () => void
+ forwardedRef: (ref: HTMLElement | null) => void
+}) => (
+
+
+ {states =>
+ !states.isWeb3 ? (
+
+ ) : !states.isLogged ? (
+
+ ) : states.isLogged ? (
+
+ ) : null
+ }
+
+
+)
+
+export default Indicator
diff --git a/client/src/components/molecules/AccountStatus/Popover.module.scss b/client/src/components/molecules/AccountStatus/Popover.module.scss
new file mode 100644
index 0000000..0860ed9
--- /dev/null
+++ b/client/src/components/molecules/AccountStatus/Popover.module.scss
@@ -0,0 +1,62 @@
+@import '../../../styles/variables';
+
+$popoverWidth: 18rem;
+
+.popover {
+ position: relative;
+ width: $popoverWidth;
+ padding: $spacer / 2;
+ background: $brand-black;
+ border-radius: .1rem;
+ border: .1rem solid $brand-grey-light;
+ box-shadow: 0 6px 16px 0 rgba($brand-black, .3);
+ color: $brand-grey-light;
+ font-size: $font-size-small;
+ animation: showPopup .2s ease-in forwards;
+}
+
+@keyframes showPopup {
+ from {
+ opacity: 0;
+ }
+
+ to {
+ opacity: 1;
+ }
+}
+
+.popoverInfoline {
+ border-bottom: .05rem solid $brand-grey;
+ padding: $spacer / 3 0;
+
+ &:first-child {
+ padding-top: 0;
+ }
+
+ &:last-child {
+ padding-bottom: 0;
+ border-bottom: 0;
+ }
+
+ button {
+ font-size: $font-size-small;
+ }
+}
+
+.address {
+ width: 15rem;
+ display: block;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.balance {
+ font-size: $font-size-small;
+ margin-left: $spacer / 2;
+ white-space: nowrap;
+
+ &:first-child {
+ margin-left: 0;
+ }
+}
diff --git a/client/src/components/molecules/AccountStatus/Popover.tsx b/client/src/components/molecules/AccountStatus/Popover.tsx
new file mode 100644
index 0000000..e8c3541
--- /dev/null
+++ b/client/src/components/molecules/AccountStatus/Popover.tsx
@@ -0,0 +1,59 @@
+import React from 'react'
+import { User } from '../../../context/User'
+import styles from './Popover.module.scss'
+
+const Popover = ({
+ forwardedRef,
+ style
+}: {
+ forwardedRef: (ref: HTMLElement | null) => void
+ style: React.CSSProperties
+}) => (
+
+
+ {states =>
+ states.account &&
+ states.balance && (
+
+
+
+ {(states.balance.eth / 1e18)
+ .toFixed(3)
+ .slice(0, -1)}
+ {' '}
+ ETH
+
+
+ {states.balance.ocn} OCEAN
+
+
+ )
+ }
+
+
+
+
+ {states =>
+ states.account ? (
+
+ {states.account}
+
+ ) : (
+ No account selected
+ )
+ }
+
+
+
+
+
+ {states => states.network && states.network}
+
+
+
+)
+
+export default Popover
diff --git a/client/src/components/molecules/AccountStatus/index.tsx b/client/src/components/molecules/AccountStatus/index.tsx
new file mode 100644
index 0000000..8c420bb
--- /dev/null
+++ b/client/src/components/molecules/AccountStatus/index.tsx
@@ -0,0 +1,54 @@
+import React, { PureComponent } from 'react'
+import { Manager, Reference, Popper } from 'react-popper'
+import AccountPopover from './Popover'
+import AccountIndicator from './Indicator'
+
+interface AccountStatusProps {
+ className?: string
+}
+
+interface AccountStatusState {
+ isPopoverOpen: boolean
+}
+
+export default class AccountStatus extends PureComponent<
+ AccountStatusProps,
+ AccountStatusState
+> {
+ public state = {
+ isPopoverOpen: false
+ }
+
+ public togglePopover() {
+ this.setState(prevState => ({
+ isPopoverOpen: !prevState.isPopoverOpen
+ }))
+ }
+
+ public render() {
+ return (
+
+
+ {({ ref }) => (
+ this.togglePopover()}
+ className={this.props.className}
+ forwardedRef={ref}
+ />
+ )}
+
+ {this.state.isPopoverOpen && (
+
+ {({ ref, style, placement }) => (
+
+ )}
+
+ )}
+
+ )
+ }
+}
diff --git a/src/components/molecules/Asset.module.scss b/client/src/components/molecules/Asset.module.scss
similarity index 100%
rename from src/components/molecules/Asset.module.scss
rename to client/src/components/molecules/Asset.module.scss
diff --git a/src/components/molecules/Asset.tsx b/client/src/components/molecules/Asset.tsx
similarity index 100%
rename from src/components/molecules/Asset.tsx
rename to client/src/components/molecules/Asset.tsx
diff --git a/src/components/molecules/AssetsUser.module.scss b/client/src/components/molecules/AssetsUser.module.scss
similarity index 100%
rename from src/components/molecules/AssetsUser.module.scss
rename to client/src/components/molecules/AssetsUser.module.scss
diff --git a/src/components/molecules/AssetsUser.tsx b/client/src/components/molecules/AssetsUser.tsx
similarity index 55%
rename from src/components/molecules/AssetsUser.tsx
rename to client/src/components/molecules/AssetsUser.tsx
index 7fb829a..0ce6039 100644
--- a/src/components/molecules/AssetsUser.tsx
+++ b/client/src/components/molecules/AssetsUser.tsx
@@ -1,8 +1,10 @@
import React, { PureComponent } from 'react'
import { Link } from 'react-router-dom'
+import { User } from '../../context/User'
import Spinner from '../atoms/Spinner'
import Asset from '../molecules/Asset'
import styles from './AssetsUser.module.scss'
+import { Logger } from '@oceanprotocol/squid'
export default class AssetsUser extends PureComponent {
public state = { results: [], isLoading: true }
@@ -12,23 +14,29 @@ export default class AssetsUser extends PureComponent {
}
private async searchOcean() {
- const queryRequest: any = {
- offset: 100,
- page: 0,
- query: {
- // TODO: query all assets published by current active account
- $text: {
- $search: 'zoid'
+ this.context.ocean.keeper.didRegistry.contract.getPastEvents(
+ 'DIDAttributeRegistered',
+ {
+ filter: { _owner: this.context.account },
+ fromBlock: 0,
+ toBlock: 'latest'
+ },
+ async (error: any, events: any) => {
+ if (error) {
+ Logger.log('error retrieving', error)
+ this.setState({ isLoading: false })
+ } else {
+ const results = []
+ for (const event of events) {
+ const ddo = await this.context.ocean.resolveDID(
+ `did:op:${event.returnValues._did.substring(2)}`
+ )
+ results.push(ddo)
+ }
+ this.setState({ results, isLoading: false })
}
}
- }
-
- try {
- const assets = await this.context.ocean.searchAssets(queryRequest)
- this.setState({ results: assets, isLoading: false })
- } catch (error) {
- this.setState({ isLoading: false })
- }
+ )
}
public render() {
@@ -54,3 +62,5 @@ export default class AssetsUser extends PureComponent {
)
}
}
+
+AssetsUser.contextType = User
diff --git a/client/src/components/molecules/Web3message.module.scss b/client/src/components/molecules/Web3message.module.scss
new file mode 100644
index 0000000..5ff7574
--- /dev/null
+++ b/client/src/components/molecules/Web3message.module.scss
@@ -0,0 +1,23 @@
+@import '../../styles/variables';
+
+.message {
+ margin-bottom: $spacer;
+ color: $brand-grey;
+ padding-left: 2rem;
+ position: relative;
+ border-bottom: .1rem solid $brand-grey-lighter;
+ border-top: .1rem solid $brand-grey-lighter;
+ padding-top: $spacer / 2;
+ padding-bottom: $spacer / 2;
+}
+
+.account {
+ display: inline-block;
+ margin-left: $spacer / 8;
+ background: none;
+}
+
+.status {
+ margin-left: -($spacer);
+ margin-right: $spacer / 3;
+}
diff --git a/client/src/components/molecules/Web3message.tsx b/client/src/components/molecules/Web3message.tsx
new file mode 100644
index 0000000..94ca7dc
--- /dev/null
+++ b/client/src/components/molecules/Web3message.tsx
@@ -0,0 +1,60 @@
+import React, { PureComponent } from 'react'
+import Button from '../atoms/Button'
+import AccountStatus from './AccountStatus/'
+import styles from './Web3message.module.scss'
+import { User } from '../../context/User'
+
+export default class Web3message extends PureComponent {
+ public render() {
+ return (
+
+ {states =>
+ !states.isWeb3
+ ? this.noWeb3()
+ : !states.isLogged
+ ? this.unlockAccount(states)
+ : states.isLogged
+ ? this.haveAccount(states.account)
+ : null
+ }
+
+ )
+ }
+
+ public noWeb3() {
+ return (
+
+
No Web3 Browser. For
+ publishing an asset you need to{' '}
+
+ setup MetaMask
+ {' '}
+ or use any other Web3-capable plugin or browser.
+
+ )
+ }
+
+ public unlockAccount(states: any) {
+ return (
+
+
Account locked. For
+ publishing an asset you need to unlock your Web3 account.
+
+
+ )
+ }
+
+ public haveAccount(account: string) {
+ return (
+
+
Connected with
+ account
+
+ {`${account && account.substring(0, 20)}...`}
+
+
+ )
+ }
+}
diff --git a/src/components/templates/Route.module.scss b/client/src/components/templates/Route.module.scss
similarity index 100%
rename from src/components/templates/Route.module.scss
rename to client/src/components/templates/Route.module.scss
diff --git a/src/components/templates/Route.tsx b/client/src/components/templates/Route.tsx
similarity index 100%
rename from src/components/templates/Route.tsx
rename to client/src/components/templates/Route.tsx
diff --git a/src/config.ts b/client/src/config.ts
similarity index 76%
rename from src/config.ts
rename to client/src/config.ts
index d06e67e..d5ddcb6 100644
--- a/src/config.ts
+++ b/client/src/config.ts
@@ -1,3 +1,7 @@
+export const serviceScheme = 'http'
+export const serviceHost = 'localhost'
+export const servicePort = 4000
+
export const nodeScheme = 'http'
export const nodeHost = 'localhost'
export const nodePort = 8545
@@ -22,4 +26,8 @@ export const threshold = 0
export const password = 'node0'
export const address = '0x00bd138abd70e2f00903268f3db08f2d25677c9e'
+export const faucetScheme = 'http'
+export const faucetHost = 'localhost'
+export const faucetPort = 3001
+
export const verbose = true
diff --git a/src/context/User.ts b/client/src/context/User.ts
similarity index 64%
rename from src/context/User.ts
rename to client/src/context/User.ts
index 3b64219..6a36c98 100644
--- a/src/context/User.ts
+++ b/client/src/context/User.ts
@@ -7,7 +7,15 @@ export const User = React.createContext({
account: '',
web3: {},
ocean: {},
+ balance: {
+ eth: 0,
+ ocn: 0
+ },
+ network: '',
startLogin: () => {
/* empty */
+ },
+ requestFromFaucet: () => {
+ /* empty */
}
})
diff --git a/client/src/data/form-publish.json b/client/src/data/form-publish.json
new file mode 100644
index 0000000..588ed38
--- /dev/null
+++ b/client/src/data/form-publish.json
@@ -0,0 +1,114 @@
+{
+ "steps": [
+ {
+ "title": "Essentials",
+ "description": "Start by adding a title and URLs for your data set.",
+ "fields": {
+ "name": {
+ "label": "Title",
+ "placeholder": "i.e. Almond sales data",
+ "type": "text",
+ "required": true,
+ "help": "Enter a concise title. You will be able to enter a more thorough description in the next step."
+ },
+ "files": {
+ "label": "Files",
+ "placeholder": "i.e. https://file.com/file.json",
+ "type": "text",
+ "required": true,
+ "help": "Provide one or multiple urls to your data set files."
+ }
+ }
+ },
+ {
+ "title": "Information",
+ "description": "Further describe and categorize your data set to help people discover it.",
+ "fields": {
+ "description": {
+ "label": "Description",
+ "description": "Add a thorough description with as much detail as possible.",
+ "placeholder": "i.e. Almond sales data ",
+ "type": "textarea",
+ "required": true,
+ "rows": 5
+ },
+ "categories": {
+ "label": "Categories",
+ "description": "Pick a category which best fits your data set.",
+ "type": "select",
+ "required": true,
+ "options": [
+ "Image Recognition",
+ "Dataset Of Datasets",
+ "Language",
+ "Performing Arts",
+ "Visual Arts & Design",
+ "Philosophy",
+ "History",
+ "Theology",
+ "Anthropology & Archeology",
+ "Sociology",
+ "Psychology",
+ "Politics",
+ "Interdisciplinary",
+ "Economics & Finance",
+ "Demography",
+ "Biology",
+ "Chemistry",
+ "Physics & Energy",
+ "Earth & Climate",
+ "Space & Astronomy",
+ "Mathematics",
+ "Computer Technology",
+ "Engineering",
+ "Agriculture & Bio Engineering",
+ "Transportation",
+ "Urban Planning",
+ "Medicine",
+ "Business & Management",
+ "Sports & Recreation",
+ "Communication & Journalism",
+ "Other"
+ ]
+ }
+ }
+ },
+ {
+ "title": "Authorship",
+ "description": "Give proper attribution for your data set.",
+ "fields": {
+ "author": {
+ "label": "Author",
+ "placeholder": "i.e. Jelly McJellyfish",
+ "type": "text",
+ "required": true
+ },
+ "copyrightHolder": {
+ "label": "Copyright Holder",
+ "placeholder": "i.e. Marine Institute of Jellyfish",
+ "type": "text",
+ "required": true
+ },
+ "license": {
+ "label": "License",
+ "type": "select",
+ "required": true,
+ "options": [
+ "Public Domain",
+ "CC BY: Attribution",
+ "CC BY-SA: Attribution ShareAlike",
+ "CC BY-ND: Attribution-NoDerivs",
+ "CC BY-NC: Attribution-NonCommercial",
+ "CC BY-NC-SA: Attribution-NonCommercial-ShareAlike",
+ "CC BY-NC-ND: Attribution-NonCommercial-NoDerivs"
+ ]
+ }
+ }
+ },
+ {
+ "title": "Register",
+ "description": "Splendid, we got all the data. Now let's register your data set.",
+ "content": "After clicking the button below you will be asked by your wallet to sign this request."
+ }
+ ]
+}
diff --git a/src/data/form-styleguide.json b/client/src/data/form-styleguide.json
similarity index 100%
rename from src/data/form-styleguide.json
rename to client/src/data/form-styleguide.json
diff --git a/src/data/menu.json b/client/src/data/menu.json
similarity index 60%
rename from src/data/menu.json
rename to client/src/data/menu.json
index 5dc0a19..9169df2 100644
--- a/src/data/menu.json
+++ b/client/src/data/menu.json
@@ -3,6 +3,14 @@
"title": "Publish",
"link": "/publish"
},
+ {
+ "title": "Invoices",
+ "link": "/invoices"
+ },
+ {
+ "title": "Faucet",
+ "link": "/faucet"
+ },
{
"title": "About",
"link": "/about"
diff --git a/src/data/meta.json b/client/src/data/meta.json
similarity index 100%
rename from src/data/meta.json
rename to client/src/data/meta.json
diff --git a/src/img/search.svg b/client/src/img/search.svg
similarity index 100%
rename from src/img/search.svg
rename to client/src/img/search.svg
diff --git a/src/index.tsx b/client/src/index.tsx
similarity index 100%
rename from src/index.tsx
rename to client/src/index.tsx
diff --git a/src/models/AssetModel.ts b/client/src/models/AssetModel.ts
similarity index 100%
rename from src/models/AssetModel.ts
rename to client/src/models/AssetModel.ts
diff --git a/src/ocean.ts b/client/src/ocean.ts
similarity index 100%
rename from src/ocean.ts
rename to client/src/ocean.ts
diff --git a/src/react-app-env.d.ts b/client/src/react-app-env.d.ts
similarity index 100%
rename from src/react-app-env.d.ts
rename to client/src/react-app-env.d.ts
diff --git a/src/routes/About.tsx b/client/src/routes/About.tsx
similarity index 100%
rename from src/routes/About.tsx
rename to client/src/routes/About.tsx
diff --git a/src/routes/Details/AssetDetails.module.scss b/client/src/routes/Details/AssetDetails.module.scss
similarity index 100%
rename from src/routes/Details/AssetDetails.module.scss
rename to client/src/routes/Details/AssetDetails.module.scss
diff --git a/src/routes/Details/AssetDetails.tsx b/client/src/routes/Details/AssetDetails.tsx
similarity index 100%
rename from src/routes/Details/AssetDetails.tsx
rename to client/src/routes/Details/AssetDetails.tsx
diff --git a/src/routes/Details/index.tsx b/client/src/routes/Details/index.tsx
similarity index 100%
rename from src/routes/Details/index.tsx
rename to client/src/routes/Details/index.tsx
diff --git a/client/src/routes/Faucet.module.scss b/client/src/routes/Faucet.module.scss
new file mode 100644
index 0000000..4ec11b4
--- /dev/null
+++ b/client/src/routes/Faucet.module.scss
@@ -0,0 +1,15 @@
+@import '../styles/variables';
+
+.action {
+ text-align: center;
+ margin-top: $spacer * 2;
+
+ p {
+ margin-top: $spacer;
+ color: $brand-grey-light;
+ }
+}
+
+.success {
+ color: $green;
+}
diff --git a/client/src/routes/Faucet.tsx b/client/src/routes/Faucet.tsx
new file mode 100644
index 0000000..51f9404
--- /dev/null
+++ b/client/src/routes/Faucet.tsx
@@ -0,0 +1,96 @@
+import React, { PureComponent } from 'react'
+import Route from '../components/templates/Route'
+import Button from '../components/atoms/Button'
+import Spinner from '../components/atoms/Spinner'
+import { User } from '../context/User'
+import Web3message from '../components/molecules/Web3message'
+import styles from './Faucet.module.scss'
+
+interface FaucetState {
+ isLoading: boolean
+ success?: string
+ error?: string
+ eth?: string
+}
+
+export default class Faucet extends PureComponent<{}, FaucetState> {
+ public state = {
+ isLoading: false,
+ success: undefined,
+ error: undefined,
+ eth: 'xx'
+ }
+
+ private getTokens = async (requestFromFaucet: () => void) => {
+ this.setState({ isLoading: true })
+
+ try {
+ await requestFromFaucet()
+ this.setState({
+ isLoading: false,
+ success: `Successfully added ${
+ this.state.eth
+ } ETH to your account.`
+ })
+ } catch (error) {
+ this.setState({ isLoading: false, error })
+ }
+ }
+
+ private RequestMarkup = () => (
+
+ {states => (
+
+ )}
+
+ )
+
+ private ActionMarkup = () => (
+
+ {this.state.isLoading ? (
+
+ ) : this.state.error ? (
+
+ {this.state.error}{' '}
+
+
+ ) : this.state.success ? (
+
{this.state.success}
+ ) : (
+
+ )}
+
+
+ You can only request Ether once every 24 hours for your address.
+
+
+ )
+
+ private reset = () => {
+ this.setState({
+ error: undefined,
+ success: undefined,
+ isLoading: false
+ })
+ }
+
+ public render() {
+ return (
+
+
+
+
+
+ )
+ }
+}
diff --git a/src/routes/Home.module.scss b/client/src/routes/Home.module.scss
similarity index 100%
rename from src/routes/Home.module.scss
rename to client/src/routes/Home.module.scss
diff --git a/src/routes/Home.tsx b/client/src/routes/Home.tsx
similarity index 82%
rename from src/routes/Home.tsx
rename to client/src/routes/Home.tsx
index 2e6fc8a..3f7885c 100644
--- a/src/routes/Home.tsx
+++ b/client/src/routes/Home.tsx
@@ -26,18 +26,21 @@ class Home extends Component {
description={meta.description}
className={styles.home}
>
-
-
)
diff --git a/client/src/routes/Invoices.tsx b/client/src/routes/Invoices.tsx
new file mode 100644
index 0000000..8acd279
--- /dev/null
+++ b/client/src/routes/Invoices.tsx
@@ -0,0 +1,61 @@
+import React, { Component } from 'react'
+import Route from '../components/templates/Route'
+import { User } from '../context/User'
+import Asset from '../components/molecules/Asset'
+import { Logger } from '@oceanprotocol/squid'
+import styles from './Search.module.scss'
+
+interface InvoicesState {
+ results: any[]
+}
+
+export default class Invoices extends Component<{}, InvoicesState> {
+ public state = { results: [] }
+
+ public async componentDidMount() {
+ // this is currently my published assets
+ this.context.ocean.keeper.didRegistry.contract.getPastEvents(
+ 'DIDAttributeRegistered',
+ {
+ filter: { _owner: this.context.account },
+ fromBlock: 0,
+ toBlock: 'latest'
+ },
+ async (error: any, events: any) => {
+ if (error) {
+ Logger.log('error retrieving', error)
+ } else {
+ const results = []
+ for (const event of events) {
+ const ddo = await this.context.ocean.resolveDID(
+ `did:op:${event.returnValues._did.substring(2)}`
+ )
+ results.push(ddo)
+ }
+ this.setState({ results })
+ }
+ }
+ )
+ }
+
+ public renderResults = () =>
+ this.state.results.length ? (
+
+ {this.state.results.map((asset, index) => (
+
+ ))}
+
+ ) : (
+ No invoices yet
+ )
+
+ public render() {
+ return (
+
+ {this.renderResults()}
+
+ )
+ }
+}
+
+Invoices.contextType = User
diff --git a/src/routes/NotFound.tsx b/client/src/routes/NotFound.tsx
similarity index 100%
rename from src/routes/NotFound.tsx
rename to client/src/routes/NotFound.tsx
diff --git a/src/routes/Publish/Files/Item.module.scss b/client/src/routes/Publish/Files/Item.module.scss
similarity index 83%
rename from src/routes/Publish/Files/Item.module.scss
rename to client/src/routes/Publish/Files/Item.module.scss
index 59e2f81..08fdc7b 100644
--- a/src/routes/Publish/Files/Item.module.scss
+++ b/client/src/routes/Publish/Files/Item.module.scss
@@ -32,3 +32,13 @@
opacity: .7;
}
}
+
+.details {
+ font-size: $font-size-mini;
+ font-size: .85rem;
+ color: #6e7e93;
+
+ span {
+ padding-right: .5rem;
+ }
+}
diff --git a/src/routes/Publish/Files/Item.tsx b/client/src/routes/Publish/Files/Item.tsx
similarity index 52%
rename from src/routes/Publish/Files/Item.tsx
rename to client/src/routes/Publish/Files/Item.tsx
index 995569c..2fb57da 100644
--- a/src/routes/Publish/Files/Item.tsx
+++ b/client/src/routes/Publish/Files/Item.tsx
@@ -1,9 +1,18 @@
import React from 'react'
import styles from './Item.module.scss'
+import filesize from 'filesize'
const Item = ({ item, removeItem }: { item: any; removeItem: any }) => (
{item.url}
+
+ url: {item.found ? 'confirmed' : 'unconfirmed'}
+
+ size:
+ {item.found && item.size ? filesize(item.size) : 'unknown'}
+
+ type: {item.found && item.type ? item.type : 'unknown'}
+