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

feat(app): removing JSON button and popup #2649

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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 @@ -52,7 +42,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 @@ -93,8 +83,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 @@ -247,14 +235,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 @@ -269,23 +249,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
Loading