@@ -7,6 +7,7 @@ import styled from 'styled-components'
77import { AccountTransfers } from "./AccountTransfers.tsx" ;
88import { AccountExtrinsics } from "./AccountExtrinsics.tsx" ;
99import { CopyButton } from "../components/CopyButton.tsx" ;
10+ import { Helmet } from 'react-helmet-async' ;
1011
1112const GET_ACCOUNT = gql `
1213 query GetAccount($address: String!) {
@@ -55,58 +56,72 @@ export const AccountDetails = () => {
5556 return < div > Error: No address provided</ div >
5657 }
5758
59+ const accountData = data ?. account ;
60+ const title = accountData ? `Account ${ address . slice ( 0 , 8 ) } ... | Torus Explorer` : 'Account Details | Torus Explorer' ;
61+ const description = accountData
62+ ? `Account ${ address } with total balance of ${ formatTORUS ( accountData . balanceTotal ) } TORUS`
63+ : 'View account details on Torus Explorer' ;
64+
5865 return (
59- < TerminalWindow title = { `view_account` } >
60- { loading && < TerminalLoading /> }
61- { error && < div > Error: { error . message } </ div > }
62- { ! loading && ! data ?. account && < div > Error: { address } not found.</ div > }
63- { data ?. account && (
64- < div >
65- < DetailRow >
66- < DetailLabel > Address:</ DetailLabel >
67- < DetailValue > { data . account . id } < CopyButton textToCopy = { data . account . id } /> </ DetailValue >
68- </ DetailRow >
69- < DetailRow >
70- < DetailLabel > Total Balance:</ DetailLabel >
71- < DetailValue > { formatTORUS ( data . account . balanceTotal ) } </ DetailValue >
72- </ DetailRow >
73- < DetailRow >
74- < DetailLabel > Free Balance:</ DetailLabel >
75- < DetailValue > { formatTORUS ( data . account . balanceFree ) } </ DetailValue >
76- </ DetailRow >
77- < DetailRow >
78- < DetailLabel > Staked Balance:</ DetailLabel >
79- < DetailValue > { formatTORUS ( data . account . balanceStaked ) } </ DetailValue >
80- </ DetailRow >
81- </ div >
82- ) }
66+ < >
67+ < Helmet >
68+ < title > { title } </ title >
69+ < meta name = "description" content = { description } />
70+ < meta property = "og:title" content = { title } />
71+ < meta property = "og:description" content = { description } />
72+ < meta property = "og:type" content = "website" />
73+ { accountData && (
74+ < >
75+ < meta property = "og:url" content = { window . location . href } />
76+ < meta name = "twitter:card" content = "summary" />
77+ < meta name = "twitter:title" content = { title } />
78+ < meta name = "twitter:description" content = { description } />
79+ </ >
80+ ) }
81+ </ Helmet >
82+ < TerminalWindow title = { `view_account` } >
83+ { loading && < TerminalLoading /> }
84+ { error && < div > Error: { error . message } </ div > }
85+ { ! loading && ! data ?. account && < div > Error: { address } not found.</ div > }
86+ { data ?. account && (
87+ < div >
88+ < DetailRow >
89+ < DetailLabel > Address:</ DetailLabel >
90+ < DetailValue > { data . account . id } < CopyButton textToCopy = { data . account . id } /> </ DetailValue >
91+ </ DetailRow >
92+ < DetailRow >
93+ < DetailLabel > Total Balance:</ DetailLabel >
94+ < DetailValue > { formatTORUS ( data . account . balanceTotal ) } </ DetailValue >
95+ </ DetailRow >
96+ < DetailRow >
97+ < DetailLabel > Free Balance:</ DetailLabel >
98+ < DetailValue > { formatTORUS ( data . account . balanceFree ) } </ DetailValue >
99+ </ DetailRow >
100+ < DetailRow >
101+ < DetailLabel > Staked Balance:</ DetailLabel >
102+ < DetailValue > { formatTORUS ( data . account . balanceStaked ) } </ DetailValue >
103+ </ DetailRow >
104+ </ div >
105+ ) }
83106
84- < TerminalTabs
85- tabs = { [
86- {
87- label : 'Transfers' ,
88- content : < AccountTransfers />
89- } ,
90- {
91- label : 'Extrinsics' ,
92- content : < AccountExtrinsics />
93- } ,
94- {
95- label : 'Delegations' ,
96- content : < div > Coming soon..</ div >
97- }
98- ] }
99- />
107+ < TerminalTabs
108+ tabs = { [
109+ {
110+ label : 'Transfers' ,
111+ content : < AccountTransfers />
112+ } ,
113+ {
114+ label : 'Extrinsics' ,
115+ content : < AccountExtrinsics />
116+ } ,
117+ {
118+ label : 'Delegations' ,
119+ content : < div > Coming soon..</ div >
120+ }
121+ ] }
122+ />
100123
101- { /*<AccountTransfers />*/ }
102- { /*{(data?.transfers?.totalCount ?? 0) > 0 && (*/ }
103- { /* <div style={{padding: '8px 0',*/ }
104- { /* borderTop: '1px solid #0050a1'}}>*/ }
105- { /* <DataTable names={['Amount', 'From', 'To', 'Height', 'Timestamp']} records={data.transfers.nodes.map((transfer: { id: string; amount: number; from: string; to: string; blockNumber: string; timestamp: string | number | Date }) => {*/ }
106- { /* return {id: transfer.id, data: [formatTORUS(transfer.amount), <Link to={`/account/${transfer.from}`}><ResponsiveAddress address={transfer.from}/></Link>, <Link to={`/account/${transfer.to}` }><ResponsiveAddress address={transfer.to}/></Link>, transfer.blockNumber, new Date(transfer.timestamp).toLocaleString()*/ }
107- { /* ]}*/ }
108- { /* }) } /></div>*/ }
109- { /*)}*/ }
110- </ TerminalWindow >
124+ </ TerminalWindow >
125+ </ >
111126 )
112127}
0 commit comments