From b809a56ac7bff92c79deb22fae5f3a2c82e99976 Mon Sep 17 00:00:00 2001 From: TYRONE AVNIT Date: Mon, 12 Aug 2024 23:51:29 -0500 Subject: [PATCH] TECH-292 - Remove ICP React Component --- src/civic_sign_frontend_demo/src/App.tsx | 43 ------------------------ 1 file changed, 43 deletions(-) diff --git a/src/civic_sign_frontend_demo/src/App.tsx b/src/civic_sign_frontend_demo/src/App.tsx index 3d7452c..5c19f04 100644 --- a/src/civic_sign_frontend_demo/src/App.tsx +++ b/src/civic_sign_frontend_demo/src/App.tsx @@ -1,52 +1,9 @@ import React, { useEffect, useState, useCallback, useMemo } from 'react'; import { Principal } from '@dfinity/principal'; -import { CredentialService } from './service/CredentialService.js'; import { PrincipalService } from './service/PrincipalService.js'; import { config } from './config.js'; -import { GatewayProvider, GatewayStatus, useGateway } from '@civic/icp-gateway-react'; import ICPCredentialCheckButton from '@civic/icp-gateway-react-ui'; -function GatewayStatusLookup({ children, isLoggedIn }: { children: React.ReactNode; isLoggedIn: boolean }) { - const { gatewayStatus } = useGateway(); - const [urlCode, setUrlCode] = useState(null); - - useEffect(() => { - console.log('Gateway status:', gatewayStatus); - - // Parse the URL for the 'code' parameter - const urlParams = new URLSearchParams(window.location.search); - const code = urlParams.get('code'); - setUrlCode(code); - }, [gatewayStatus]); - - const retrievePass = () => { - const currentUrl = window.location.href; - const encodedRedirectUri = encodeURIComponent(currentUrl); - const passPortalUrl = `${config.portalUrl}/?redirect_uri=${encodedRedirectUri}`; - window.location.href = passPortalUrl; - }; - - const isActive = gatewayStatus === GatewayStatus.ACTIVE || urlCode === 'ACTIVE'; - - return ( - <> - {children} - {isLoggedIn && ( -
-

Gateway Status: {!isActive ? 'NOT_FOUND' : 'ACTIVE'}

- {isActive && ( -
-

Active status detected!

- Cool GIF for active status -
- )} -
- )} - {gatewayStatus === GatewayStatus.NOT_REQUESTED && } - - ); -} - function App() { const [principal, setPrincipal] = useState(undefined); const icpWallet = useMemo(() => ({ principal: principal?.toText() ?? undefined }), [principal]);