Skip to content
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

feature, fix: add my assets on sidebar and fix fa1.2 #163

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions components/RenderProposalContentLambda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ export type data =
rawParams: undefined | string;
}
| {
type: "TransferFA2" | "TransferFA1_2" | "ApproveFA1_2";
type: "TransferFA2";
label: undefined | string;
metadata: undefined | string;
amount: undefined | BigNumber;
addresses: undefined | string;
entrypoints: undefined | string;
params: undefined | fa2Tokens | fa1_2Token;
params: undefined | fa2Tokens;
rawParams: undefined | string;
}
| {
type: "TransferFA1_2" | "ApproveFA1_2";
label: undefined | string;
metadata: undefined | string;
amount: undefined | BigNumber;
addresses: undefined | string;
entrypoints: undefined | string;
params: undefined | fa1_2Token;
rawParams: undefined | string;
}
| {
Expand Down Expand Up @@ -497,23 +507,19 @@ const RenderProposalContentLambda = ({
} mt-2 overflow-auto whitespace-pre-wrap rounded bg-zinc-900 px-4 py-4 font-light`}
>
{!!data.params ? (
typeof data.params !== "string" ? (
"fa1_2_address" in data.params ? (
data.addresses?.at(0) && data.amount instanceof BigNumber ? (
<FA1_2Display
data={data.params}
to={data.addresses.at(0)}
amount={data.amount}
/>
) : (
JSON.stringify(data.params)
)
data.type === "ApproveFA1_2" || data.type === "TransferFA1_2" ? (
data.amount !== undefined ? (
<FA1_2Display
data={data.params}
to={data.addresses}
amount={data.amount}
/>
) : (
<FA2Display data={data.params} />
JSON.stringify(data.params)
)
) : data.type !== "ApproveFA1_2" &&
data.type !== "TransferFA1_2" &&
data.type !== "TransferFA2" ? (
) : data.type === "TransferFA2" ? (
<FA2Display data={data.params} />
) : typeof data.params === "string" ? (
data.params
) : (
JSON.stringify(data.params)
Expand Down
76 changes: 76 additions & 0 deletions components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import React, {
useMemo,
useState,
} from "react";
import { PREFERED_NETWORK } from "../context/config";
import {
AppDispatchContext,
AppStateContext,
Expand Down Expand Up @@ -279,6 +280,81 @@ const Sidebar = ({
</Select.Root>

<div className="mt-8 flex flex-col space-y-4">
<a
href={`https://${PREFERED_NETWORK}.tzkt.io/${state.currentContract}/balances/`}
target="_blank"
rel="noreferrer"
className={linkClass(false, isLoading)}
>
<svg
width="20px"
height="20px"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect
x="3"
y="7"
width="18"
height="14"
rx="2"
stroke="currentColor"
stroke-width="2"
/>
<path
d="M7 7V5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2"
stroke="currentColor"
stroke-width="2"
/>
<rect
x="11"
y="11"
width="2"
height="4"
rx="1"
fill="currentColor"
/>
<circle
cx="12"
cy="16"
r="1"
stroke="currentColor"
stroke-width="2"
/>
</svg>
<span>All Assets </span>

<svg
width="10px"
height="10px"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M15 3h6v6"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M10 14L21 3"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</a>
<Link
href={`/${state.currentContract}/proposals`}
className={linkClass(
Expand Down
Loading