-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Quentin Burg
committed
Apr 3, 2024
1 parent
990e572
commit 4e05db0
Showing
7 changed files
with
88 additions
and
49 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
8 changes: 4 additions & 4 deletions
8
components/HistoryFaToken.tsx → components/history/HistoryFaToken.tsx
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,40 @@ | ||
import { mutezToTez } from "../../utils/tez"; | ||
import Alias from "../Alias"; | ||
|
||
type HistoryTransferProps = { | ||
proposal: Array<unknown>; | ||
}; | ||
|
||
const HistoryTransfer = ({ proposal }: HistoryTransferProps) => { | ||
return ( | ||
<div | ||
key={(proposal[1] as any).timestamp} | ||
className="grid h-16 w-full grid-cols-3 items-center gap-8 rounded border-b border-zinc-900 bg-zinc-800 px-6 py-4 text-white lg:grid-cols-4" | ||
> | ||
<span className="justify-self-start font-bold md:ml-11"> | ||
<span className="hidden md:block">Received Tez</span> | ||
<span className="md:hidden">Received</span> | ||
</span> | ||
<span className="text-center font-light text-zinc-300 md:min-w-[7rem] md:text-left"> | ||
<span className="hidden md:inline">From:</span>{" "} | ||
<Alias address={(proposal[1] as any).sender.address} /> | ||
</span> | ||
<span className="truncate font-light text-zinc-300 md:min-w-[7rem]"> | ||
<span className="hidden md:inline">Amount:</span>{" "} | ||
{mutezToTez((proposal[1] as any).amount)} Tez | ||
</span> | ||
<span className="hidden justify-self-end lg:block"> | ||
{new Date((proposal[1] as any).timestamp).toLocaleDateString()} -{" "} | ||
{`${new Date((proposal[1] as any).timestamp) | ||
.getHours() | ||
.toString() | ||
.padStart(2, "0")}:${new Date((proposal[1] as any).timestamp) | ||
.getMinutes() | ||
.toString() | ||
.padStart(2, "0")}`} | ||
</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HistoryTransfer; |
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 { useEffect, useState } from "react"; | ||
import { TZKT_API_URL } from "../context/config"; | ||
|
||
export const useTzktAccountAlias = (accountAddress: string) => { | ||
const [alias, setAlias] = useState<string | undefined>(undefined); | ||
|
||
useEffect(() => { | ||
(async () => | ||
fetch(`${TZKT_API_URL}/v1/accounts/${accountAddress}`).then( | ||
async response => { | ||
if (response.status >= 200 && response.status < 300) { | ||
const json = await response.json(); | ||
if (json["alias"]) { | ||
setAlias(json["alias"]); | ||
} | ||
} | ||
} | ||
))(); | ||
}, [accountAddress]); | ||
|
||
return alias; | ||
}; |