This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement applications index and detail pages
- Loading branch information
1 parent
c389478
commit 9bfbed8
Showing
11 changed files
with
338 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import _ from 'lodash'; | ||
|
||
import api from '.'; | ||
|
||
const DEFAULT_PAGE_SIZE = 100; | ||
|
||
const APPLICATION_DETAIL_VERSION = '[email protected]'; | ||
|
||
export function apiGetApplicationDetail({applicationId, version}) { | ||
return api( | ||
`/explorer/applications/${encodeURIComponent(applicationId)}?v=${version || | ||
APPLICATION_DETAIL_VERSION}`, | ||
); | ||
} | ||
|
||
const APPLICATION_INDEX_VERSION = '[email protected]'; | ||
|
||
export function apiGetApplicationsTimelinePage({ | ||
start = '', | ||
count = DEFAULT_PAGE_SIZE, | ||
direction = '-', | ||
version, | ||
}) { | ||
const queryString = _.toPairs({ | ||
start, | ||
count, | ||
direction, | ||
v: version || APPLICATION_INDEX_VERSION, | ||
}) | ||
.map(([k, v]) => `${k}=${encodeURIComponent(v)}`) | ||
.join('&'); | ||
|
||
return api(`/explorer/applications/index?${queryString}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import React from 'react'; | ||
import HelpLink from 'v2/components/HelpLink'; | ||
import CopyBtn from 'v2/components/UI/CopyBtn'; | ||
|
||
import {observer} from 'mobx-react-lite'; | ||
import useStyles from './styles'; | ||
import YAML from 'yaml'; | ||
|
||
const ApplicationCode = () => { | ||
const ApplicationCode = ({applicationView}: {applicationView: Object}) => { | ||
const classes = useStyles(); | ||
const applicationCode = YAML.stringify(applicationView); | ||
|
||
return ( | ||
<div> | ||
<div className={classes.header}> | ||
<CopyBtn text={'123'} /> | ||
<CopyBtn text={applicationCode} /> | ||
<HelpLink text="" term="" /> | ||
</div> | ||
<div className={classes.code}> | ||
<code> | ||
h: "759" data: h: 759 l: HzMrRwLN9DUoNXREAHGBVYqUqus3Xg6o8oNebN5BTwj5 | ||
s: 95 dt: 2019-06-03T15:10:29.255772558Z id: | ||
5CpdpKwKUBJdnMFjajJamGd2u7poZBkcqXVqPugnEN4QVQhSzGrbzMtzUkkLiAAoaNTLuJfCgyAdHEzAuwz1dioT | ||
entry_id: 2iEcjGA5zGQKt9JGpdrpmTBWZJg1XBzQfTx8Lj6Q5rtW | ||
<code>{applicationCode}</code> | ||
</code> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ApplicationCode; | ||
export default observer(ApplicationCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,41 @@ | ||
import React from 'react'; | ||
import Avatar from 'v2/components/UI/Avatar'; | ||
import Label from 'v2/components/UI/Label'; | ||
import _ from 'lodash'; | ||
// import useStyles from './styles'; | ||
import {observer} from 'mobx-react-lite'; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableRow, | ||
} from '@material-ui/core'; | ||
|
||
import useStyles from './styles'; | ||
const ApplicationDetails = ({programAccounts}: {programAccounts: Object}) => { | ||
// const classes = useStyles(); | ||
|
||
const ApplicationDetails = () => { | ||
const classes = useStyles(); | ||
return ( | ||
<ul className={classes.list}> | ||
<li className={classes.item}> | ||
<Label text="to" hint="" /> | ||
<div> | ||
<Avatar avatarUrl="" name="" width={33} height={33} pubkey="123" /> | ||
<span>0xAA15A3E6b97d09653b8b8d9c9e1D80daf5ba81e8</span> | ||
</div> | ||
</li> | ||
<li className={classes.item}> | ||
<Label text="from" hint="" /> | ||
<div> | ||
<Avatar avatarUrl="" name="" width={33} height={33} pubkey="123" /> | ||
<span>0xAA15A3E6b97d09653b8b8d9c9e1D80daf5ba81e8</span> | ||
</div> | ||
</li> | ||
</ul> | ||
); | ||
const renderAccount = (account, i) => { | ||
return ( | ||
<TableRow key={account.pubkey}> | ||
<TableCell> | ||
<Label text={`Account ${i + 1}`} hint="" /> | ||
</TableCell> | ||
<TableCell> | ||
<Avatar | ||
avatarUrl="" | ||
name="" | ||
width={33} | ||
height={33} | ||
pubkey={account.pubkey} | ||
/> | ||
<span>{account.pubkey}</span> | ||
</TableCell> | ||
<TableCell>Balance: {account.lamports}</TableCell> | ||
</TableRow> | ||
); | ||
}; | ||
|
||
return <Table><TableBody>{_.map(programAccounts, renderAccount)}</TableBody></Table>; | ||
}; | ||
|
||
export default ApplicationDetails; | ||
export default observer(ApplicationDetails); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.