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

UI Phase2 - Adding new screens #1897

Draft
wants to merge 98 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
3d53613
chore(init): add new dev route for components
ororsatti Sep 19, 2024
3731d17
chore(init): add components screen to route
ororsatti Sep 19, 2024
5e27e95
initial typography
17Amir17 Sep 19, 2024
349bcf2
feat(background): add bg pattern and toggle
ororsatti Sep 19, 2024
a5bcb41
get font working
17Amir17 Sep 19, 2024
54382a5
nits
17Amir17 Sep 19, 2024
ab8d253
add hot reload
17Amir17 Sep 20, 2024
0538b3a
add mock ticket
17Amir17 Sep 21, 2024
f5f7f57
live reload
17Amir17 Sep 21, 2024
8885e90
doc live reload
17Amir17 Sep 21, 2024
efb2946
add ticket card
17Amir17 Sep 21, 2024
c950dc7
Update ComponentsScreen.tsx
17Amir17 Sep 21, 2024
8a0dfbf
update ticket card style
17Amir17 Sep 21, 2024
baf3880
add date chip
17Amir17 Sep 21, 2024
bf78404
feat(input): added variants and erorr state
ororsatti Sep 22, 2024
53eabd9
Add floating menu
GuySerfaty Sep 22, 2024
21b5cd1
feat(button): add btn variants: primary secondary danger
ororsatti Sep 22, 2024
c64574d
fix(button): added border to secondary variant
ororsatti Sep 22, 2024
d507c19
feat(font): added Neue Haas Unica font
ororsatti Sep 22, 2024
67793bc
feat(icon): add icon component
ororsatti Sep 22, 2024
f76cb6b
feat(list): added basic list and changed icon component to avatar
ororsatti Sep 22, 2024
b641863
fix(remove icon): remove the icon file and update component screeen
ororsatti Sep 22, 2024
f170f02
Add bottom modal
GuySerfaty Sep 22, 2024
a0d7191
feat(list): add prop to remove last bottom border
ororsatti Sep 22, 2024
a164adf
feat(list): add onclick to list item
ororsatti Sep 22, 2024
03080a3
fix(list): change main file name to index
ororsatti Sep 22, 2024
a050ad4
feat(accordion): add accordion component
ororsatti Sep 22, 2024
fad2ecd
fix(bg): bring all old website to use the right bg
ororsatti Sep 22, 2024
00b2e4a
install heroicons
17Amir17 Sep 23, 2024
b37d0df
chore(lint): fix lint problems
ororsatti Sep 23, 2024
28975d3
update yarn.lock
ichub Sep 23, 2024
01650d4
enable components page in dev mode
ichub Sep 23, 2024
8ead59f
Merge branch 'main' into ivan/deploy-ui-components
ororsatti Sep 24, 2024
990e47e
move code
17Amir17 Sep 24, 2024
b49a670
app container
17Amir17 Sep 24, 2024
c8926c8
new route
17Amir17 Sep 24, 2024
b610d2c
update dispatch
17Amir17 Sep 24, 2024
9311066
settings modal
17Amir17 Sep 24, 2024
a4e89ca
lint
17Amir17 Sep 24, 2024
8054470
Update index.tsx
17Amir17 Sep 24, 2024
97be0f5
numeric input
17Amir17 Sep 24, 2024
163b38a
logout func
17Amir17 Sep 25, 2024
58b749f
Delete settingsBottomModal.tsx
17Amir17 Sep 25, 2024
904ce3d
feat(tickets): add animation and btns
ororsatti Sep 25, 2024
6ee6633
fix(space): add 20 px
ororsatti Sep 25, 2024
da47424
fix(tickets): add missing imports
ororsatti Sep 25, 2024
9b18758
fix(tickets): move tickets screen to home screen, add home screen log…
ororsatti Sep 25, 2024
c697106
update imports
17Amir17 Sep 25, 2024
1d24cad
Merge branch 'phase-2' of https://github.com/proofcarryingdata/zupass…
17Amir17 Sep 25, 2024
9a6cebd
nits
17Amir17 Sep 25, 2024
d8f3a6f
Update dispatch.ts
17Amir17 Sep 25, 2024
43d8978
add password
17Amir17 Sep 25, 2024
32841d9
feat(tickets): add new ui flag to card body, and finess the scroll ui,
ororsatti Sep 25, 2024
ed1d909
add login with password
17Amir17 Sep 25, 2024
7e4879d
Merge branch 'phase-2' of https://github.com/proofcarryingdata/zupass…
17Amir17 Sep 25, 2024
62e49a8
nits
17Amir17 Sep 25, 2024
8d0fb3d
login to new ui
17Amir17 Sep 25, 2024
197a54a
feat(tickets): load fake tickets on devmode
ororsatti Sep 25, 2024
606becf
add new ui flag
17Amir17 Sep 25, 2024
e533b10
fix(lint): fixing lints
ororsatti Sep 26, 2024
160c461
fix(fonts and btn): changing font to rubik and fixing the btn styles
ororsatti Sep 26, 2024
c13e11b
Merge branch 'ivan/deploy-ui-components' into phase-2
ororsatti Sep 26, 2024
dd74046
chore(lint): fix issues on btn components
ororsatti Sep 26, 2024
426518c
logout
17Amir17 Sep 26, 2024
34c174b
feat(pod tickets): add pod tickets new ui
ororsatti Sep 26, 2024
ee1652b
fix(tickets list): adjust height based on the amount of tickets
ororsatti Sep 26, 2024
810a138
fix(tickets list): remove borders
ororsatti Sep 26, 2024
4803f41
enter confirmation password screen
17Amir17 Sep 26, 2024
4872136
Merge branch 'phase-2' of https://github.com/proofcarryingdata/zupass…
17Amir17 Sep 26, 2024
44d840f
fix(home page): handle empty state
ororsatti Sep 26, 2024
b1fa189
forgot password
17Amir17 Sep 26, 2024
a67f481
feat(tickets list): add download btn
ororsatti Sep 26, 2024
3b87b53
sync-existing
17Amir17 Sep 26, 2024
a58e3ca
feat(home): empty state
ororsatti Sep 26, 2024
9d7a0d7
Merge branch 'main' into phase-2
17Amir17 Sep 29, 2024
089ea98
CardBody conflict
17Amir17 Sep 29, 2024
f1bdf24
login with sync key
17Amir17 Sep 29, 2024
3402d69
skip password confirm
17Amir17 Sep 29, 2024
5a235b0
change password
17Amir17 Sep 29, 2024
f125582
feat(loader): add new loader components
ororsatti Sep 29, 2024
d5fdb8d
terms
17Amir17 Sep 29, 2024
abc6c08
Merge branch 'phase-2' of https://github.com/proofcarryingdata/zupass…
17Amir17 Sep 29, 2024
5c84a2b
conflict
17Amir17 Sep 29, 2024
662bb25
feat(addons): pass the add ons per ticket in
ororsatti Sep 29, 2024
14a0b40
NewLoginInterstitialScreen
17Amir17 Sep 29, 2024
60edca0
inputmode
17Amir17 Sep 29, 2024
3caae9e
hack
17Amir17 Sep 29, 2024
d5fc69c
ts
17Amir17 Sep 29, 2024
3e21f68
fix crash when move to new route
GuySerfaty Sep 30, 2024
9601cdf
clear some errors of key
GuySerfaty Sep 30, 2024
4c93495
add reveal password
17Amir17 Sep 30, 2024
1f8afac
replace old pw components
17Amir17 Sep 30, 2024
1c67968
fx error
17Amir17 Sep 30, 2024
8fc9682
nit
17Amir17 Sep 30, 2024
ce0a035
feat(scroller): fix width for most devices.
ororsatti Sep 30, 2024
45d8015
about modal
17Amir17 Sep 30, 2024
ca94a4b
Merge branch 'phase-2' of https://github.com/proofcarryingdata/zupass…
17Amir17 Sep 30, 2024
64d0c42
fix(packages): add missing imports
ororsatti Sep 30, 2024
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,6 +1,6 @@
import { requestGenericIssuanceTicketPreviews } from "@pcd/passport-interface";
import { Button, Spacer } from "@pcd/passport-ui";
import { IPODTicketData } from "@pcd/pod-ticket-pcd";
import { IPODTicketData, PODTicketPCD } from "@pcd/pod-ticket-pcd";
import { PODTicketCardBodyImpl } from "@pcd/pod-ticket-pcd-ui";
import { useCallback, useEffect, useState } from "react";
import { useParams } from "react-router-dom";
Expand Down Expand Up @@ -150,6 +150,8 @@ export function NewOneClickLoginScreen(): JSX.Element | null {
</CardHeader>
<PODTicketCardBodyImpl
idBasedVerifyURL=""
// TODO FIX THIS!!!!!
pcd={ticket as unknown as PODTicketPCD}
ticketData={ticket}
key={ticket.ticketId}
/>
Expand Down
26 changes: 20 additions & 6 deletions apps/passport-client/components/shared/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import { ScreenLoader } from "./ScreenLoader";
// Wrapper for all screens.
export function AppContainer({
children,
bg
bg,
fullscreen,
noPadding
}: {
bg: "primary" | "gray";
children?: ReactNode;
fullscreen?: boolean;
noPadding?: boolean;
}): JSX.Element {
const dispatch = useDispatch();
const error = useAppError();
Expand All @@ -29,10 +33,10 @@ export function AppContainer({
const col =
bg === "gray" ? "var(--dot-pattern-bg)" : "var(--bg-dark-primary)";
return (
<>
<Container $fullscreen={!!fullscreen}>
<GlobalBackground color={col} />
<Background>
<CenterColumn>
<CenterColumn defaultPadding={!noPadding}>
{children && (
<Toaster
toastOptions={{
Expand All @@ -49,7 +53,7 @@ export function AppContainer({
{error && <ErrorPopup error={error} onClose={onClose} />}
</CenterColumn>
</Background>
</>
</Container>
);
}

Expand All @@ -64,7 +68,7 @@ export const Background = styled.div`
min-height: 100%;
`;

export const CenterColumn = styled.div`
export const CenterColumn = styled.div<{ defaultPadding: boolean }>`
display: flex;
justify-content: flex-start;
align-items: center;
Expand All @@ -73,5 +77,15 @@ export const CenterColumn = styled.div`
max-width: 420px;
margin: 0 auto;
position: relative;
padding: 16px;
${({ defaultPadding }): string => (defaultPadding ? "padding: 16px;" : "")}
`;

const Container = styled.div<{ $fullscreen: boolean }>`
${({ $fullscreen }): string =>
$fullscreen
? `
display: flex;
height: 100vh;
`
: ""}
`;
221 changes: 162 additions & 59 deletions apps/passport-client/components/shared/PCDCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,24 @@ import {
TicketCategory,
isEdDSATicketPCD
} from "@pcd/eddsa-ticket-pcd";
import { EdDSATicketPCDUI } from "@pcd/eddsa-ticket-pcd-ui";
import {
EdDSATicketPCDUI,
TicketQR as EddsaTicketQR
} from "@pcd/eddsa-ticket-pcd-ui";
import { PCD, PCDUI } from "@pcd/pcd-types";
import { isPODTicketPCD } from "@pcd/pod-ticket-pcd";
import { PODTicketPCDUI } from "@pcd/pod-ticket-pcd-ui";
import { memo, useCallback, useContext, useMemo, useState } from "react";
import {
PODTicketPCDUI,
TicketQR as PODTicketQR
} from "@pcd/pod-ticket-pcd-ui";
import {
forwardRef,
memo,
useCallback,
useContext,
useMemo,
useState
} from "react";
import styled, { FlattenSimpleInterpolation, css } from "styled-components";
import { usePCDCollection, useUserIdentityPCD } from "../../src/appHooks";
import { StateContext } from "../../src/dispatch";
Expand Down Expand Up @@ -157,19 +170,89 @@ function getUI(
: undefined;
}

const getURLsBasedOnCategory = (category: TicketCategory) => {
const ticketCategory = category;
const idBasedVerifyURL =
ticketCategory === TicketCategory.Devconnect
? `${window.location.origin}/#/checkin-by-id`
: ticketCategory === TicketCategory.ZuConnect
? `${window.location.origin}/#/verify`
: ticketCategory === TicketCategory.Generic
? `${window.location.origin}/#/generic-checkin`
: undefined;

const verifyURL =
ticketCategory === TicketCategory.Generic
? `${window.location.origin}/#/generic-checkin`
: `${window.location.origin}/#/verify`;
return { idBasedVerifyURL, verifyURL };
};

const QRContainer = styled.div`
height: 265px;
width: 265px;
`;
export const TicketQRWrapper = forwardRef<
HTMLDivElement,
{
pcd: PCD<unknown, unknown>;
}
>(({ pcd }, ref) => {
const identityPCD = useUserIdentityPCD();

if (isEdDSATicketPCD(pcd) && identityPCD) {
const urls = getURLsBasedOnCategory(pcd.claim.ticket.ticketCategory);
return (
<QRContainer ref={ref}>
<EddsaTicketQR
pcd={pcd}
zk={false}
identityPCD={identityPCD}
idBasedVerifyURL={urls.idBasedVerifyURL}
verifyURL={urls.verifyURL}
/>
</QRContainer>
);
}
if (isPODTicketPCD(pcd)) {
const urls = getURLsBasedOnCategory(pcd.claim.ticket.ticketCategory);
if (urls.idBasedVerifyURL)
return (
<QRContainer ref={ref}>
<PODTicketQR
ticketData={pcd.claim.ticket}
idBasedVerifyURL={urls.idBasedVerifyURL}
/>
</QRContainer>
);
}

return (
<>
<TextCenter>
{pcd.type} unsupported <br />
no implementation of a ui for this type of card found
</TextCenter>
<Spacer h={16} />
</>
);
});

/**
* EdDSATicketPCD cards require some extra context and configuration. In
* particular, they require access to the user's identity PCD for generation
* of ZK proofs, and can be configured to include different URLs in their QR
* codes based on the type of ticket provided.
*/
function TicketWrapper({
pcd,
hidePadding
}: {
pcd: EdDSATicketPCD;
hidePadding?: boolean;
}): JSX.Element | null {
const TicketWrapper = forwardRef<
HTMLDivElement,
{
pcd: EdDSATicketPCD;
hidePadding?: boolean;
newUI?: boolean;
addOns?: AddOnsProps;
}
>(({ pcd, newUI, hidePadding, addOns }, ref) => {
const Card = EdDSATicketPCDUI.renderCardBody;
const identityPCD = useUserIdentityPCD();
const ticketCategory = pcd.claim.ticket.ticketCategory;
Expand Down Expand Up @@ -210,63 +293,83 @@ function TicketWrapper({
: `${window.location.origin}/#/verify`;

return identityPCD ? (
<Card
hidePadding={hidePadding}
pcd={pcd}
identityPCD={identityPCD}
verifyURL={verifyURL}
idBasedVerifyURL={idBasedVerifyURL}
/>
<div ref={ref}>
<Card
newUI={newUI}
hidePadding={hidePadding}
pcd={pcd}
identityPCD={identityPCD}
verifyURL={verifyURL}
idBasedVerifyURL={idBasedVerifyURL}
addOns={addOns}
/>
</div>
) : null;
}

function CardBody({
pcd,
isMainIdentity,
hidePadding
}: {
});
export type AddOnsProps = {
onClick: () => void;
text: string;
};
type CardBodyProps = {
pcd: PCD;
isMainIdentity: boolean;
hidePadding?: boolean;
}): JSX.Element {
const pcdCollection = usePCDCollection();
newUI?: boolean;
addOns?: AddOnsProps;
};

if (isMainIdentity) {
return <MainIdentityCard />;
}
if (pcdCollection.hasPackage(pcd.type)) {
if (isEdDSATicketPCD(pcd)) {
return <TicketWrapper pcd={pcd} hidePadding={hidePadding} />;
}
if (isPODTicketPCD(pcd)) {
const Component = PODTicketPCDUI.renderCardBody;
return (
<Component
pcd={pcd}
idBasedVerifyURL={`${window.location.origin}/#/generic-checkin`}
/>
);
export const CardBody = forwardRef<HTMLDivElement, CardBodyProps>(
({ pcd, isMainIdentity, hidePadding, newUI, addOns }, ref) => {
const pcdCollection = usePCDCollection();

if (isMainIdentity) {
return <MainIdentityCard />;
}
const ui = getUI(pcd.type);
if (ui) {
const Component = ui.renderCardBody;
return <Component pcd={pcd} />;
} else {
console.warn(`Could not find a UI renderer for PCD type "${pcd.type}"`);
if (pcdCollection.hasPackage(pcd.type)) {
if (isEdDSATicketPCD(pcd)) {
return (
<TicketWrapper
ref={ref}
newUI={newUI}
pcd={pcd}
hidePadding={hidePadding}
/>
);
}
if (isPODTicketPCD(pcd)) {
const Component = PODTicketPCDUI.renderCardBody;
return (
<div ref={ref}>
<Component
ticketData={pcd.claim.ticket}
addOns={addOns}
newUI={newUI}
pcd={pcd}
idBasedVerifyURL={`${window.location.origin}/#/generic-checkin`}
/>
</div>
);
}
const ui = getUI(pcd.type);
if (ui) {
const Component = ui.renderCardBody;
return <Component pcd={pcd} />;
} else {
console.warn(`Could not find a UI renderer for PCD type "${pcd.type}"`);
}
}
}

return (
<>
<TextCenter>
{pcd.type} unsupported <br />
no implementation of a ui for this type of card found
</TextCenter>
<Spacer h={16} />
</>
);
}

return (
<>
<TextCenter>
{pcd.type} unsupported <br />
no implementation of a ui for this type of card found
</TextCenter>
<Spacer h={16} />
</>
);
}
);
export const CardContainer = styled.div`
width: 100%;
padding: 8px;
Expand Down
1 change: 1 addition & 0 deletions apps/passport-client/components/shared/PCDCardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function PCDCardList({
})),
[pcdCollection, pcds]
);
console.log("sortableshit:", sortablePCDs);
// only show sort options that are valid for all PCDs
const sortOptions = useMemo(
() =>
Expand Down
Loading
Loading