Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
feat(routing): use hash
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricpoon committed Oct 24, 2024
1 parent 418f369 commit 62c756e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
3 changes: 0 additions & 3 deletions public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ registerRoute(
({ url }) => url.origin === 'https://open.er-api.com',
new StaleWhileRevalidate({
cacheName: 'exchange-rates-cache',
plugins: [
// Optionally, add expiration or other plugins
],
})
);

Expand Down
12 changes: 6 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { HashRouter as Router, Routes, Route } from 'react-router-dom';
import Home from './pages/Home';
import Transactions from './pages/Transactions';
import Participants from './pages/Participants';
Expand All @@ -16,13 +16,13 @@ function App() {
}, [dispatch]);

return (
<Router basename="/pay-as-we-go">
<Router hashType="noslash">
<Navbar />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/transactions" element={<Transactions />} />
<Route path="/participants" element={<Participants />} />
<Route path="/balance" element={<Balance />} />
<Route path="" element={<Home />} />
<Route path="transactions" element={<Transactions />} />
<Route path="participants" element={<Participants />} />
<Route path="balance" element={<Balance />} />
</Routes>
</Router>
);
Expand Down
30 changes: 22 additions & 8 deletions src/components/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
import React from 'react';
import { AppBar, Toolbar, Typography, Button, IconButton, Drawer, List, ListItem, ListItemText, Select, MenuItem, useTheme, useMediaQuery } from '@mui/material';
import {
AppBar,
Toolbar,
Typography,
Button,
IconButton,
Drawer,
List,
ListItem,
ListItemText,
Select,
MenuItem,
useTheme,
useMediaQuery
} from '@mui/material';
import MenuIcon from '@mui/icons-material/Menu';
import { Link } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import { setSelectedCurrency } from '../redux/slices/currencySlice';
import useOnlineStatus from '../hooks/useOnlineStatus';
import CircleIcon from '@mui/icons-material/Circle'; // Icon for status indicator
import CircleIcon from '@mui/icons-material/Circle';
import { green, red } from '@mui/material/colors';
import './Navbar.css'; // Ensure you have appropriate styles
import './Navbar.css';

function Navbar() {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
const [drawerOpen, setDrawerOpen] = React.useState(false);
const dispatch = useDispatch();
const { availableCurrencies, selectedCurrency } = useSelector((state) => state.currency);
const isOnline = useOnlineStatus(); // Get online status
const isOnline = useOnlineStatus();

const handleDrawerToggle = () => {
setDrawerOpen(!drawerOpen);
Expand All @@ -26,10 +40,10 @@ function Navbar() {
};

const menuItems = [
{ text: 'Home', path: '/' },
{ text: 'Participants', path: '/participants' },
{ text: 'Transactions', path: '/transactions' },
{ text: 'Balance', path: '/balance' },
{ text: 'Home', path: '' },
{ text: 'Participants', path: 'participants' },
{ text: 'Transactions', path: 'transactions' },
{ text: 'Balance', path: 'balance' },
];

const drawer = (
Expand Down

0 comments on commit 62c756e

Please sign in to comment.