Skip to content

Commit 1fe0a73

Browse files
authored
Lego 0006/rrss details (#122)
1 parent 9ee25a1 commit 1fe0a73

File tree

6 files changed

+118
-10
lines changed

6 files changed

+118
-10
lines changed

package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"react-dom": "^18.2.0",
5252
"react-feather": "^2.0.10",
5353
"react-hook-form": "^7.32.0",
54+
"react-hot-toast": "^2.4.0",
5455
"react-markdown": "^8.0.3",
5556
"react-portal": "^4.2.2",
5657
"react-qr-code": "^2.0.8",

pages/p/ticket/[id].tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const TicketPage = ({ ticket }: { ticket: PublicTicket }) => {
6868
ticketType={ticket.ticketType}
6969
ticketSeason={ticket.ticketSeason}
7070
fadeIn
71+
showGetTicket
7172
/>
7273
</div>
7374
);

pages/tickets/success.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ export default function Tickets(props: PageProps) {
151151
fadeIn
152152
/>
153153
) : null}
154+
{(latestTickets?.length ?? 0) > 1 ? (
155+
<Paragraph>
156+
(Sabemos que tienes {latestTickets?.length} tickets pero no
157+
podemos mostrar tantos en esta pantalla)
158+
</Paragraph>
159+
) : null}
154160
<Paragraph>
155161
Tu compra fue exitosa. Siempre podrás ver los tickets en{" "}
156162
<Link href={"/mytickets"} passHref>

src/Components/Ticket/Ticket.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ import Atropos from "atropos/react";
33
import { AnimatePresence, motion, MotionProps } from "framer-motion";
44
import { useEffect, useState } from "react";
55
import { Facebook, Linkedin, Twitter, Copy } from "react-feather";
6+
import toast, { Toaster } from "react-hot-toast";
67

78
import { jsconfTheme, ViewportSizes } from "../../../styles/theme";
9+
import { GenericLink } from "../TicketSection/shared";
810

911
const SharingInfo = styled.div`
1012
text-align: center;
1113
margin-bottom: 64px;
1214
`;
15+
16+
const GetTicket = styled.div`
17+
text-align: center;
18+
margin-bottom: 64px;
19+
`;
20+
1321
const AtroposContainer = styled.div`
1422
overflow: hidden;
1523
`;
@@ -139,6 +147,7 @@ const TicketHeader = styled.div`
139147
display: flex;
140148
align-items: center;
141149
`;
150+
142151
const StyledTr = styled.div`
143152
display: flex;
144153
flex-direction: column;
@@ -268,9 +277,9 @@ const SocialButton = styled.button(({ theme }) => [
268277
width: "100%",
269278
transform: "scaleX(0)",
270279
height: "4px",
271-
bottom: 0,
280+
bottom: "-8px",
272281
left: 0,
273-
backgroundColor: theme.colors.social.twitter,
282+
backgroundColor: "#fff",
274283
transformOrigin: "bottom right",
275284
transition: "transform 0.25s ease-out",
276285
},
@@ -294,7 +303,7 @@ const SocialAnchor = styled.a<{ type: "twitter" | "facebook" | "linkedin" }>(
294303
width: "100%",
295304
transform: "scaleX(0)",
296305
height: "4px",
297-
bottom: 0,
306+
bottom: "-8px",
298307
left: 0,
299308
backgroundColor: theme.colors.social[type],
300309
transformOrigin: "bottom right",
@@ -333,6 +342,7 @@ export const Ticket = ({
333342
ticketSeason,
334343
userTicketStatus,
335344
fadeIn,
345+
showGetTicket = false,
336346
}: {
337347
userTicketId: string;
338348
userPhoto: string | null;
@@ -343,6 +353,7 @@ export const Ticket = ({
343353
ticketSeason: string;
344354
userTicketStatus: string;
345355
fadeIn: boolean;
356+
showGetTicket?: boolean;
346357
}) => {
347358
const [loaded, setLoaded] = useState(!fadeIn);
348359
const animation = useAnimation();
@@ -429,33 +440,42 @@ export const Ticket = ({
429440
)}`}
430441
target="_blank"
431442
rel="noreferrer"
432-
type="twitter"
443+
type="facebook"
433444
>
434445
<Facebook size={32} />
435446
</SocialAnchor>
436447
<SocialAnchor
437448
href={`https://www.linkedin.com/sharing/share-offsite?url=${publicUrl}`}
438449
target="_blank"
439450
rel="noreferrer"
440-
type="twitter"
451+
type="linkedin"
441452
>
442453
<Linkedin size={32} />
443454
</SocialAnchor>
444455
<SocialButton
445456
onClick={() => {
446-
/* eslint-disable @typescript-eslint/no-floating-promises */
447-
navigator.clipboard.writeText(publicUrl).then(() => {
448-
console.log(1);
449-
});
457+
navigator.clipboard
458+
.writeText(publicUrl)
459+
.then(() => {
460+
toast.success("Enlace copiado con éxito!");
461+
})
462+
.catch(() => {
463+
toast.error("Hubo un error, intentalo nuevamente!");
464+
});
450465
}}
451466
>
452467
<Copy size={32} />
453468
</SocialButton>
469+
<Toaster />
454470
</SharingInfo>
471+
{showGetTicket ? (
472+
<GetTicket>
473+
<GenericLink href="/tickets">Obtener Tickets</GenericLink>
474+
</GetTicket>
475+
) : null}
455476
</MotionContainer>
456477
)}
457478
</AnimatePresence>
458-
459479
{/* <AnimatePresence mode="popLayout" initial={false}> */}
460480
</AtroposContainer>
461481
);

src/Components/TicketSection/shared.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,48 @@ export const GenericBtn = styled(motion.button)`
101101
}
102102
`;
103103

104+
export const GenericLink = styled(motion.a)`
105+
border-color: ${({ theme }) => theme.colors.jsconfYellow};
106+
color: ${({ theme }) => theme.colors.jsconfYellow};
107+
border-width: 2px;
108+
border-style: solid;
109+
font-weight: 700;
110+
padding-left: 1rem;
111+
padding-right: 1rem;
112+
display: inline-flex;
113+
gap: 0.5rem;
114+
justify-content: center;
115+
align-items: center;
116+
line-height: 0;
117+
height: 50px;
118+
transition-duration: 250ms;
119+
transition-property: all;
120+
cursor: pointer;
121+
&:active,
122+
&:focus,
123+
&:hover {
124+
box-shadow: 0 0.5em 0.5em -0.4em ${({ theme }) => theme.colors.jsconfRed};
125+
border-color: ${({ theme }) => theme.colors.jsconfRed};
126+
color: ${({ theme }) => theme.colors.jsconfRed};
127+
}
128+
&:focus,
129+
&:hover {
130+
transform: translateY(-0.25em);
131+
}
132+
&:active {
133+
box-shadow: none;
134+
transform: translateY(0em);
135+
}
136+
&:disabled,
137+
&:disabled:hover {
138+
border-color: ${({ theme }) => transparentize(0.78)(theme.colors.white)};
139+
color: ${({ theme }) => transparentize(0.75)(theme.colors.white)};
140+
box-shadow: none;
141+
cursor: not-allowed;
142+
transform: translateY(0em);
143+
}
144+
`;
145+
104146
export const Container = styled.div`
105147
display: flex;
106148
flex-direction: column;

0 commit comments

Comments
 (0)