mirror of https://github.com/oceanprotocol/ipfs
parent
e3623d00ae
commit
f7895c5359
@ -0,0 +1,32 @@
|
||||
{
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": ["./tsconfig.json"]
|
||||
},
|
||||
"extends": [
|
||||
"oceanprotocol",
|
||||
"oceanprotocol/react",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier/react",
|
||||
"prettier/standard",
|
||||
"prettier/@typescript-eslint"
|
||||
],
|
||||
"plugins": ["@typescript-eslint", "prettier"],
|
||||
"rules": {
|
||||
"react/prop-types": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off"
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"browser": true,
|
||||
"jest": true
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "16"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
export const title = 'Ocean Protocol 💖 IPFS'
|
||||
export const description = `Ocean Protocol's public IPFS Node, setup to be a public gateway, and to provide some access to its HTTP API for everyone.<br /><a href="https://blog.oceanprotocol.com/ocean-and-ipfs-sitting-in-the-merkle-tree-43c623c356d7">Learn More →</a>`
|
||||
|
||||
export const ipfsGateway = 'https://ipfs.oceanprotocol.com'
|
||||
export const ipfsNodeUri = 'https://ipfs.oceanprotocol.com:443'
|
||||
|
||||
export const links = [
|
||||
{
|
||||
name: 'Homepage',
|
||||
url: 'https://oceanprotocol.com'
|
||||
},
|
||||
{
|
||||
name: 'Blog',
|
||||
url: 'https://blog.oceanprotocol.com'
|
||||
},
|
||||
{
|
||||
name: 'Twitter',
|
||||
url: 'https://twitter.com/oceanprotocol'
|
||||
},
|
||||
{
|
||||
name: 'GitHub',
|
||||
url: 'https://github.com/oceanprotocol'
|
||||
}
|
||||
]
|
@ -0,0 +1,2 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/types/global" />
|
@ -0,0 +1,24 @@
|
||||
module.exports = {
|
||||
title: 'Ocean Protocol 💖 IPFS',
|
||||
description: `Ocean Protocol's public IPFS Node, setup to be a public gateway, and to provide some access to its HTTP API for everyone.<br /><a href="https://blog.oceanprotocol.com/ocean-and-ipfs-sitting-in-the-merkle-tree-43c623c356d7">Learn More →</a>`,
|
||||
ipfsGateway: 'https://ipfs.oceanprotocol.com',
|
||||
ipfsNodeUri: 'https://ipfs.oceanprotocol.com:443',
|
||||
links: [
|
||||
{
|
||||
name: 'Homepage',
|
||||
url: 'https://oceanprotocol.com'
|
||||
},
|
||||
{
|
||||
name: 'Blog',
|
||||
url: 'https://blog.oceanprotocol.com'
|
||||
},
|
||||
{
|
||||
name: 'Twitter',
|
||||
url: 'https://twitter.com/oceanprotocol'
|
||||
},
|
||||
{
|
||||
name: 'GitHub',
|
||||
url: 'https://github.com/oceanprotocol'
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
declare module '*.module.css' {
|
||||
const classes: { readonly [key: string]: string }
|
||||
export default classes
|
||||
}
|
||||
|
||||
declare module '*.svg' {
|
||||
import * as React from 'react'
|
||||
export const ReactComponent: React.FunctionComponent<
|
||||
React.SVGProps<SVGSVGElement>
|
||||
>
|
||||
const src: string
|
||||
export default src
|
||||
}
|
||||
|
||||
declare module 'ipfs-http-client'
|
@ -0,0 +1,17 @@
|
||||
@import './styles/_variables.css';
|
||||
|
||||
.app {
|
||||
padding: var(--spacer);
|
||||
background: var(--brand-black);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 640px) {
|
||||
.app {
|
||||
height: auto;
|
||||
min-height: calc(100vh - (var(--page-frame) * 2) - (var(--spacer) * 2));
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import React from 'react'
|
||||
import Head from 'next/head'
|
||||
import Footer from './components/Footer'
|
||||
import styles from './Layout.module.css'
|
||||
import { title } from '../site.config'
|
||||
|
||||
export default function Layout({
|
||||
children,
|
||||
pageTitle = title
|
||||
}: {
|
||||
children: any
|
||||
pageTitle?: string
|
||||
}) {
|
||||
return (
|
||||
<div className={styles.app}>
|
||||
<Head>
|
||||
<title>{pageTitle}</title>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
|
||||
{children}
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
)
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
import React, { useState } from 'react'
|
||||
import { saveToIpfs } from '../ipfs'
|
||||
import { ipfsGateway } from '../../config'
|
||||
import { ipfsGateway } from '../../site.config'
|
||||
import Dropzone from './Dropzone'
|
||||
import styles from './Add.css'
|
||||
import styles from './Add.module.css'
|
||||
import Spinner from './Spinner'
|
||||
|
||||
export default function Add() {
|
||||
const [fileHash, setFileHash] = useState(null)
|
||||
const [fileHash, setFileHash] = useState()
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
const handleCaptureFile = async files => {
|
||||
const handleCaptureFile = async (files: File[]) => {
|
||||
setLoading(true)
|
||||
const cid = await saveToIpfs(files)
|
||||
setFileHash(cid)
|
@ -1,15 +1,16 @@
|
||||
import React, { useCallback } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { useDropzone } from 'react-dropzone'
|
||||
import styles from './Dropzone.css'
|
||||
import styles from './Dropzone.module.css'
|
||||
|
||||
Dropzone.propTypes = {
|
||||
handleOnDrop: PropTypes.func.isRequired,
|
||||
disabled: PropTypes.bool,
|
||||
multiple: PropTypes.bool
|
||||
}
|
||||
|
||||
export default function Dropzone({ handleOnDrop, disabled, multiple }) {
|
||||
export default function Dropzone({
|
||||
handleOnDrop,
|
||||
disabled,
|
||||
multiple
|
||||
}: {
|
||||
handleOnDrop(files: File[]): void
|
||||
disabled?: boolean
|
||||
multiple?: boolean
|
||||
}) {
|
||||
const onDrop = useCallback(acceptedFiles => handleOnDrop(acceptedFiles), [
|
||||
handleOnDrop
|
||||
])
|
@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import { links } from '../../config'
|
||||
import styles from './Footer.css'
|
||||
import { links } from '../../site.config'
|
||||
import styles from './Footer.module.css'
|
||||
|
||||
export default function Footer() {
|
||||
const year = new Date().getFullYear()
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import styles from './Spinner.css'
|
||||
import styles from './Spinner.module.css'
|
||||
|
||||
export default function Spinner() {
|
||||
return <div className={styles.spinner} />
|
@ -1,33 +0,0 @@
|
||||
import React from 'react'
|
||||
import Head from 'next/head'
|
||||
|
||||
import '@oceanprotocol/typographies/css/ocean-typo.css'
|
||||
import '../styles/global.css'
|
||||
import styles from './index.css'
|
||||
|
||||
import Add from '../components/Add'
|
||||
import Logo from '@oceanprotocol/art/logo/logo-white.svg'
|
||||
import { title, description } from '../../config'
|
||||
import Footer from '../components/Footer'
|
||||
|
||||
const Home = () => (
|
||||
<div className={styles.app}>
|
||||
<Head>
|
||||
<title>Ocean Protocol 💖 IPFS</title>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
|
||||
<header className={styles.header}>
|
||||
<Logo className={styles.logo} />
|
||||
<h1 className={styles.appTitle}>{title}</h1>
|
||||
<p
|
||||
className={styles.appDescription}
|
||||
dangerouslySetInnerHTML={{ __html: description }}
|
||||
/>
|
||||
</header>
|
||||
<Add />
|
||||
<Footer />
|
||||
</div>
|
||||
)
|
||||
|
||||
export default Home
|
@ -0,0 +1,27 @@
|
||||
import React from 'react'
|
||||
|
||||
import '@oceanprotocol/typographies/css/ocean-typo.css'
|
||||
import '../styles/global.css'
|
||||
|
||||
import Add from '../components/Add'
|
||||
import Logo from '@oceanprotocol/art/logo/logo-white.svg'
|
||||
import { title, description } from '../../site.config'
|
||||
import styles from './index.module.css'
|
||||
|
||||
import Layout from '../Layout'
|
||||
|
||||
const Home = () => (
|
||||
<Layout>
|
||||
<header className={styles.header}>
|
||||
<Logo />
|
||||
<h1 className={styles.title}>{title}</h1>
|
||||
<p
|
||||
className={styles.description}
|
||||
dangerouslySetInnerHTML={{ __html: description }}
|
||||
/>
|
||||
</header>
|
||||
<Add />
|
||||
</Layout>
|
||||
)
|
||||
|
||||
export default Home
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"jsx": "preserve",
|
||||
"lib": ["dom", "es2017"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noEmit": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"preserveConstEnums": true,
|
||||
"removeComments": false,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "esnext",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
}
|
Loading…
Reference in new issue