Skip to content

Commit 9aba0a5

Browse files
1.1.6
1 parent 0aed7fb commit 9aba0a5

22 files changed

+401
-321
lines changed

react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitcoin-hash",
3-
"version": "1.1.4",
3+
"version": "1.1.6",
44
"dependencies": {
55
"@apollo/client": "^3.7.14",
66
"@emotion/react": "^11.11.0",

react-app/src/BitcoinHash/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_DEV
Lines changed: 34 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import * as React from 'react'
22
import {
3-
useTheme,
43
styled,
54
CssBaseline,
65
Box,
76
AppBar,
87
Toolbar,
9-
Paper,
108
Fab,
11-
LinearProgress,
129
} from "@mui/material"
1310
import {
14-
Icon,
15-
Font,
16-
Search,
17-
Notifyer,
1811
usePwaSelect,
12+
usePwaDispatch,
1913
selectPWA,
20-
BitQuery,
14+
scrollTop,
15+
startApp,
16+
ListTransactions,
17+
Icon,
18+
Notifyer,
19+
// updateTransactions,
2120
} from "./"
2221

2322
const StyledFab = styled(Fab)({
@@ -30,53 +29,35 @@ const StyledFab = styled(Fab)({
3029
})
3130

3231
export default function AppShell() {
33-
34-
35-
const theme = useTheme()
36-
const titleColor = theme.palette.primary.main
3732
const pwa = usePwaSelect(selectPWA)
38-
const {
39-
searching,
40-
} = pwa
41-
42-
return (<>
43-
<CssBaseline />
44-
<Paper square sx={{ pb: '50px', mt: 2 }}>
33+
const dispatch = usePwaDispatch()
4534

46-
{searching ? <LinearProgress color="secondary"/> :
47-
<Box sx={{height: 4}} /> }
35+
React.useEffect(() => {
36+
const {started} = pwa
37+
if (!started){
38+
// @ts-ignore
39+
dispatch(startApp())
40+
}
41+
}, [pwa, dispatch])
4842

49-
<Box sx={{ p: 2, pb: 0, mb:2 }}>
50-
<Font variant="title" color={titleColor}>
51-
Bitcoin#
52-
</Font>
53-
</Box>
54-
<Search />
55-
<BitQuery />
56-
</Paper>
57-
58-
<AppBar position="fixed" color="primary" sx={{ top: 'auto', bottom: 0 }}>
59-
<Toolbar>
60-
<StyledFab
61-
color="primary"
62-
onClick={(e: React.MouseEvent) => {
63-
e.preventDefault()
64-
window.open("https://github.com/listingslab/bitcoin-hash", "_blank")
65-
}}>
66-
<Icon icon="github" />
67-
</StyledFab>
68-
<Box sx={{ flexGrow: 1 }} />
69-
{/* <IconButton
70-
color="inherit"
71-
onClick={(e: React.MouseEvent) => {
72-
e.preventDefault()
73-
console.log("Search")
74-
}}>
75-
<Icon icon="menu" />
76-
</IconButton> */}
77-
</Toolbar>
78-
</AppBar>
79-
<Notifyer />
80-
</>
43+
44+
return (<>
45+
<CssBaseline />
46+
<ListTransactions />
47+
<AppBar position="fixed" color="primary" sx={{ top: 'auto', bottom: 0 }}>
48+
<Toolbar>
49+
<StyledFab
50+
color="primary"
51+
onClick={(e: React.MouseEvent) => {
52+
e.preventDefault()
53+
dispatch(scrollTop())
54+
}}>
55+
<Icon icon="up" />
56+
</StyledFab>
57+
<Box sx={{ flexGrow: 1 }} />
58+
</Toolbar>
59+
</AppBar>
60+
<Notifyer />
61+
</>
8162
)
8263
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as React from 'react'
2+
import {
3+
Accordion,
4+
AccordionSummary,
5+
AccordionDetails,
6+
Box,
7+
} from "@mui/material"
8+
import {
9+
Icon,
10+
Font,
11+
} from ".."
12+
13+
export default function AccordionTestData() {
14+
const [expanded, setExpanded] = React.useState<string | false>(false)
15+
16+
const handleChange =
17+
(panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => {
18+
setExpanded(isExpanded ? panel : false)
19+
}
20+
21+
return (
22+
<Box sx={{mt:1}}>
23+
<Accordion expanded={expanded === 'pimoroni-ad'} onChange={handleChange('pimoroni-ad')}>
24+
<AccordionSummary
25+
expandIcon={<Icon icon="expand" />}
26+
aria-controls="pimorni-content"
27+
id="pimorni-header"
28+
>
29+
<Box sx={{ flexShrink: 1, mr: 2 }}>
30+
{/* <Avatar src={"/svg/logo.svg"} /> */}
31+
</Box>
32+
<Box sx={{ }}>
33+
<Font variant="description">
34+
Test data
35+
</Font>
36+
</Box>
37+
</AccordionSummary>
38+
39+
<AccordionDetails>
40+
<pre style={{fontSize:10}}>
41+
Test transaction# 2892bc7fb0c2efe34f655f659bffb4d694ffc33f824cb0752da5ecb2d2ff39dc
42+
</pre>
43+
<pre style={{fontSize:10}}>
44+
Test address# bc1qgyrmw4ncp2rgkatz8p8uq86pls3xpk6u9kzmc7
45+
</pre>
46+
47+
</AccordionDetails>
48+
</Accordion>
49+
</Box>
50+
)
51+
}

react-app/src/BitcoinHash/components/BitQuery.tsx

Lines changed: 0 additions & 42 deletions
This file was deleted.

react-app/src/BitcoinHash/components/Icon.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ export default function Icon(props: any) {
119119
iconFragment = <HostIcon color={color} />
120120
break
121121

122+
case "transaction":
123+
iconFragment = <DocIcon color={color} />
124+
break
125+
126+
case "address":
127+
iconFragment = <CTAIcon color={color} />
128+
break
129+
122130
case "hash":
123131
iconFragment = <HashIcon color={color} />
124132
break
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import * as React from "react"
2+
import moment from "moment"
3+
import {
4+
Accordion,
5+
AccordionSummary,
6+
AccordionDetails,
7+
Box,
8+
LinearProgress,
9+
} from "@mui/material"
10+
import {
11+
Icon,
12+
Font,
13+
usePwaSelect,
14+
// usePwaDispatch,
15+
// updateTransactions,
16+
selectPWA,
17+
} from ".."
18+
19+
export default function ListTransactions() {
20+
// const dispatch = usePwaDispatch()
21+
const [expanded, setExpanded] = React.useState<string | false>("transaction-acc")
22+
23+
const handleChange =
24+
(panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => {
25+
setExpanded(isExpanded ? panel : false)
26+
}
27+
28+
const pwa = usePwaSelect(selectPWA)
29+
const {transactions, searching, lastUpdate} = pwa
30+
31+
return (
32+
<Box sx={{mt:1, mb: "90px"}}>
33+
<Accordion expanded={expanded === "transaction-acc"} onChange={handleChange("transaction-acc")}>
34+
{searching ? <LinearProgress color="secondary"/> : <Box sx={{height: 4}} /> }
35+
<AccordionSummary
36+
expandIcon={<Icon icon="expand" />}
37+
aria-controls="transactions-content"
38+
id="transactions-header"
39+
>
40+
<Box sx={{ flexShrink: 1, mr: 2 }}>
41+
<Icon icon="transaction" />
42+
</Box>
43+
<Box sx={{ mt:-1 }}>
44+
<Font variant="title">
45+
Last 50 Blockchain Transactions
46+
</Font>
47+
<Font variant="small">
48+
Updated {moment(lastUpdate).fromNow()}
49+
</Font>
50+
</Box>
51+
</AccordionSummary>
52+
<AccordionDetails>
53+
<pre style={{fontSize:10}}>
54+
{JSON.stringify(transactions, null, 2)}
55+
</pre>
56+
</AccordionDetails>
57+
</Accordion>
58+
</Box>
59+
)
60+
}

0 commit comments

Comments
 (0)