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

pre-launch styling followups #2136

Merged
merged 7 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand Down Expand Up @@ -116,7 +116,7 @@ export const AddOnsModal = (): JSX.Element | null => {
fontSize={16}
fontWeight={500}
>
{addOn.claim.ticket.ticketName.toUpperCase()}
{addOn.claim.ticket.ticketName}
</Typography>
</QRContainer>
);
Expand Down
59 changes: 19 additions & 40 deletions apps/passport-client/new-components/screens/Home/NewHomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { appConfig } from "../../../src/appConfig";
import {
useDispatch,
useIsDownloaded,
useIsSyncSettled,
usePCDCollection,
useScrollTo,
useSelf,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand All @@ -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) {
Expand Down Expand Up @@ -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("");
Expand All @@ -253,7 +257,7 @@ export const NewHomeScreen = (): ReactElement => {
params,
collection,
setParams,
isDownloaded,
isReadyToLoadPage,
location,
dispatch,
showPodsList,
Expand All @@ -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;

Expand All @@ -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,
Expand All @@ -307,24 +303,14 @@ 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();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

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
Expand All @@ -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 (
<AppContainer fullscreen={true} bg="gray">
<LoadingScreenContainer>
Expand All @@ -366,7 +352,7 @@ export const NewHomeScreen = (): ReactElement => {
fontWeight={800}
color="var(--text-tertiary)"
>
GENERATING PODS
{isDownloaded ? "COLLECTING PODS" : "GENERATING PODS"}
</Typography>
</LoadingScreenContainer>
</AppContainer>
Expand Down Expand Up @@ -402,14 +388,7 @@ export const NewHomeScreen = (): ReactElement => {
<>
<MaxWidthContainer>
{!(showPodsList || noPods) && <Spacer h={96} />}
<SwipeViewContainer
onMouseDown={() => setHolding(true)}
onMouseUp={() => setHolding(false)}
onMouseLeave={() => setHolding(false)}
style={{
cursor: holding ? "grabbing" : "grab"
}}
>
<SwipeViewContainer>
<_SwipableViews
style={{
padding: `0 ${SCREEN_HORIZONTAL_PADDING - CARD_GAP / 2}px`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown, unknown>
): pcd is TicketType => {
Expand Down Expand Up @@ -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]);
Expand Down
3 changes: 3 additions & 0 deletions apps/passport-client/public/global-zupass.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ html {
system-ui,
sans-serif;
line-height: 1.5;

-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

body {
Expand Down
2 changes: 1 addition & 1 deletion apps/passport-client/src/password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions apps/passport-server/resources/one-click-page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/eddsa-ticket-pcd-ui/src/CardBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<QRIcon />
</NEW_UI__ExtraSection>
)}
<NEW_UI__ExtraSection style={{ justifyContent: "center" }}>
<NEW_UI__ExtraSection style={{ justifyContent: "center", cursor: "default" }}>

Check failure on line 125 in packages/ui/eddsa-ticket-pcd-ui/src/CardBody.tsx

View workflow job for this annotation

GitHub Actions / Build-and-Test

Replace `·style={{·justifyContent:·"center",·cursor:·"default"·}}` with `⏎··········style={{·justifyContent:·"center",·cursor:·"default"·}}⏎········`
<ExtraSectionSecondaryText>
QR POD • ZK powered by ZUPASS
</ExtraSectionSecondaryText>
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/pod-pcd-ui/src/CardBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}}
>
<Text
style={{
paddingRight: isValidSig ? 2 : 8,
color: "var(--core-accent)"
color: isValidSig ? "#5B952C" : "var(--core-accent)"
}}
>
{sigStatus === 0
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/pod-ticket-pcd-ui/src/CardBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export function PODTicketCardBodyImpl({
<QRIcon />
</NEW_UI__ExtraSection>
)}
<NEW_UI__ExtraSection style={{ justifyContent: "center" }}>
<NEW_UI__ExtraSection
style={{ justifyContent: "center", cursor: "default" }}
>
<ExtraSectionSecondaryText>
QR POD • ZK powered by ZUPASS
</ExtraSectionSecondaryText>
Expand Down
Loading