-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
prince rusweka
committed
May 2, 2025
1 parent
a3f322e
commit d521555
Showing
36 changed files
with
653 additions
and
220 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
import { Routes, Route } from 'react-router-dom'; | ||
import NavBar from './components/NavBar'; | ||
import Home from './pages/Home'; | ||
import Search from './pages/Search'; | ||
import MoreInfo from "./pages/MoreInfo"; | ||
import PetProfile from './pages/PetProfile'; | ||
import Profile from './pages/Profile'; | ||
import { Routes, Route, Navigate, useLocation } from "react-router-dom"; | ||
import Home from "./pages/Home"; | ||
import Profile from "./pages/Profile"; | ||
import PetProfile from "./pages/PetPage"; | ||
import PetDetails from "./pages/PetDetails"; | ||
import Search from "./pages/Search"; | ||
import MyList from "./pages/MyList"; | ||
import MoreInfo from "./pages/MoreInfo"; | ||
import AdoptionPage from "./pages/AdoptionPage"; | ||
import MyList from './pages/MyList'; | ||
import NavBar from "./components/NavBar"; | ||
import { JSX } from "react"; | ||
|
||
function ProtectedRoute({ children }: { children: JSX.Element }) { | ||
const isLoggedIn = localStorage.getItem("loggedIn") === "true"; | ||
return isLoggedIn ? children : <Navigate to="/profile" />; | ||
} | ||
|
||
export default function App() { | ||
const location = useLocation(); | ||
const hideNav = location.pathname === "/profile" || location.pathname === "/more-info"; | ||
|
||
function App() { | ||
return ( | ||
<> | ||
<NavBar /> | ||
{!hideNav && <NavBar />} | ||
|
||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/search" element={<Search />} /> | ||
<Route path="/pets" element={<PetProfile />} /> | ||
<Route path="/pets/:id" element={<PetDetails />} /> | ||
<Route path="/profile" element={<Profile />} /> | ||
<Route path="/more-info" element={<MoreInfo />} /> | ||
<Route path="/adopt/:name" element={<AdoptionPage />} /> | ||
<Route path="/my-list" element={<MyList />} /> | ||
<Route path="/pets" element={<ProtectedRoute><PetProfile /></ProtectedRoute>} /> | ||
<Route path="/pets/:id" element={<ProtectedRoute><PetDetails /></ProtectedRoute>} /> | ||
<Route path="/search" element={<ProtectedRoute><Search /></ProtectedRoute>} /> | ||
<Route path="/adopt/:name" element={<ProtectedRoute><AdoptionPage /></ProtectedRoute>} /> | ||
<Route path="/my-list" element={<ProtectedRoute><MyList /></ProtectedRoute>} /> | ||
</Routes> | ||
</> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Outlet } from "react-router-dom"; | ||
import Navbar from "./NavBar"; | ||
|
||
export default function Layout() { | ||
return ( | ||
<> | ||
<Navbar /> | ||
<Outlet /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App'; | ||
import './index.css'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import './index.css'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter> | ||
</React.StrictMode>, | ||
); | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.