Skip to content

Commit

Permalink
feat(app): removing JSON button and popup (passportxyz#2649)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianHymer authored Jul 2, 2024
1 parent 761ab01 commit ed5ace6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 73 deletions.
34 changes: 0 additions & 34 deletions app/__tests__/pages/Dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,40 +56,6 @@ beforeEach(() => {
]);
});

describe("when the user has a passport", () => {
it("shows Passport JSON button", () => {
renderWithContext(
mockCeramicContext,
<Router>
<Dashboard />
</Router>
);

expect(screen.getByTestId("button-passport-json")).toBeInTheDocument();
});
});

describe("when the user clicks Passport JSON", () => {
it("it should display a modal", async () => {
renderWithContext(
mockCeramicContext,
<Router>
<Dashboard />
</Router>
);

const buttonPassportJson = screen.queryByTestId("button-passport-json");

fireEvent.click(buttonPassportJson!);

const verifyModal = await screen.findByRole("dialog");
const buttonDone = screen.getByTestId("button-passport-json-done");

expect(verifyModal).toBeInTheDocument();
expect(buttonDone).toBeInTheDocument();
});
});

describe("dashboard notifications", () => {
// using https://www.npmjs.com/package/jest-localstorage-mock to mock localStorage
beforeEach(async () => {
Expand Down
41 changes: 2 additions & 39 deletions app/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Link from "next/link";
// --Components
import PageRoot from "../components/PageRoot";
import { CardList } from "../components/CardList";
import { JsonOutputModal } from "../components/JsonOutputModal";
import WelcomeFooter from "../components/WelcomeFooter";
import Header from "../components/Header";
import BodyWrapper from "../components/BodyWrapper";
Expand All @@ -19,16 +18,7 @@ import { DashboardValidStampsPanel } from "../components/DashboardValidStampsPan
import { ExpiredStampsPanel } from "../components/ExpiredStampsPanel";

// --Chakra UI Elements
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalOverlay,
Spinner,
useDisclosure,
useToast,
} from "@chakra-ui/react";
import { Modal, ModalBody, ModalContent, ModalFooter, ModalOverlay, useDisclosure, useToast } from "@chakra-ui/react";

import { CeramicContext, IsLoadingPassportState } from "../context/ceramicContext";
import { useWalletStore } from "../context/walletStore";
Expand All @@ -53,7 +43,7 @@ const fail = "../assets/verification-failed-bright.svg";
export default function Dashboard() {
const customization = useCustomization();
const { useCustomDashboardPanel } = customization;
const { passport, isLoadingPassport, allPlatforms, verifiedPlatforms, databaseReady } = useContext(CeramicContext);
const { isLoadingPassport, allPlatforms, verifiedPlatforms, databaseReady } = useContext(CeramicContext);
const { disconnect, dbAccessTokenStatus, dbAccessToken, did } = useDatastoreConnectionContext();
const address = useWalletStore((state) => state.address);
const { initiateVerification } = useOneClickVerification();
Expand Down Expand Up @@ -94,8 +84,6 @@ export default function Dashboard() {

const { refreshScore } = useContext(ScorerContext);

const { isOpen, onOpen, onClose } = useDisclosure();

const navigateToPage = useNavigateToPage();

// ------------------- BEGIN Data items for Google Tag Manager -------------------
Expand Down Expand Up @@ -248,14 +236,6 @@ export default function Dashboard() {
</ProcessingPopup>
)}

<JsonOutputModal
isOpen={isOpen}
onClose={onClose}
title={"Passport JSON"}
subheading={"You can find the Passport JSON data below"}
jsonOutput={passport}
/>

{isLoadingPassport == IsLoadingPassportState.FailedToConnect && retryModal}
</>
);
Expand All @@ -270,23 +250,6 @@ export default function Dashboard() {
<div className={className}>
<div className="flex items-center ">
<span className="mr-20 font-heading text-5xl">My {filterName && `${filterName} `}Stamps</span>
{passport ? (
<button
data-testid="button-passport-json"
className="h-8 w-8 rounded-md border border-background-2 bg-background-4 text-foreground-3"
onClick={onOpen}
title="View Passport JSON"
>
{`</>`}
</button>
) : (
<div
data-testid="loading-spinner-passport"
className="flex flex-row items-center rounded-md border-2 border-background-2 bg-background-4 px-[6px] py-1"
>
<Spinner className="my-[2px]" thickness="2px" speed="0.65s" emptyColor="darkGray" color="gray" size="sm" />
</div>
)}
</div>
{filterName && (
<div>
Expand Down

0 comments on commit ed5ace6

Please sign in to comment.