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

Remove fingerprint icon from authenticate page #310

Merged
merged 1 commit into from
May 28, 2024
Merged
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
26 changes: 2 additions & 24 deletions packages/keychain/src/components/Auth/Authenticate.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import React, { useEffect, useState, useCallback, useMemo } from "react";
import React, { useEffect, useState, useCallback } from "react";
import { Button } from "@chakra-ui/react";
import { Unsupported } from "./Unsupported";
import { doSignup } from "hooks/account";
import {
FaceIDDuoIcon,
FingerprintDuoIcon,
QRCodeDuoIcon,
} from "@cartridge/ui";
import { Container } from "../Container";
import { PortalBanner } from "components/PortalBanner";
import { PortalFooter } from "components/PortalFooter";
import { requestStorageDropCookie } from "./utils";

type UserAgent = "ios" | "android" | "other";
type AuthAction = "signup" | "login";
``;

export function Authenticate({
name,
action,
Expand All @@ -25,7 +19,6 @@ export function Authenticate({
onSuccess: () => void;
}) {
const [isLoading, setIsLoading] = useState(false);
const [userAgent, setUserAgent] = useState<UserAgent>("other");
const [unsupportedMessage, setUnsupportedMessage] = useState<string>();

const onAuth = useCallback(async () => {
Expand Down Expand Up @@ -61,23 +54,9 @@ export function Authenticate({
`iOS ${iosVersion[1]} does not support passkeys. Upgrade to iOS 16 to continue`,
);
}
setUserAgent("ios");
} else if (/android/i.test(userAgent)) {
setUserAgent("android");
}
}, []);

const Icon = useMemo(() => {
switch (userAgent) {
case "ios":
return FaceIDDuoIcon;
case "android":
return QRCodeDuoIcon;
case "other":
return FingerprintDuoIcon;
}
}, [userAgent]);

if (unsupportedMessage) {
return <Unsupported message={unsupportedMessage} />;
}
Expand All @@ -98,7 +77,6 @@ export function Authenticate({
<>
<Container hideAccount>
<PortalBanner
Icon={action === "signup" && Icon}
title={title}
description={description}
/>
Expand Down
Loading