-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from algorandfoundation/chore/update-ui-compon…
…ents chore(dapp-ui): add transaction store
- Loading branch information
Showing
13 changed files
with
343 additions
and
126 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
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 Card from '@mui/material/Card'; | ||
import { CardHeader, Link } from '@mui/material'; | ||
import CardContent from '@mui/material/CardContent'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
export function EmptyAccountCard({ address }: { address: string }) { | ||
return ( | ||
<Card sx={{ flex: 1, margin: 1.25 }} raised> | ||
<CardHeader | ||
title="Account Not Funded" | ||
subheader={ | ||
<Link href="https://bank.testnet.algorand.network" target="_blank"> | ||
Visit the faucet to fund your account. | ||
</Link> | ||
} | ||
></CardHeader> | ||
<CardContent> | ||
<Typography>{address}</Typography> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
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,46 @@ | ||
import Card from '@mui/material/Card'; | ||
import CardContent from '@mui/material/CardContent'; | ||
import Typography from '@mui/material/Typography'; | ||
import { Message } from '@/store.ts'; | ||
import { CardHeader } from '@mui/material'; | ||
|
||
export function MessageCard({ msg }: { msg: Message }) { | ||
let message; | ||
const isLocal = msg.type === 'local'; | ||
switch (msg.data.type) { | ||
case 'credential': | ||
message = isLocal | ||
? `🔑 Credential Sent: ${msg.data.id}` | ||
: `🔑 Credential Received: ${msg.data.id}`; | ||
break; | ||
case 'transaction': | ||
message = isLocal | ||
? `🚚 Transaction Sent: ${msg.data.txId}` | ||
: `🚚 Transaction Received: ${msg.data.txId}`; | ||
break; | ||
case 'transaction-signature': | ||
message = isLocal | ||
? `🔏 Signature Sent: ${msg.data.txId}` | ||
: `🔏 Signature Received: ${msg.data.txId}`; | ||
break; | ||
default: | ||
message = 'Unknown message'; | ||
} | ||
return ( | ||
<Card sx={{ flex: 1, margin: 1.25 }} raised> | ||
<CardHeader | ||
title={`Peer: ${msg.type}`} | ||
subheader={new Date(msg.timestamp).toLocaleString()} | ||
> | ||
<Typography variant="h5" color="text.secondary"> | ||
Message | ||
</Typography> | ||
</CardHeader> | ||
<CardContent> | ||
<Typography variant="body1" color="text.secondary"> | ||
{message} | ||
</Typography> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
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,40 @@ | ||
import Card from '@mui/material/Card'; | ||
import { LiquidTransaction } from '@/store.ts'; | ||
import { CardHeader, Link } from '@mui/material'; | ||
|
||
export function TransactionCard({ txn }: { txn: LiquidTransaction }) { | ||
const isLive = txn.status === 'confirmed'; | ||
let emoji; | ||
switch (txn.status) { | ||
case 'confirmed': | ||
emoji = '✅'; | ||
break; | ||
case 'submitted': | ||
emoji = '🔵'; | ||
break; | ||
case 'failed': | ||
emoji = '❌'; | ||
break; | ||
default: | ||
emoji = '🟡'; | ||
} | ||
return ( | ||
<Card sx={{ flex: 1, margin: 1.25 }} raised> | ||
<CardHeader | ||
title={`${emoji} ${txn.txn.type} transaction: ${txn.status}`} | ||
subheader={ | ||
isLive ? ( | ||
<Link | ||
href={`https://testnet.explorer.perawallet.app/tx/${txn.txId}`} | ||
target="_blank" | ||
> | ||
{txn.txn.txID()} | ||
</Link> | ||
) : ( | ||
txn.txn.txID() | ||
) | ||
} | ||
></CardHeader> | ||
</Card> | ||
); | ||
} |
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
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.