diff --git a/apps/passport-client/new-components/screens/Home/AddOnModal.tsx b/apps/passport-client/new-components/screens/Home/AddOnModal.tsx index 634af02dc8..2b98c68347 100644 --- a/apps/passport-client/new-components/screens/Home/AddOnModal.tsx +++ b/apps/passport-client/new-components/screens/Home/AddOnModal.tsx @@ -1,3 +1,4 @@ +import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/16/solid"; import { useCallback, useState } from "react"; import SwipeableViews from "react-swipeable-views"; import styled, { FlattenSimpleInterpolation, css } from "styled-components"; @@ -7,7 +8,6 @@ import { BottomModal } from "../../shared/BottomModal"; import { Button2 } from "../../shared/Button"; import { Typography } from "../../shared/Typography"; import { useTrackpadSwipe } from "./hooks/useTrackpadSwipe"; -import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/16/solid"; // @ts-expect-error TMP fix for bad lib const _SwipableViews = SwipeableViews.default; @@ -116,7 +116,7 @@ export const AddOnsModal = (): JSX.Element | null => { fontSize={16} fontWeight={500} > - {addOn.claim.ticket.ticketName.toUpperCase()} + {addOn.claim.ticket.ticketName} ); diff --git a/apps/passport-client/new-components/screens/Home/NewHomeScreen.tsx b/apps/passport-client/new-components/screens/Home/NewHomeScreen.tsx index 80bf1ffb13..0a128518f5 100644 --- a/apps/passport-client/new-components/screens/Home/NewHomeScreen.tsx +++ b/apps/passport-client/new-components/screens/Home/NewHomeScreen.tsx @@ -12,6 +12,7 @@ import { appConfig } from "../../../src/appConfig"; import { useDispatch, useIsDownloaded, + useIsSyncSettled, usePCDCollection, useScrollTo, useSelf, @@ -41,10 +42,7 @@ import { TicketPack } from "./types"; import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/16/solid"; import { isEmailPCD } from "@pcd/email-pcd"; -import { - PCDGetRequest, - requestGenericIssuanceTicketPreviews -} from "@pcd/passport-interface"; +import { PCDGetRequest } from "@pcd/passport-interface"; import { Spacer } from "@pcd/passport-ui"; import { isSemaphoreIdentityPCD } from "@pcd/semaphore-identity-pcd"; import { @@ -180,9 +178,9 @@ export const NewHomeScreen = (): ReactElement => { const self = useSelf(); const navigate = useNavigate(); const isDownloaded = useIsDownloaded(); + const isSyncSettled = useIsSyncSettled(); const [params, setParams] = useSearchParams(); const [zappUrl, setZappUrl] = useState(""); - const [holding, setHolding] = useState(false); const isInvalidUser = useUserForcedToLogout(); const location = useLocation(); const regularParams = useParams(); @@ -204,9 +202,16 @@ export const NewHomeScreen = (): ReactElement => { }); const showPodsList = tickets.length === 0 && !isLandscape && !noPods; + // default wait for full sync, but "short-circuit" this process + // if finished downloading and already fetched devcon tickets, + // similar to https://github.com/proofcarryingdata/zupass/pull/2120 + const isReadyToLoadPage = + isSyncSettled || + (isDownloaded && collection.getAllPCDsInFolder("Devcon SEA").length > 0); + useLayoutEffect(() => { // if we haven't loaded all pcds yet, dont process the prove request - if (!isDownloaded) return; + if (!isReadyToLoadPage) return; const maybeExistingFolder = params.get("folder"); if (maybeExistingFolder) { @@ -244,7 +249,6 @@ export const NewHomeScreen = (): ReactElement => { type: "set-bottom-modal", modal: { request, modalType: "prove" } }); - console.log(request); return; } if (params.size > 0) setParams(""); @@ -253,7 +257,7 @@ export const NewHomeScreen = (): ReactElement => { params, collection, setParams, - isDownloaded, + isReadyToLoadPage, location, dispatch, showPodsList, @@ -267,8 +271,7 @@ export const NewHomeScreen = (): ReactElement => { : ""; const params = new URLSearchParams(queryString); const redirectHash = params.get("redirectHash"); - const { email, code, targetFolder, pipelineId, serverUrl } = - regularParams; + const { email, code, targetFolder } = regularParams; if (!email || !code) return; @@ -280,13 +283,6 @@ export const NewHomeScreen = (): ReactElement => { return; } - const previewRes = await requestGenericIssuanceTicketPreviews( - serverUrl ?? appConfig.zupassServer, - email, - code, - pipelineId - ); - await dispatch({ type: "one-click-login", email, @@ -307,16 +303,6 @@ export const NewHomeScreen = (): ReactElement => { setZappUrl(zappEntry[1]); return; } - - if (previewRes.success) { - dispatch({ - type: "scroll-to-ticket", - scrollTo: { - attendee: previewRes.value.tickets[0].attendeeEmail, - eventId: previewRes.value.tickets[0].eventId - } - }); - } } }; handleOneClick(); @@ -324,7 +310,7 @@ export const NewHomeScreen = (): ReactElement => { }, []); useEffect(() => { - if (scrollTo && isDownloaded && tickets.length > 0) { + if (scrollTo && isSyncSettled && tickets.length > 0) { // getting the pos of the event card const eventPos = tickets.findIndex( (pack) => pack[0] === scrollTo.eventId @@ -349,14 +335,14 @@ export const NewHomeScreen = (): ReactElement => { dispatch({ type: "scroll-to-ticket", scrollTo: undefined }); })(); } - }, [dispatch, scrollTo, currentPos, setCurrentPos, tickets, isDownloaded]); + }, [dispatch, scrollTo, currentPos, setCurrentPos, tickets, isSyncSettled]); const cardWidth = (windowWidth > MAX_WIDTH_SCREEN ? MAX_WIDTH_SCREEN : windowWidth) - SCREEN_HORIZONTAL_PADDING * 2; - // if not loaded pcds yet and the user session is valid - if (!isDownloaded && !isInvalidUser) { + // if not ready yet and the user session is valid + if (!isReadyToLoadPage && !isInvalidUser) { return ( @@ -366,7 +352,7 @@ export const NewHomeScreen = (): ReactElement => { fontWeight={800} color="var(--text-tertiary)" > - GENERATING PODS + {isDownloaded ? "COLLECTING PODS" : "GENERATING PODS"} @@ -402,14 +388,7 @@ export const NewHomeScreen = (): ReactElement => { <> {!(showPodsList || noPods) && } - setHolding(true)} - onMouseUp={() => setHolding(false)} - onMouseLeave={() => setHolding(false)} - style={{ - cursor: holding ? "grabbing" : "grab" - }} - > + <_SwipableViews style={{ padding: `0 ${SCREEN_HORIZONTAL_PADDING - CARD_GAP / 2}px` diff --git a/apps/passport-client/new-components/screens/Home/hooks/useTickets.ts b/apps/passport-client/new-components/screens/Home/hooks/useTickets.ts index 62ae1c539a..73d15f4e19 100644 --- a/apps/passport-client/new-components/screens/Home/hooks/useTickets.ts +++ b/apps/passport-client/new-components/screens/Home/hooks/useTickets.ts @@ -2,12 +2,12 @@ import { EdDSATicketPCDTypeName, isEdDSATicketPCD } from "@pcd/eddsa-ticket-pcd"; +import { PCD } from "@pcd/pcd-types"; import { isPODTicketPCD } from "@pcd/pod-ticket-pcd"; -import { TicketPack, TicketType, TicketTypeName } from "../types"; -import { usePCDs } from "../../../../src/appHooks"; import uniqWith from "lodash/uniqWith"; -import { PCD } from "@pcd/pcd-types"; import { useMemo } from "react"; +import { usePCDs } from "../../../../src/appHooks"; +import { TicketPack, TicketType, TicketTypeName } from "../types"; export const isEventTicketPCD = ( pcd: PCD ): pcd is TicketType => { @@ -80,12 +80,13 @@ export const useTickets = (): Array<[string, TicketPack[]]> => { const ticketPacks = eventsMap.get(ticket.claim.ticket.eventId); if (!ticketPacks) continue; const pack = ticketPacks.find( - (pack) => pack.attendeeEmail === ticket.claim.ticket.attendeeEmail + (pack) => + pack.eventTicket.claim.ticket.ticketId === + ticket.claim.ticket.parentTicketId ); if (!pack) continue; pack.addOns.push(ticket); } - console.log(Array.from(eventsMap.entries())); return Array.from(eventsMap.entries()); }, [uniqTickets]); diff --git a/apps/passport-client/public/global-zupass.css b/apps/passport-client/public/global-zupass.css index c5e4687326..0c9876ce46 100644 --- a/apps/passport-client/public/global-zupass.css +++ b/apps/passport-client/public/global-zupass.css @@ -51,6 +51,9 @@ html { system-ui, sans-serif; line-height: 1.5; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } body { diff --git a/apps/passport-client/src/password.ts b/apps/passport-client/src/password.ts index 09ba781354..407df89094 100644 --- a/apps/passport-client/src/password.ts +++ b/apps/passport-client/src/password.ts @@ -41,7 +41,7 @@ export const setPassword = async ( ); } else if (res.error.name === "Conflict") { update({ extraDownloadRequested: true }); - throw new Error(`Cannot change password while PCDs are syncing. + throw new Error(`Cannot change password while PODs are syncing. Wait for download to complete or reload the page and try again.`); } else { throw new Error( diff --git a/apps/passport-server/resources/one-click-page/index.html b/apps/passport-server/resources/one-click-page/index.html index 678c0bcecd..5b001b67f0 100644 --- a/apps/passport-server/resources/one-click-page/index.html +++ b/apps/passport-server/resources/one-click-page/index.html @@ -411,6 +411,7 @@ align-self: stretch; border-radius: 200px; background: var(--core-accent); + user-select: none; /* shadow-sm */ box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05); } diff --git a/apps/passport-server/src/routing/routes/genericIssuanceRoutes.ts b/apps/passport-server/src/routing/routes/genericIssuanceRoutes.ts index 089c5c58ca..aee707b059 100644 --- a/apps/passport-server/src/routing/routes/genericIssuanceRoutes.ts +++ b/apps/passport-server/src/routing/routes/genericIssuanceRoutes.ts @@ -827,7 +827,7 @@ export function initGenericIssuanceRoutes( .filter((addon) => addon.parentTicketId === ticket.ticketId) .map(async (addon) => ({ image: await getTicketImage(addon), - name: addon.ticketName.toUpperCase() + name: addon.ticketName })); return { diff --git a/packages/ui/eddsa-ticket-pcd-ui/src/CardBody.tsx b/packages/ui/eddsa-ticket-pcd-ui/src/CardBody.tsx index fb22d0c4fd..d04ec88bfd 100644 --- a/packages/ui/eddsa-ticket-pcd-ui/src/CardBody.tsx +++ b/packages/ui/eddsa-ticket-pcd-ui/src/CardBody.tsx @@ -122,7 +122,7 @@ function EdDSATicketPCDCardBody({ )} - + QR POD • ZK powered by ZUPASS diff --git a/packages/ui/pod-pcd-ui/src/CardBody.tsx b/packages/ui/pod-pcd-ui/src/CardBody.tsx index fb3227c8d8..5b35c379c8 100644 --- a/packages/ui/pod-pcd-ui/src/CardBody.tsx +++ b/packages/ui/pod-pcd-ui/src/CardBody.tsx @@ -82,12 +82,13 @@ function PODPCDCardBody({ style={{ color: isValidSig ? "#5B952C" : undefined, textDecoration: isValidSig ? "none" : undefined + // TODO: remove cursor pointer when we have a valid signature }} > {sigStatus === 0 diff --git a/packages/ui/pod-ticket-pcd-ui/src/CardBody.tsx b/packages/ui/pod-ticket-pcd-ui/src/CardBody.tsx index 99d21d05a5..df2e708ec2 100644 --- a/packages/ui/pod-ticket-pcd-ui/src/CardBody.tsx +++ b/packages/ui/pod-ticket-pcd-ui/src/CardBody.tsx @@ -120,7 +120,9 @@ export function PODTicketCardBodyImpl({ )} - + QR POD • ZK powered by ZUPASS