Skip to content

Commit

Permalink
Refactor routing logic in App component and update navigation to remo…
Browse files Browse the repository at this point in the history
…ve '/navigation.html' from current route path
  • Loading branch information
cedricdcc committed Feb 5, 2025
1 parent cf3cb46 commit 8ca5d5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ const App = () => {
});
}, []);

useEffect(() => {
//if hash and / is not in hash then scroll to the hash
console.log(hash);
if (hash && !hash.includes("/")) {
window.location = "/";
}
}, [hash]);

const landingPageData= {
"Header" : MainData,
"Profiles" : ProfilesData,
Expand All @@ -62,7 +54,7 @@ const App = () => {
<Route path="/" element={<Homepage data={landingPageData} />} />
<Route path="/data-explorer/:id" element={<FilePage data={landingPageData} />} />
<Route path="/data-explorer" element={<Data data={landingPageData} />} />
<Route path="/*" element={<GroupedCrates data={landingPageData} />} />
<Route path="/*" element={<Homepage data={landingPageData} />} />
</Routes>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export const Navigation = (props) => {
//if the end of the current route is /navigation.html then remove /navigation.html
if (currentRoutePath.endsWith("/navigation.html")) {
currentRoutePath = currentRoutePath.replace("/navigation.html", "");


}

console.log(props);

//get the current hash route
const currentRoute = window.location.hash;
console.log(currentRoute);
Expand Down

0 comments on commit 8ca5d5f

Please sign in to comment.