Skip to content

Commit

Permalink
feat: add light node upgrade top up methods (#372)
Browse files Browse the repository at this point in the history
* feat: add top up

* chore: remove console.log

* build: add pseudo-missing dependency

* feat: add missing top up components

* fix: crypto route

* feat(wip): add gift wallet logic

* fix: fix gift wallet flows

* feat: simplify flow without fund step

* feat: add loading screens

* fix: remove alert

* fix: prepend http if needed

* fix: fix bug that was reintroduced with merge

* refactor: rename minusEther to minusBaseUnits

* fix: remove unused setStartedAt

* build: remove unused dependency
  • Loading branch information
Cafe137 authored Jun 2, 2022
1 parent 0267839 commit a768b4e
Show file tree
Hide file tree
Showing 35 changed files with 1,196 additions and 215 deletions.
180 changes: 90 additions & 90 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Provider as FileProvider } from './providers/File'
import { Provider as PlatformProvider } from './providers/Platform'
import { Provider as SettingsProvider } from './providers/Settings'
import { Provider as StampsProvider } from './providers/Stamps'
import { Provider as TopUpProvider } from './providers/TopUp'
import BaseRouter from './routes'
import { theme } from './theme'

Expand All @@ -29,16 +30,18 @@ const App = ({ beeApiUrl, beeDebugApiUrl, lockedApiSettings }: Props): ReactElem
<FileProvider>
<FeedsProvider>
<PlatformProvider>
<SnackbarProvider>
<Router>
<>
<CssBaseline />
<Dashboard>
<BaseRouter />
</Dashboard>
</>
</Router>
</SnackbarProvider>
<TopUpProvider>
<SnackbarProvider>
<Router>
<>
<CssBaseline />
<Dashboard>
<BaseRouter />
</Dashboard>
</>
</Router>
</SnackbarProvider>
</TopUpProvider>
</PlatformProvider>
</FeedsProvider>
</FileProvider>
Expand Down
54 changes: 0 additions & 54 deletions src/components/AlertVersion.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/CashoutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import DialogContent from '@material-ui/core/DialogContent'
import DialogContentText from '@material-ui/core/DialogContentText'
import DialogTitle from '@material-ui/core/DialogTitle'
import { useSnackbar } from 'notistack'
import { ReactElement, useState, useContext } from 'react'
import { ReactElement, useContext, useState } from 'react'
import { Zap } from 'react-feather'
import { Context as SettingsContext } from '../providers/Settings'
import EthereumAddress from './EthereumAddress'
Expand Down Expand Up @@ -61,7 +61,7 @@ export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactE
return (
<div>
<Button variant="contained" onClick={handleClickOpen} startIcon={<Zap size="1rem" />}>
Cash out peer {peerId.substr(0, 8)}[…]
Cash out peer {peerId.slice(0, 8)}[…]
</Button>
<Dialog open={open} onClose={handleClose} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">Cashout Cheque</DialogTitle>
Expand Down
5 changes: 3 additions & 2 deletions src/components/ExpandableListItemKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const useStyles = makeStyles((theme: Theme) =>
interface Props {
label: string
value: string
expanded?: boolean
}

const lengthWithoutPrefix = (s: string) => s.replace(/^0x/i, '').length
Expand All @@ -54,9 +55,9 @@ const split = (s: string): string[] => {
return s.match(/(0x|.{1,8})/gi) || []
}

export default function ExpandableListItemKey({ label, value }: Props): ReactElement | null {
export default function ExpandableListItemKey({ label, value, expanded }: Props): ReactElement | null {
const classes = useStyles()
const [open, setOpen] = useState(false)
const [open, setOpen] = useState(expanded || false)
const [copied, setCopied] = useState(false)
const toggleOpen = () => setOpen(!open)

Expand Down
12 changes: 11 additions & 1 deletion src/components/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Divider, Drawer, Grid, Link as MUILink, List } from '@material-ui/core'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { OpenInNewSharp } from '@material-ui/icons'
import type { ReactElement } from 'react'
import { Bookmark, BookOpen, DollarSign, FileText, Home, Layers, Settings } from 'react-feather'
import { Bookmark, BookOpen, Briefcase, DollarSign, FileText, Gift, Home, Layers, Settings } from 'react-feather'
import { Link } from 'react-router-dom'
import Logo from '../assets/logo.svg'
import { config } from '../config'
Expand Down Expand Up @@ -41,6 +41,16 @@ const navBarItems = [
path: ROUTES.SETTINGS,
icon: Settings,
},
{
label: 'Account',
path: ROUTES.WALLET,
icon: Briefcase,
},
{
label: 'Gift Wallets',
path: ROUTES.GIFT_CODES,
icon: Gift,
},
]

const drawerWidth = 300
Expand Down
17 changes: 17 additions & 0 deletions src/components/SwarmDivider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Box, Divider } from '@material-ui/core'
import { ReactElement } from 'react'

interface Props {
my?: number
mt?: number
mb?: number
color?: string
}

export function SwarmDivider({ my, mt, mb, color = '#cbcbcb' }: Props): ReactElement {
return (
<Box my={my} mt={mt} mb={mb}>
<Divider style={{ borderColor: color }} />
</Box>
)
}
Loading

0 comments on commit a768b4e

Please sign in to comment.