Skip to content

Commit

Permalink
import all platform & provider configs from @gitcoin/passport-platforms
Browse files Browse the repository at this point in the history
and remove PLATFORM_ID and PROVIDER_ID types from platforms package, and leave them in types package
  • Loading branch information
aminah-io authored May 22, 2023
2 parents 7f22753 + 9ea0053 commit 519b335
Show file tree
Hide file tree
Showing 25 changed files with 186 additions and 768 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, screen, fireEvent } from "@testing-library/react";
import { RefreshMyStampsModalContentCard } from "../../components/RefreshMyStampsModalContentCard";
import { PlatformSpec, PROVIDER_ID } from "@gitcoin/passport-platforms/src/types";
import { PLATFORM_ID } from "@gitcoin/passport-types";
import { PlatformSpec } from "@gitcoin/passport-platforms/src/types";
import { PLATFORM_ID, PROVIDER_ID } from "@gitcoin/passport-types";
import { ValidatedProviderGroup } from "../../signer/utils";

beforeAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion app/__tests__/components/RefreshMyStampsSelector.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen, fireEvent } from "@testing-library/react";
import { RefreshMyStampsSelector } from "../../components/RefreshMyStampsSelector";
import { PROVIDER_ID } from "@gitcoin/passport-platforms/src/types";
import { PROVIDER_ID } from "@gitcoin/passport-types";
import { ValidatedProviderGroup } from "../../signer/utils";

const mockSetSelectedProviders = jest.fn();
Expand Down
5 changes: 3 additions & 2 deletions app/components/CardList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// --- React Methods
import React, { useContext, useEffect, useRef, useState } from "react";

import { PLATFORMS, PlatformSpec } from "../config/platforms";
import { PLATFORMS } from "../config/platforms";
import { PlatformGroupSpec, STAMP_PROVIDERS, UpdatedPlatforms } from "../config/providers";
import { PlatformSpec } from "@gitcoin/passport-platforms";

// --- Components
import { LoadingCard } from "./LoadingCard";
Expand All @@ -13,7 +14,7 @@ import { SideBarContent } from "./SideBarContent";

// --- Chakra UI Elements
import { Drawer, DrawerOverlay, useDisclosure } from "@chakra-ui/react";
import { PLATFORM_ID, PROVIDER_ID } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PLATFORM_ID, PROVIDER_ID } from "@gitcoin/passport-types";
import { CeramicContext } from "../context/ceramicContext";
import { PlatformCard } from "./PlatformCard";
import PageWidthGrid from "../components/PageWidthGrid";
Expand Down
2 changes: 1 addition & 1 deletion app/components/DoneToastContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// --- React Methods
import React from "react";

import { PLATFORM_ID, PROVIDER_ID } from "@gitcoin/passport-platforms/src/types";
import { PLATFORM_ID, PROVIDER_ID } from "@gitcoin/passport-types";

export type CustomToastProps = {
platformId?: PLATFORM_ID | undefined;
Expand Down
7 changes: 3 additions & 4 deletions app/components/ExpiredStampModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useContext, useEffect, useState } from "react";
import { Button, Modal, ModalContent, ModalOverlay, Spinner, useToast } from "@chakra-ui/react";
import { useContext, useState } from "react";
import { Modal, ModalContent, ModalOverlay, Spinner, useToast } from "@chakra-ui/react";
import { CeramicContext } from "../context/ceramicContext";
import { getPlatformSpec } from "../config/platforms";
import { STAMP_PROVIDERS } from "../config/providers";
import { PLATFORM_ID, PROVIDER_ID } from "@gitcoin/passport-types";
import { completedIcon } from "./Progress";
import { PLATFORMS, PlatformSpec } from "../config/platforms";
import { STAMP_PROVIDERS } from "../config/providers";

export type ExpiredStampModalProps = {
isOpen: boolean;
Expand Down
11 changes: 9 additions & 2 deletions app/components/GenericPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import React, { useContext, useEffect, useMemo, useState } from "react";
import { datadogLogs } from "@datadog/browser-logs";

// --- Identity tools
import { Stamp, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types";
import {
Stamp,
VerifiableCredential,
CredentialResponseBody,
VerifiableCredentialRecord,
PROVIDER_ID,
PLATFORM_ID,
} from "@gitcoin/passport-types";
import { ProviderPayload } from "@gitcoin/passport-platforms";
import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials";

Expand All @@ -20,7 +27,7 @@ import { CeramicContext } from "../context/ceramicContext";
import { UserContext } from "../context/userContext";

// --- Types
import { PlatformGroupSpec, PROVIDER_ID, PLATFORM_ID } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PlatformGroupSpec } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PlatformClass } from "@gitcoin/passport-platforms";
import { getPlatformSpec } from "@gitcoin/passport-platforms/dist/commonjs/platforms-config";

Expand Down
10 changes: 8 additions & 2 deletions app/components/RefreshMyStampsModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import { useState, useEffect, useContext } from "react";
import { useNavigate } from "react-router-dom";

// --- Types
import { PlatformGroupSpec, PROVIDER_ID, PLATFORM_ID } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PlatformGroupSpec } from "@gitcoin/passport-platforms/dist/commonjs/types";

// --- Identity tools
import { Stamp, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types";
import {
Stamp,
VerifiableCredential,
VerifiableCredentialRecord,
PROVIDER_ID,
PLATFORM_ID,
} from "@gitcoin/passport-types";
import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials";

// --- Contexts
Expand Down
3 changes: 2 additions & 1 deletion app/components/RefreshMyStampsModalContentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { ValidatedProviderGroup } from "../signer/utils";
import { Switch, Accordion, AccordionItem, AccordionButton, AccordionPanel, AccordionIcon } from "@chakra-ui/react";

// --- Utils
import { PlatformSpec, PROVIDER_ID } from "@gitcoin/passport-platforms/src/types";
import { PlatformSpec } from "@gitcoin/passport-platforms";
import { PROVIDER_ID } from "@gitcoin/passport-types";

// --- App components
import { RefreshMyStampsSelector } from "../components/RefreshMyStampsSelector";
Expand Down
2 changes: 1 addition & 1 deletion app/components/RefreshMyStampsModalContentCardList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// --- Types
import { getPlatformSpec } from "../config/platforms";
import { PROVIDER_ID } from "@gitcoin/passport-platforms/src/types";
import { PROVIDER_ID } from "@gitcoin/passport-types";

// --- App components
import { RefreshMyStampsModalContentCard } from "./RefreshMyStampsModalContentCard";
Expand Down
6 changes: 4 additions & 2 deletions app/components/SideBarContent.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, { useEffect, useState } from "react";

// --- Chakra UI Elements
import { DrawerBody, DrawerHeader, DrawerContent, DrawerCloseButton, Switch, Spinner } from "@chakra-ui/react";
import { DrawerBody, DrawerHeader, DrawerContent, DrawerCloseButton, Spinner } from "@chakra-ui/react";

import { PlatformSpec, PlatformGroupSpec, PROVIDER_ID } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PlatformSpec, PlatformGroupSpec } from "@gitcoin/passport-platforms/dist/commonjs/types";

import { PROVIDER_ID } from "@gitcoin/passport-types";

import { StampSelector } from "./StampSelector";
import { PlatformDetails } from "./PlatformDetails";
Expand Down
2 changes: 1 addition & 1 deletion app/components/StampSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouter } from "next/router";
import { Switch } from "@chakra-ui/react";
import { PROVIDER_ID } from "@gitcoin/passport-types";
import { PlatformSpec } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PlatformSpec } from "@gitcoin/passport-platforms";
import { PlatformGroupSpec } from "../config/providers";
import { getStampProviderFilters } from "../config/filters";
import { OnChainContext, OnChainProvidersType } from "../context/onChainContext";
Expand Down
2 changes: 1 addition & 1 deletion app/components/WelcomeBack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useContext, useState } from "react";
import { useNavigate } from "react-router-dom";

// --- Types
import { PLATFORM_ID } from "@gitcoin/passport-platforms/dist/commonjs/types";
import { PLATFORM_ID } from "@gitcoin/passport-types";
import { PlatformProps } from "../components/GenericPlatform";

// --- Contexts
Expand Down
232 changes: 48 additions & 184 deletions app/config/platforms.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import { PLATFORM_ID } from "@gitcoin/passport-types";

export type PlatformSpec = {
icon?: string | undefined;
platform: PLATFORM_ID;
name: string;
description: string;
connectMessage: string;
isEVM?: boolean;
};
import {
PlatformSpec,
Brightid,
Coinbase,
Discord,
Ens,
ETH,
Facebook,
Gitcoin,
Github,
GitPOAP,
GnosisSafe,
Google,
GTC,
GtcStaking,
GuildXYZ,
Lens,
Linkedin,
NFT,
POAP,
Poh,
Snapshot,
Twitter,
ZkSync,
} from "@gitcoin/passport-platforms";

export const getPlatformSpec = (platformName: string): PlatformSpec | undefined => {
let platformspec: PlatformSpec | undefined = undefined;
Expand All @@ -20,178 +35,27 @@ export const getPlatformSpec = (platformName: string): PlatformSpec | undefined
};

export const PLATFORMS: PlatformSpec[] = [
{
icon: "./assets/gtcPossessionStampIcon.svg",
platform: "GTC",
name: "GTC",
description: "Connect your wallet to confirm GTC possession",
connectMessage: "Verify Ownership",
isEVM: true,
},
{
icon: "./assets/gtcStakingLogoIcon.svg",
platform: "GtcStaking",
name: "GTC Staking",
description: "Connect your wallet to verify your staked amount. This accesses your Passport data.",
connectMessage: "Verify Account",
isEVM: true,
},
{
icon: "./assets/gtcGrantsLightIcon.svg",
platform: "Gitcoin",
name: "Gitcoin Grants",
description: "Connect your wallet to review your donation activity on Gitcoin (Up to GR15).",
connectMessage: "Connect Account",
},
{
icon: "./assets/twitterStampIcon.svg",
platform: "Twitter",
name: "Twitter",
description: "Connect your Twitter account to verify stamp details.",
connectMessage: "Connect Account",
},
{
icon: "./assets/discordStampIcon.svg",
platform: "Discord",
name: "Discord",
description: "Connect your Discord account to verify stamp details.",
connectMessage: "Connect Account",
},
{
icon: "./assets/googleStampIcon.svg",
platform: "Google",
name: "Google",
description: "Connect your Google Account to verify stamp details.",
connectMessage: "Connect Account",
},
{
icon: "./assets/githubWhiteStampIcon.svg",
platform: "Github",
name: "Github",
description: "Connect your Github account to verify stamp details.",
connectMessage: "Connect Account",
},
{
icon: "./assets/facebookStampIcon.svg",
platform: "Facebook",
name: "Facebook",
description: "Connect your Facebook account to verify stamp details.",
connectMessage: "Connect Account",
},
{
icon: "./assets/linkedinStampIcon.svg",
platform: "Linkedin",
name: "Linkedin",
description: "Connect your LinkedIn account to verify stamp details.",
connectMessage: "Connect Account",
},
{
icon: "./assets/ensStampIcon.svg",
platform: "Ens",
name: "ENS",
description: "Verify your ENS account. If you do not have one, you can purchase one.",
connectMessage: "Verify Ownership",
isEVM: true,
},
{
icon: "./assets/poapStampIcon.svg",
platform: "POAP",
name: "POAP",
description: "Verify POAP ownership (POAP must be atleast 15 days old).",
connectMessage: "Verify Ownership",
isEVM: true,
},
{
icon: "./assets/brightidStampIcon.svg",
platform: "Brightid",
name: "BrightID",
description:
"Verify your BrightID connection details. If you do not have BrightID, you can join a connection party.",
connectMessage: "Verify Account",
isEVM: true,
},
{
icon: "./assets/pohStampIcon.svg",
platform: "Poh",
name: "Proof of Humanity",
description: "Verify you have a Proof of Humanity profile.",
connectMessage: "Verify Account",
isEVM: true,
},
{
icon: "./assets/ethereumStampIcon.svg",
platform: "ETH",
name: "ETH",
description: "Connect your account to verify ETH possession and transaction volume.",
connectMessage: "Verify Account",
isEVM: true,
},
// {
// icon: "./assets/ethStampIcon.svg",
// platform: "Signer",
// name: "Ethereum Account",
// description: "Additional Ethereum account",
// connectMessage: "Connect Account",
// },
{
icon: "./assets/snapshotStampIcon.svg",
platform: "Snapshot",
name: "Snapshot",
description: "Connect your account to verify Snapshot stamp details.",
connectMessage: "Verify Account",
isEVM: true,
},
{
icon: "./assets/gitPOAPStampIcon.svg",
platform: "GitPOAP",
name: "GitPOAP",
description: "Connect your account to verify GitPOAP Verification.",
connectMessage: "Connect Account",
},
{
icon: "./assets/nftStampIcon.svg",
platform: "NFT",
name: "NFT Holder",
description: "Connect your wallet and confirm you own an NFT.",
connectMessage: "Confirm Ownership",
},
{
icon: "./assets/zksyncStampIcon.svg",
platform: "ZkSync",
name: "ZkSync",
description: "Connect your wallet to verify ZkSync transactions.",
connectMessage: "Connect Wallet",
isEVM: true,
},
{
icon: "./assets/lensWhiteStampIcon.svg",
platform: "Lens",
name: "Lens",
description: "Connect your wallet to verify ownership of a Lens Profile.",
connectMessage: "Connect Walllet",
isEVM: true,
},
{
icon: "./assets/gnosisSafeStampIcon.svg",
platform: "GnosisSafe",
name: "Gnosis Safe",
description: "Connect your wallet to verify Gnosis Safe Signer/Owner Verification",
connectMessage: "Connect Wallet",
},
{
icon: "./assets/coinbaseStampIcon.svg",
platform: "Coinbase",
name: "Coinbase",
description: "Connect your Coinbase account to verify stamp details.",
connectMessage: "Connect Account",
isEVM: false,
},
{
icon: "./assets/guildXYZStampIcon.svg",
platform: "GuildXYZ",
name: "Guild Membership and Roles",
description: "Connect your Guild XYZ account to verify your memberships.",
connectMessage: "Verify Guilds",
isEVM: true,
},
GTC.GTCPlatformDetails,
GtcStaking.GTCStakingPlatformDetails,
Gitcoin.gitcoinPlatformDetails,
Twitter.TwitterPlatformDetails,
Discord.DiscordPlatformDetails,
Google.GooglePlatformDetails,
Github.GithubPlatformDetails,
Facebook.FacebookPlatformDetails,
Linkedin.LinkedinPlatformDetails,
Ens.EnsPlatformDetails,
POAP.POAPPlatformDetails,
Brightid.BrightidPlatformDetails,
Poh.PohPlatformDetails,
ETH.ETHPlatformDetails,
Snapshot.SnapshotPlatformDetails,
GitPOAP.GitPOAPPlatformDetails,
NFT.NFTPlatformDetails,
ZkSync.ZkSyncPlatformDetails,
Lens.LensPlatformDetails,
GnosisSafe.GnosisSafePlatformDetails,
Coinbase.CoinbasePlatformDetails,
GuildXYZ.GuildXYZPlatformDetails,
// Signer.SignerPlatformDetails,
];
Loading

0 comments on commit 519b335

Please sign in to comment.