feat: modularisation (#244)

* chore: gitignore for lib directory

* build: packageing for webpack lib build

* build: webpack config

* feat: expose App component with beeApiUrl parameter

* build: tsconfig for library build

* build: main property of package json for tsc build

* refactor: rename beeUrl option to beeApiUrl

* refactor: manange config class instead of process.env calls

* build: babelrc config

* build: babel plugins and presets for webpack build

* chore: serve.js chmod

* build(refactor): webpack build

* refactor: number notation

* chore: webpack and package config change

* build: add babel preset-env

* chore: prepare script also builds component lib

* feat: typegen

* revert: set back prepare command

* build: assets loader config

* feat: beeDebugApiUrl

* refactor: move test files to the test folder because of typegen

* feat: locked api settings

* chore: depcheck ignores

* chore: types check script

* ci: check types

* ci: publish with library

* chore: add webpack as devDep

* chore: locked semver

* chore: remove debug logging

* style: webpack config

* chore: react and react-dom as dependency

* chore: package-lock

* fix: clean package-lock init

* refactor: fix versions in package.json
This commit is contained in:
nugaon
2021-12-09 11:12:45 +01:00
committed by GitHub
parent 1a3e58c89b
commit 2a13da1a6c
23 changed files with 7145 additions and 2049 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Alert, AlertTitle } from '@material-ui/lab'
import { ReactElement } from 'react'
const LIMIT = 100_000_000 // 100 megabytes
const LIMIT = 100000000 // 100 megabytes
interface Props {
files: File[]
+5 -7
View File
@@ -1,9 +1,9 @@
import { Typography } from '@material-ui/core/'
import QRCodeModal from './QRCodeModal'
import ClipboardCopy from './ClipboardCopy'
import Identicon from 'react-identicons'
import { ReactElement } from 'react'
import Identicon from 'react-identicons'
import { config } from '../config'
import ClipboardCopy from './ClipboardCopy'
import QRCodeModal from './QRCodeModal'
interface Props {
address: string | undefined
@@ -36,9 +36,7 @@ export default function EthereumAddress(props: Props): ReactElement {
}
: { marginRight: '7px' }
}
href={`${process.env.REACT_APP_BLOCKCHAIN_EXPLORER_URL}/${props.transaction ? 'tx' : 'address'}/${
props.address
}`}
href={`${config.BLOCKCHAIN_EXPLORER_URL}/${props.transaction ? 'tx' : 'address'}/${props.address}`}
target="_blank"
rel="noreferrer"
>
+4 -1
View File
@@ -55,6 +55,7 @@ interface Props {
onChange?: (value: string) => void
onConfirm: (value: string) => void
mapperFn?: (value: string) => string
locked?: boolean
}
export default function ExpandableListItemKey({
@@ -68,6 +69,7 @@ export default function ExpandableListItemKey({
helperText,
placeholder,
mapperFn,
locked,
}: Props): ReactElement | null {
const classes = useStyles()
const [open, setOpen] = useState(Boolean(expandedOnly))
@@ -96,7 +98,7 @@ export default function ExpandableListItemKey({
<Typography variant="body2">
<div>
{!open && value}
{!expandedOnly && (
{!expandedOnly && !locked && (
<IconButton size="small" className={classes.copyValue}>
{open ? (
<Minus onClick={toggleOpen} strokeWidth={1} />
@@ -116,6 +118,7 @@ export default function ExpandableListItemKey({
fullWidth
className={classes.content}
autoFocus
hidden={locked}
/>
</Collapse>
</Grid>
+2 -1
View File
@@ -5,6 +5,7 @@ import type { ReactElement } from 'react'
import { BookOpen, DollarSign, FileText, Home, Layers, Settings } from 'react-feather'
import { Link } from 'react-router-dom'
import Logo from '../assets/logo.svg'
import { config } from '../config'
import { ROUTES } from '../routes'
import SideBarItem from './SideBarItem'
import SideBarStatus from './SideBarStatus'
@@ -111,7 +112,7 @@ export default function SideBar(): ReactElement {
</List>
<Divider className={classes.divider} />
<List>
<MUILink href={process.env.REACT_APP_BEE_DOCS_HOST} target="_blank" className={classes.link}>
<MUILink href={config.BEE_DOCS_HOST} target="_blank" className={classes.link}>
<SideBarItem
iconStart={<BookOpen className={classes.icon} />}
iconEnd={<OpenInNewSharp className={classes.iconSmall} />}
@@ -1,10 +1,10 @@
import type { ReactElement } from 'react'
import { Link } from 'react-router-dom'
import { Button, Grid, Link as MuiLink, Typography } from '@material-ui/core/'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Button, Grid, Typography, Link as MuiLink } from '@material-ui/core/'
import { ROUTES } from '../routes'
import type { ReactElement } from 'react'
import { Activity } from 'react-feather'
import { Link } from 'react-router-dom'
import { config } from '../config'
import { ROUTES } from '../routes'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -37,11 +37,11 @@ export default function TroubleshootConnectionCard(): ReactElement {
<Grid item className={classes.content}>
<Typography align="center">
Please check your node status to fix the problem. You can also check out the{' '}
<MuiLink href={process.env.REACT_APP_BEE_DOCS_HOST} target="_blank" rel="noreferrer">
<MuiLink href={config.BEE_DOCS_HOST} target="_blank" rel="noreferrer">
Swarm Bee Docs
</MuiLink>{' '}
or ask for support on the{' '}
<MuiLink href={process.env.REACT_APP_BEE_DISCORD_HOST} target="_blank" rel="noreferrer">
<MuiLink href={config.BEE_DISCORD_HOST} target="_blank" rel="noreferrer">
Ethereum Swarm Discord
</MuiLink>
.