Skip to content

Commit

Permalink
Hide accidental homescreen taps on laser mode (proofcarryingdata#1220)
Browse files Browse the repository at this point in the history
On laser mode:

- Remove the "X" on the scan screen
<img width="407" alt="Screenshot 2023-11-11 at 5 05 30 PM"
src="https://github.com/proofcarryingdata/zupass/assets/36896271/6bb9c327-643a-496f-9b3c-eb8a10d4792f">

- Remove "home" when scanning a ticket
<img width="399" alt="Screenshot 2023-11-11 at 5 09 26 PM"
src="https://github.com/proofcarryingdata/zupass/assets/36896271/8b113d36-9ff5-4e04-95fc-b7c094b8624b">
  • Loading branch information
rrrliu authored Nov 11, 2023
1 parent 1ab5d59 commit c75f20b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
CheckTicketByIdResult,
TicketError
} from "@pcd/passport-interface";
import { decodeQRPayload, Spacer } from "@pcd/passport-ui";
import { Spacer, decodeQRPayload } from "@pcd/passport-ui";
import { ZKEdDSAEventTicketPCDPackage } from "@pcd/zk-eddsa-event-ticket-pcd";
import { useCallback, useEffect, useState } from "react";
import styled from "styled-components";
Expand All @@ -12,6 +12,7 @@ import {
devconnectCheckByIdWithOffline,
devconnectCheckInByIdWithOffline
} from "../../src/checkin";
import { loadUsingLaserScanner } from "../../src/localstorage";
import { Button, H5 } from "../core";
import { RippleLoader } from "../core/RippleLoader";
import { AppContainer } from "../shared/AppContainer";
Expand Down Expand Up @@ -198,6 +199,7 @@ function TicketErrorContent({ error }: { error: TicketError }) {
}

function TicketError({ error }: { error: TicketError }) {
const usingLaserScanner = loadUsingLaserScanner();
return (
<>
<TicketErrorContent error={error} />
Expand All @@ -208,7 +210,7 @@ function TicketError({ error }: { error: TicketError }) {
}}
>
<ScanAnotherTicket />
<Home />
{!usingLaserScanner && <Home />}
</div>
</>
);
Expand Down Expand Up @@ -304,6 +306,7 @@ function CheckInSection({ ticketId }: { ticketId: string }) {
const [checkedIn, setCheckedIn] = useState(false);
const [finishedCheckinAttempt, setFinishedCheckinAttempt] = useState(false);
const [checkinError, setCheckinError] = useState<TicketError | null>(null);
const usingLaserScanner = loadUsingLaserScanner();

const onCheckInClick = useCallback(async () => {
if (inProgress) {
Expand Down Expand Up @@ -333,7 +336,7 @@ function CheckInSection({ ticketId }: { ticketId: string }) {
<Button onClick={onCheckInClick}>Check In</Button>
<Spacer h={8} />
<ScanAnotherTicket />
<Home />
{!usingLaserScanner && <Home />}
</>
)}
{inProgress && <RippleLoader />}
Expand All @@ -345,14 +348,14 @@ function CheckInSection({ ticketId }: { ticketId: string }) {
<CheckinSuccess>Checked In ✅</CheckinSuccess>
</StatusContainer>
<ScanAnotherTicket />
<Home />
{!usingLaserScanner && <Home />}
</>
) : (
<>
<TicketErrorContent error={checkinError} />
<Spacer h={16} />
<ScanAnotherTicket />
<Home />
{!usingLaserScanner && <Home />}
</>
)}
</>
Expand Down
1 change: 0 additions & 1 deletion apps/passport-client/components/screens/ScanScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export function ScanScreen() {
{usingLaserScanner && (
<>
<FullWidthRow>
<CloseButton />
<Spacer h={32} />
<TextCenter>
Press and hold down the <Orange>orange</Orange> scan button and
Expand Down

0 comments on commit c75f20b

Please sign in to comment.