Skip to content

Commit e2cd6ff

Browse files
authored
Merge pull request #199 from posadev/fix/error
feat: add error pages and change btn boletos
2 parents 9ae45f3 + d944bed commit e2cd6ff

File tree

7 files changed

+308
-18
lines changed

7 files changed

+308
-18
lines changed

src/components/SpeakerInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const SpeakerInfo = () => {
1515
const navigate = useNavigate()
1616
const location = useLocation();
1717
const { speakerId } = useParams();
18-
const { speakers, blob } = useAppContext();
18+
const { speakers } = useAppContext();
1919
const speaker = location.state?.speaker as ISpeaker;
2020
const [currentSpeaker, setCurrentSpeaker] = useState<ISpeaker>()
2121
const fullUrl = `${window.location.origin}${location.pathname}${location.search}${location.hash}`;
@@ -35,7 +35,7 @@ const SpeakerInfo = () => {
3535
if (!currentSpeaker) {
3636
return (
3737
<div className="flex items-center justify-center min-h-screen">
38-
<Loading size={60} gap={4} count={5} />
38+
<Loading size={60} count={5} />
3939
</div>
4040
);
4141
}

src/components/Tickets.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from "react";
22
import {Ticket} from "lucide-react";
33
import DuckIcon from "@/components/ui/duckIcon.tsx";
4+
import {useNavigate} from "react-router-dom";
45

56
const Tickets = () => {
7+
const navigate = useNavigate()
68
return (
79
<section className="flex flex-col items-center gap-8 text-white">
8-
<a role="button"
9-
href="https://boletos.posadev.org/event/5/posadev"
10-
target="_blank"
10+
<button role="link"
11+
onClick={() => navigate("/boletos")}
1112
rel="noopener noreferrer"
1213
className={`self-center flex items-center justify-center flex-row-reverse gap-x-4
1314
text-primary-500 bg-white hover:bg-primary-100 duration-300 rounded-full
@@ -22,7 +23,7 @@ const Tickets = () => {
2223
className="w-8 h-8 md:w-10 md:h-10"
2324
aria-hidden="true"
2425
/>
25-
</a>
26+
</button>
2627
<h3 className="text-2xl md:text-3xl font-semibold ">Qué incluye tu boleto (General) Posadev 2025</h3>
2728
<ul className="flex flex-col items-start animate-fade-in text-base md:text-xl text-left gap-1.5">
2829
<li className="flex items-center justify-start gap-2 ">

src/components/icons/Tree.tsx

Lines changed: 268 additions & 0 deletions
Large diffs are not rendered by default.

src/context/AppContext.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {getAll} from "@/https/fetch.ts";
44
import {AppStatus} from "@/types/types.ts";
55
import Loading from "@/pages/Loading.tsx";
66
import {addSessionSpeakers} from "@/lib/utils.ts";
7+
import NotFound from "@/pages/NotFound.tsx";
8+
import ErrorPage from "@/pages/ErrorPage.tsx";
79

810

911
interface AppContextType {
@@ -28,6 +30,8 @@ export const AppProvider = ({ children }) => {
2830
setSpeakers(getSpeakersWithSessions);
2931
setBlob(data.blob)
3032
setAppStatus(AppStatus.Success)
33+
}).catch(() => {
34+
setAppStatus(AppStatus.Error)
3135
});
3236
}, []);
3337

@@ -41,16 +45,14 @@ export const AppProvider = ({ children }) => {
4145
if (appStatus === AppStatus.Loading) {
4246
return (
4347
<div className="flex items-center justify-center min-h-screen">
44-
<Loading size={60} gap={4} count={5} />
48+
<Loading size={60} count={5} />
4549
</div>
4650
);
4751
}
4852

4953
if (appStatus === AppStatus.Error) {
5054
return (
51-
<div className="flex items-center justify-center min-h-screen text-red-500">
52-
Error al cargar los datos iniciales 😞
53-
</div>
55+
<ErrorPage />
5456
);
5557
}
5658

src/pages/ErrorPage.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Gradient from "@/components/Gradient.tsx";
2+
import Tree from "@/components/icons/Tree.tsx";
3+
4+
const ErrorPage = () => {
5+
return (
6+
<Gradient className="min-h-screen flex flex-col gap-4 items-center justify-center text-center">
7+
<Tree/>
8+
<div className="flex flex-col">
9+
<h1 className="text-4xl text-primary-600 font-bold mb-4">404</h1>
10+
<p className="text-2xl text-primary-600 mb-4">Oops! Algo salio mal</p>
11+
<p className="text-xl text-gray-500 mb-4">
12+
Parece que hubo un problema al cargar la pagina. Por favor, intenta
13+
nuevamente mas tarde.
14+
</p>
15+
</div>
16+
</Gradient>
17+
)
18+
}
19+
export default ErrorPage;

src/pages/Loading.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const Loading =({ count = 3, size = 14, text = null })=> {
2929
className="h-32 md:h-48 w-auto animate-fade-in mb-4"
3030
/>
3131
{text && <h1 className="text-center text-white text-3xl font-bold md:text-5xl candy-text" style={{ animation: "colorShift 0.2s infinite alternate"}}>{text}</h1>}
32-
<h1 className="hidden text-white text-3xl font-bold md:text-5xl candy-text" style={{ animation: "colorShift 1.2s infinite alternate"}}>Cargando</h1>
3332
</div>
3433
<div style={{ display: "flex", alignItems: "flex-end" }}>
3534
<CaneCandy

src/pages/NotFound.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { useLocation } from "react-router-dom";
22
import { useEffect } from "react";
3+
import Gradient from "@/components/Gradient.tsx";
4+
import Tree from "@/components/icons/Tree.tsx";
35

46
const NotFound = () => {
57
const location = useLocation();
@@ -12,15 +14,14 @@ const NotFound = () => {
1214
}, [location.pathname]);
1315

1416
return (
15-
<div className="min-h-screen flex items-center justify-center bg-gray-100">
16-
<div className="text-center">
17-
<h1 className="text-4xl font-bold mb-4">404</h1>
18-
<p className="text-xl text-gray-600 mb-4">Oops! Page not found</p>
19-
<a href="/" className="text-blue-500 hover:text-blue-700 underline">
17+
<Gradient className="min-h-screen flex flex-col gap-4 items-center justify-center text-center">
18+
<Tree/>
19+
<h1 className="text-4xl text-primary-600 font-bold mb-4">404</h1>
20+
<p className="text-xl text-primary-600 mb-4">Oops! Pagina no encontrada</p>
21+
<a href="/" className="text-alternative-700 hover:text-alternative-500 underline">
2022
Return to Home
2123
</a>
22-
</div>
23-
</div>
24+
</Gradient>
2425
);
2526
};
2627

0 commit comments

Comments
 (0)