-
Notifications
You must be signed in to change notification settings - Fork 7
adding BlockPAge and BlockDetailsPage #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,157 @@ | ||
module Styles = { | ||
open CssJs | ||
|
||
let noDataImage = style(. [width(#auto), height(#px(70)), marginBottom(#px(16))]) | ||
} | ||
|
||
module RenderBody = { | ||
@react.component | ||
let make = (~txSub: Sub.variant<TxSub.t>) => { | ||
<TBody> | ||
<Row> | ||
<Col col=Col.Two> | ||
{switch txSub { | ||
| Data({txHash}) => <TxLink txHash width=140 /> | ||
| Error(_) | Loading | NoData => <LoadingCensorBar width=170 height=15 /> | ||
}} | ||
</Col> | ||
<Col col=Col.Two> | ||
{switch txSub { | ||
| Data({gasFee}) => | ||
<div className={CssHelper.flexBox(~justify=#flexEnd, ())}> | ||
<Text | ||
block=true | ||
code=true | ||
spacing={Text.Em(0.02)} | ||
value={gasFee->Coin.getBandAmountFromCoins->Format.fPretty} | ||
weight=Text.Medium | ||
/> | ||
</div> | ||
| Error(_) | Loading | NoData => <LoadingCensorBar width=30 height=15 isRight=true /> | ||
}} | ||
</Col> | ||
<Col col=Col.Eight> | ||
{switch txSub { | ||
| Data({messages, txHash, success, errMsg}) => | ||
<TxMessages txHash messages success errMsg /> | ||
| Error(_) | Loading | NoData => <LoadingCensorBar width=530 height=15 /> | ||
}} | ||
</Col> | ||
</Row> | ||
</TBody> | ||
} | ||
} | ||
|
||
module RenderBodyMobile = { | ||
@react.component | ||
let make = (~reserveIndex, ~txSub: Sub.variant<TxSub.t>) => { | ||
switch txSub { | ||
| Data({txHash, gasFee, success, messages, errMsg}) => | ||
<MobileCard | ||
values={ | ||
open InfoMobileCard | ||
[ | ||
("TX Hash", TxHash(txHash, 200)), | ||
("Gas Fee\n(BAND)", Coin({value: gasFee, hasDenom: false})), | ||
("Actions", Messages(txHash, messages, success, errMsg)), | ||
] | ||
} | ||
idx={txHash -> Hash.toHex} | ||
status=success | ||
/> | ||
| Error(_) | Loading | NoData => | ||
<MobileCard | ||
values={ | ||
open InfoMobileCard | ||
[ | ||
("TX Hash", Loading(200)), | ||
("Gas Fee\n(BAND)", Loading(60)), | ||
("Actions", Loading(230)), | ||
] | ||
} | ||
idx={reserveIndex -> Belt.Int.toString} | ||
/> | ||
} | ||
} | ||
} | ||
|
||
@react.component | ||
let make = (~txsSub: Sub.variant<array<TxSub.t>>) => { | ||
let isMobile = Media.isMobile() | ||
let ({ThemeContext.theme, isDarkMode}, _) = React.useContext(ThemeContext.context) | ||
|
||
<> | ||
{isMobile | ||
? React.null | ||
: <THead> | ||
<Row alignItems=Row.Center> | ||
<Col col=Col.Two> | ||
<Text | ||
block=true | ||
value="TX Hash" | ||
size=Text.Sm | ||
weight=Text.Semibold | ||
transform=Text.Uppercase | ||
/> | ||
</Col> | ||
<Col col=Col.Two> | ||
<div className={CssHelper.flexBox(~justify=#flexEnd, ())}> | ||
<Text | ||
block=true | ||
value="Gas Fee (BAND)" | ||
size=Text.Sm | ||
weight=Text.Semibold | ||
transform=Text.Uppercase | ||
/> | ||
</div> | ||
</Col> | ||
<Col col=Col.Eight> | ||
<Text | ||
block=true | ||
value="Actions" | ||
size=Text.Sm | ||
weight=Text.Semibold | ||
transform=Text.Uppercase | ||
/> | ||
</Col> | ||
</Row> | ||
</THead>} | ||
{switch txsSub { | ||
| Data(txs) => | ||
txs->Belt.Array.size > 0 | ||
? txs | ||
->Belt.Array.mapWithIndex((i, e) => | ||
isMobile | ||
? <RenderBodyMobile | ||
reserveIndex=i | ||
txSub={Sub.resolve(e)} | ||
key={e.txHash -> Hash.toHex} | ||
/> | ||
: <RenderBody txSub={Sub.resolve(e)} key={e.txHash -> Hash.toHex} /> | ||
) | ||
->React.array | ||
: <EmptyContainer> | ||
<img | ||
alt="No Transaction" | ||
src={isDarkMode ? Images.noTxDark : Images.noTxLight} | ||
className=Styles.noDataImage | ||
/> | ||
<Heading | ||
size=Heading.H4 | ||
value="No Transaction" | ||
align=Heading.Center | ||
weight=Heading.Regular | ||
color={theme.textSecondary} | ||
/> | ||
</EmptyContainer> | ||
| Error(_) | Loading | NoData => | ||
Belt.Array.make(isMobile ? 1 : 10, Sub.NoData) | ||
->Belt.Array.mapWithIndex((i, noData) => | ||
isMobile | ||
? <RenderBodyMobile reserveIndex=i txSub=noData key={i -> Belt.Int.toString} /> | ||
: <RenderBody txSub=noData key={i -> Belt.Int.toString} /> | ||
xxibcill marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
->React.array | ||
}} | ||
</> | ||
} |
This file contains hidden or 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,76 @@ | ||
module Styles = { | ||
open CssJs | ||
|
||
let container = style(. [paddingTop(#px(24)), paddingBottom(#px(10)), minHeight(#px(100))]) | ||
let emptyContainer = | ||
style(. [ | ||
display(#flex), | ||
minHeight(#px(100)), | ||
alignItems(#center), | ||
justifyContent(#center), | ||
]) | ||
let request = style(. [marginTop(#px(26)), marginRight(#px(12))]) | ||
} | ||
|
||
module RequestsList = { | ||
@react.component | ||
let make = (~requests) => { | ||
<div className={CssHelper.flexBox()}> | ||
{requests | ||
->Belt.Array.map(request => | ||
<div className=Styles.request key={request |> ID.Request.toString}> | ||
<TypeID.Request id=request /> | ||
</div> | ||
) | ||
->React.array} | ||
</div> | ||
} | ||
} | ||
|
||
@react.component | ||
let make = (~blockSub: Sub.variant<BlockSub.t>) => { | ||
let (tabIndex, setTabIndex) = React.useState(_ => 0) | ||
let setTab = index => setTabIndex(_ => index) | ||
|
||
switch (blockSub) { | ||
| Data({requests}) when requests->Belt.Array.length !== 0 => | ||
let onChainRequests = | ||
requests->Belt.Array.keepMap(({id, isIBC}) => !isIBC ? Some(id) : None) | ||
let ibcRequests = requests->Belt.Array.keepMap(({id, isIBC}) => isIBC ? Some(id) : None) | ||
let onChain = onChainRequests->Belt.Array.length | ||
let ibc = ibcRequests->Belt.Array.length | ||
let showRequests = { | ||
switch (tabIndex) { | ||
| 0 => onChainRequests | ||
| 1 => ibcRequests | ||
| _ => | ||
Js.log("Please handle every case on Resolve Requests.") | ||
[] | ||
} | ||
} | ||
|
||
<Row marginBottom=24> | ||
<Col> | ||
<InfoContainer> | ||
<Heading value="Resolved Requests" size=Heading.H4 /> | ||
<div className={CssHelper.mt(~size=16, ())}> | ||
<Text | ||
value="Resolved requests are requests that were successfully processed, failed, or timed out by BandChain in this block." | ||
/> | ||
</div> | ||
<Tab.State tabs=[j`On Chain ($onChain)`, j`IBC ($ibc)`] tabIndex setTab> | ||
{showRequests->Belt.Array.length === 0 | ||
? <div className=Styles.emptyContainer> | ||
<Text value="There is no resolved request." /> | ||
</div> | ||
: <div className=Styles.container> | ||
<Text value="Request ID" size=Text.Sm transform=Text.Uppercase /> | ||
<RequestsList requests=showRequests /> | ||
</div>} | ||
</Tab.State> | ||
</InfoContainer> | ||
</Col> | ||
</Row> | ||
| Data(_) | Error(_) | Loading | NoData => React.null | ||
} | ||
} |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.