Skip to content

Commit

Permalink
Copy POD text
Browse files Browse the repository at this point in the history
  • Loading branch information
artwyman committed Nov 15, 2024
1 parent 7746ee7 commit fe153e6
Showing 1 changed file with 37 additions and 19 deletions.
56 changes: 37 additions & 19 deletions packages/ui/pod-pcd-ui/src/renderers/DefaultPODPCDCardBody.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Card, HiddenText, styled, TextContainer } from "@pcd/passport-ui";
import {
Card,
CardWithCopy,
HiddenText,
styled,
TextContainer
} from "@pcd/passport-ui";
import { podEntriesToJSON } from "@pcd/pod";
import { PODPCD } from "@pcd/pod-pcd";

Expand All @@ -12,26 +18,38 @@ const StyledPre = styled.pre`
export function DefaultPODPCDCardBody({ pcd }: { pcd: PODPCD }): JSX.Element {
return (
<div style={{ display: "flex", gap: 8, flexDirection: "column" }}>
<TextContainer
style={{
overflow: "auto",
maxHeight: "280px",
backgroundColor: "#F6F8FD"
<CardWithCopy
title=""
onCopy={() => {
return navigator.clipboard.writeText(
JSON.stringify(pcd.pod.toJSON(), null, 2)
);
}}
>
<StyledPre>
{JSON.stringify(podEntriesToJSON(pcd.claim.entries), null, 2)}
</StyledPre>
</TextContainer>
<Card title="EdDSA PUBLIC KEY">
<HiddenText
text={pcd.claim.signerPublicKey}
style={{ overflowX: "auto" }}
/>
</Card>
<Card title="EdDSA SIGNATURE">
<HiddenText text={pcd.proof.signature} style={{ overflowX: "auto" }} />
</Card>
<TextContainer
style={{
overflow: "auto",
maxHeight: "280px",
backgroundColor: "#F6F8FD"
}}
>
<StyledPre>
{JSON.stringify(podEntriesToJSON(pcd.claim.entries), null, 2)}
</StyledPre>
</TextContainer>
<Card title="EdDSA PUBLIC KEY">
<HiddenText
text={pcd.claim.signerPublicKey}
style={{ overflowX: "auto" }}
/>
</Card>
<Card title="EdDSA SIGNATURE">
<HiddenText
text={pcd.proof.signature}
style={{ overflowX: "auto" }}
/>
</Card>
</CardWithCopy>
</div>
);
}

0 comments on commit fe153e6

Please sign in to comment.