Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ororsatti committed Nov 9, 2024
1 parent c030342 commit f120bdd
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions apps/passport-client/new-components/screens/Home/NewHomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,27 @@ const ButtonsContainer = styled.div`
transform: translateX(-50%);
`;

const getZappsHeight = (): number => {
const getZapps = (eventId: string): [string, string][] => {
const zapps = Object.entries(appConfig.embeddedZapps);
if (eventId === "5074edf5-f079-4099-b036-22223c0c6995") {
return zapps;
}
return [];
};
const getZappsHeight = (zapps: [string, string][]): number => {
return zapps.length * ZAPP_BUTTON_HEIGHT + zapps.length * TICKET_VERTICAL_GAP;
};

const TicketsContainer = styled.div<{ $width: number }>`
const TicketsContainer = styled.div<{ $width: number; eventId: string }>`
width: ${({ $width }): number => $width}px;
display: flex;
flex-direction: column;
height: 100%;
gap: ${getZappsHeight()
? getZappsHeight() + 28 + TICKET_VERTICAL_GAP
: 28 + TICKET_VERTICAL_GAP}px;
gap: ${({ eventId }): number =>
getZappsHeight(getZapps(eventId))
? getZappsHeight(getZapps(eventId)) + 28 + TICKET_VERTICAL_GAP
: 28 + TICKET_VERTICAL_GAP}px;
transition: gap 0.2s ease-in-out;
`;

const LoadingScreenContainer = styled.div`
Expand Down Expand Up @@ -406,6 +414,7 @@ export const NewHomeScreen = (): ReactElement => {
const eventDetails = getEventDetails(packs[0]);
return (
<TicketsContainer
eventId={tickets[currentPos][0]}
$width={cardWidth}
key={packs.map((pack) => pack.eventTicket.id).join("-")}
>
Expand Down Expand Up @@ -460,7 +469,7 @@ export const NewHomeScreen = (): ReactElement => {
</_SwipableViews>
<ButtonsContainer>
<SyncIndicator />
{Object.keys(appConfig.embeddedZapps).length > 0 && (
{getZapps(tickets[currentPos][0]).length > 0 && (
<ZappButtonsContainer>
{Object.entries(appConfig.embeddedZapps).map(
([zappName, url]) => (
Expand Down

0 comments on commit f120bdd

Please sign in to comment.