Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrofisr committed Aug 20, 2024
1 parent 3eaf2c1 commit 743e780
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 18 deletions.
24 changes: 14 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<meta
name="facebook-domain-verification"
content="g143tc98a7u9ssgylzc1py2syne66n"
/>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.1"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
Expand Down
13 changes: 12 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import { Events } from "./pages/events";

function App() {
return <></>;
return (
<>
<Router>
<Routes>
<Route path="/events/:id" element={<Events />} />
</Routes>
</Router>
</>
);
}

export default App;
6 changes: 0 additions & 6 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import App from "./App.jsx";

createRoot(document.getElementById("root")).render(
<StrictMode>
<head>
<meta
name="facebook-domain-verification"
content="g143tc98a7u9ssgylzc1py2syne66n"
/>
</head>
<App />
</StrictMode>,
);
28 changes: 28 additions & 0 deletions src/pages/events.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useParams } from "react-router-dom";

const events = [
{
short: "JuaraGCP2024SMG",
title: "JuaraGCP Semarang 2024",
url: "https://bit.ly/JuaraGCPSmg",
},
// Add more events if needed
];

export const Events = () => {
let { id } = useParams();

// Find the event that matches the id
const event = events.find((e) => e.short === id);

// If no matching event is found, you can handle it here
if (!event) {
console.error("Event not found");
return null; // or navigate to a "not found" page
}

// Redirect to the event's URL
window.location.href = event.url;

return null; // Return null since we're redirecting and don't need to render anything
};
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@remix-run/[email protected]":
version "1.19.1"
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.19.1.tgz#984771bfd1de2715f42394c87fb716c1349e014f"
integrity sha512-S45oynt/WH19bHbIXjtli6QmwNYvaz+vtnubvNpNDvUOoA/OWh6j1OikIP3G+v5GHdxyC6EXoChG3HgYGEUfcg==

"@rollup/[email protected]":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.0.tgz#d941173f82f9b041c61b0dc1a2a91dcd06e4b31e"
Expand Down Expand Up @@ -1825,6 +1830,21 @@ react-refresh@^0.14.2:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9"
integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==

react-router-dom@^6.26.1:
version "6.26.1"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.26.1.tgz#a408892b41767a49dc94b3564b0e7d8e3959f623"
integrity sha512-veut7m41S1fLql4pLhxeSW3jlqs+4MtjRLj0xvuCEXsxusJCbs6I8yn9BxzzDX2XDgafrccY6hwjmd/bL54tFw==
dependencies:
"@remix-run/router" "1.19.1"
react-router "6.26.1"

[email protected]:
version "6.26.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.26.1.tgz#88c64837e05ffab6899a49df2a1484a22471e4ce"
integrity sha512-kIwJveZNwp7teQRI5QmwWo39A5bXRyqpH0COKKmPnyD2vBvDwgFXSqDUYtt1h+FEyfnE8eXr7oe0MxRzVwCcvQ==
dependencies:
"@remix-run/router" "1.19.1"

react@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
Expand Down

0 comments on commit 743e780

Please sign in to comment.