This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: beta transaction details view (#1048)
* Feature: beta transaction details * Fix date
- Loading branch information
1 parent
c44e970
commit 3103446
Showing
23 changed files
with
1,486 additions
and
1,307 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
import * as React from "react"; | ||
import Link from "../../utils/Link"; | ||
import { shortenString } from "../../../libraries/formatting"; | ||
import { styled } from "../../../libraries/styles"; | ||
|
||
const AccountLinkWrapper = styled("a", { | ||
whiteSpace: "nowrap", | ||
}); | ||
|
||
export interface Props { | ||
accountId: string; | ||
} | ||
|
||
const AccountLink: React.FC<Props> = React.memo(({ accountId }) => { | ||
return ( | ||
<Link href={`/beta/accounts/${accountId}`} passHref> | ||
<AccountLinkWrapper>{shortenString(accountId)}</AccountLinkWrapper> | ||
</Link> | ||
); | ||
}); | ||
|
||
export default AccountLink; |
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,21 @@ | ||
import * as React from "react"; | ||
import Link from "../../utils/Link"; | ||
import { styled } from "../../../libraries/styles"; | ||
|
||
export interface Props { | ||
blockHash: string; | ||
blockHeight: number; | ||
} | ||
|
||
const LinkWrapper = styled("a", { | ||
whiteSpace: "nowrap", | ||
cursor: "pointer", | ||
}); | ||
|
||
const BlockLink: React.FC<Props> = React.memo(({ blockHash, blockHeight }) => ( | ||
<Link href="/blocks/[hash]" as={`/blocks/${blockHash}`}> | ||
<LinkWrapper>{`#${blockHeight}`}</LinkWrapper> | ||
</Link> | ||
)); | ||
|
||
export default BlockLink; |
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,53 @@ | ||
import * as React from "react"; | ||
import { hexy } from "hexy"; | ||
|
||
import { styled } from "../../../libraries/styles"; | ||
|
||
import CodePreview from "../../utils/CodePreview"; | ||
import JsonView from "./JsonView"; | ||
|
||
const HexArgs = styled("div", { | ||
padding: "10px 0", | ||
|
||
"& > div": { | ||
background: "#f8f8f8", | ||
borderRadius: 4, | ||
color: "#3f4246", | ||
padding: 20, | ||
fontSize: 14, | ||
fontWeight: 500, | ||
|
||
"& textarea, pre": { | ||
background: "inherit", | ||
color: "inherit", | ||
fontFamily: "inherit", | ||
fontSize: "inherit", | ||
border: "none", | ||
padding: 0, | ||
}, | ||
}, | ||
}); | ||
|
||
const CodeArgs: React.FC<{ args: string }> = React.memo(({ args }) => { | ||
const decodedArgs = Buffer.from(args, "base64"); | ||
|
||
let prettyArgs: object | string; | ||
try { | ||
const parsedJSONArgs = JSON.parse(decodedArgs.toString()); | ||
prettyArgs = | ||
typeof parsedJSONArgs === "boolean" | ||
? JSON.stringify(parsedJSONArgs) | ||
: parsedJSONArgs; | ||
} catch { | ||
prettyArgs = hexy(decodedArgs, { format: "twos" }); | ||
} | ||
return typeof prettyArgs === "object" ? ( | ||
<JsonView args={prettyArgs} /> | ||
) : ( | ||
<HexArgs> | ||
<CodePreview collapseHeight={200} maxHeight={600} value={prettyArgs} /> | ||
</HexArgs> | ||
); | ||
}); | ||
|
||
export default CodeArgs; |
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,24 @@ | ||
import dynamic from "next/dynamic"; | ||
import * as React from "react"; | ||
// https://github.com/mac-s-g/react-json-view/issues/296#issuecomment-803497117 | ||
const DynamicReactJson = dynamic(import("react-json-view"), { ssr: false }); | ||
|
||
type Props = { | ||
args: object; | ||
}; | ||
|
||
const JsonView: React.FC<Props> = React.memo(({ args }) => ( | ||
<DynamicReactJson | ||
src={args} | ||
name={null} | ||
iconStyle="triangle" | ||
displayObjectSize={false} | ||
displayDataTypes={false} | ||
style={{ | ||
fontSize: "14px", | ||
padding: "10px 0", | ||
}} | ||
/> | ||
)); | ||
|
||
export default JsonView; |
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.