Skip to content

Commit

Permalink
Merge pull request #181 from HackMelbourne/redirecting
Browse files Browse the repository at this point in the history
Redirecting
  • Loading branch information
e3lo authored Jul 30, 2024
2 parents 32f48aa + 6eaaa48 commit 6b5b319
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/layouts/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ const Layout = () => {
{
title: "Organisation",
links: [
{
name: "Join Committee",
link: "https://docs.google.com/forms/d/e/1FAIpQLSc_Cu4yD6Du6LWXD4itRBALJ0elsou0LN56xKPveT3HvrlBmw/viewform",
},
// {
// name: "Join Committee",
// link: "https://docs.google.com/forms/d/e/1FAIpQLSc_Cu4yD6Du6LWXD4itRBALJ0elsou0LN56xKPveT3HvrlBmw/viewform",
// },
{ name: "UMSU", link: UMSU_LINK },
{ name: "Contact Us", link: "mailto:${SECRETARY_EMAIL}" },
],
Expand Down
33 changes: 27 additions & 6 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from "react";
import React, { useEffect } from "react";
import ReactDOM from "react-dom/client";

import { createBrowserRouter, createRoutesFromElements, Navigate, Route, RouterProvider } from "react-router-dom";

import "./index.css";

import Layout from "./layouts/Layout";

// Main Pages
Expand All @@ -18,24 +16,39 @@ import HallOfFame from "./routes/HallOfFame";
import Privacy from "./routes/Privacy";
import Terms from "./routes/Terms";

//Event Pages
// Event Pages
import OWeek from "./routes/eventPages/OWeek";
import OWeekGame from "./routes/eventPages/OWeekGame";
import GameComplete from "./routes/eventPages/GameComplete";
import HackiethonQuiz from "./routes/eventPages/HackiethonQuiz";
import QuizResults from "./features/HackiethonQuiz/QuizResults";

//Blog Pages
// Blog Pages
import Blogs from "./routes/Blogs";
import { BlogInterface, BlogsData } from "./routes/blogs/BlogsData";

//Google Analytics
// Google Analytics
import ReactGA from "react-ga4";
import Hackiethon from "./routes/eventPages/Hackiethon";
import Links from "./routes/Links";

ReactGA.initialize("G-BCJY191MCE");

// Interface for the props that the Redirect component will receive
interface RedirectProps {
to: string;
}

// Redirect component using the React.FC type
const Redirect: React.FC<RedirectProps> = ({ to }) => {
useEffect(() => {
window.location.replace(to);
}, [to]);

return null;
};


const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<Layout />}>
Expand All @@ -62,6 +75,14 @@ const router = createBrowserRouter(
{BlogsData.map((blog: BlogInterface) => (
<Route key={blog.title} path={`blogs/${blog.url}`} element={<Blogs blogId={blog.articleId} />} />
))}
{/* Redirects */}
<Route path="/instagram" element={<Redirect to="https://www.instagram.com/hack.melbourne/" />} />
<Route path="/insta" element={<Redirect to="https://www.instagram.com/hack.melbourne/" />} />
<Route path="/discord" element={<Redirect to="https://discord.gg/tEQ5m6ayTV" />} />
<Route path="/facebook" element={<Redirect to="https://www.facebook.com/hackmelbourne/" />} />
<Route path="/fb" element={<Redirect to="https://www.facebook.com/hackmelbourne/" />} />
<Route path="/linkedin" element={<Redirect to="https://au.linkedin.com/company/hackmelbourne" />} />
<Route path="/tiktok" element={<Redirect to="https://www.tiktok.com/@hack.melbourne" />} />
</Route>,
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Root() {
title: ["Join the ", "Hack", "Melbourne team for 2024"],
desc: ["We make an impact on our future and learn some", "more skills along the way!"],
button: "Apply Now",
link: "https://docs.google.com/forms/d/e/1FAIpQLSc_Cu4yD6Du6LWXD4itRBALJ0elsou0LN56xKPveT3HvrlBmw/viewform",
link: "",
};

return (
Expand Down

0 comments on commit 6b5b319

Please sign in to comment.