Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-torabiv committed Dec 3, 2024
1 parent 73a32be commit 780b423
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 39 deletions.
61 changes: 28 additions & 33 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import '@rainbow-me/rainbowkit/styles.css';

import React from 'react';
import { useMediaQuery } from '@mui/material';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
import {
lightTheme,
RainbowKitAuthenticationProvider,
Expand Down Expand Up @@ -64,39 +62,36 @@ const App: React.FC = () => {
appName: 'LogID',
}}
>
<ThemeProvider theme={theme}>
<CssBaseline />
<Routes>
<Routes>
<Route
path="/auth/login"
element={
authStatus === 'authenticated' ? (
<Navigate to="/" replace />
) : (
<Login />
)
}
/>
<Route
element={
<ProtectedRoute>
<DefaultLayout />
</ProtectedRoute>
}
>
<Route path="/" element={<Navigate to="/identifiers" />} />
<Route path="/identifiers" element={<Identifiers />} />
<Route
path="/auth/login"
element={
authStatus === 'authenticated' ? (
<Navigate to="/" replace />
) : (
<Login />
)
}
path="identifiers/:provider/attestation"
element={<Attestation />}
/>
<Route
element={
<ProtectedRoute>
<DefaultLayout />
</ProtectedRoute>
}
>
<Route path="/" element={<Navigate to="/identifiers" />} />
<Route path="/identifiers" element={<Identifiers />} />
<Route
path="identifiers/:provider/attestation"
element={<Attestation />}
/>
<Route path="/permissions" element={<Permissions />} />
</Route>
<Route path="/callback" element={<Callback />} />
<Route path="*" element={<div>Not found</div>} />
</Routes>
<CustomSnackbar />
</ThemeProvider>
<Route path="/permissions" element={<Permissions />} />
</Route>
<Route path="/callback" element={<Callback />} />
<Route path="*" element={<div>Not found</div>} />
</Routes>
<CustomSnackbar />
</RainbowKitProvider>
</RainbowKitAuthenticationProvider>
</QueryClientProvider>
Expand Down
52 changes: 47 additions & 5 deletions src/components/layouts/SidebarApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { useLocation, useNavigate } from 'react-router-dom';

import { DRAWER_WIDTH, SIDEBAR_MENU } from '../../libs/constants';
import theme from '../../libs/theme';

function SidebarApp() {
const navigate = useNavigate();
Expand Down Expand Up @@ -46,18 +47,59 @@ function SidebarApp() {
</Box>
</Toolbar>
<Divider />
<List>
<List sx={{ padding: 2 }}>
{' '}
{SIDEBAR_MENU.map((item) => (
<ListItemButton
key={item.title}
sx={{ display: 'flex', justifyContent: 'center', gap: 1 }}
selected={item.path === pathname}
sx={{
display: 'flex',
justifyContent: 'center',
gap: 1,
mt: 1,
padding: '8px 16px',
borderRadius: 2,
backgroundColor:
item.path === pathname
? theme.palette.primary.main
: 'transparent',
color:
item.path === pathname
? theme.palette.primary.contrastText
: theme.palette.text.primary,
'&:hover': {
backgroundColor:
item.path === pathname
? theme.palette.primary.main // Keep the same background for selected item
: theme.palette.action.hover,
},
'&.Mui-selected': {
backgroundColor: `${theme.palette.primary.main} !important`,
color: theme.palette.primary.contrastText,
'&:hover': {
backgroundColor: `${theme.palette.primary.main} !important`, // Prevent hover effect from altering the background
},
},
}}
onClick={() => navigate(item.path)}
>
<ListItemIcon sx={{ minWidth: 'auto' }}>
<ListItemIcon
sx={{
minWidth: 'auto',
color:
item.path === pathname
? theme.palette.primary.contrastText
: theme.palette.text.primary,
}}
>
<item.icon />
</ListItemIcon>
<ListItemText>{item.title}</ListItemText>
<ListItemText
primary={item.title}
sx={{
color: 'inherit',
}}
/>
</ListItemButton>
))}
</List>
Expand Down
8 changes: 7 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import './index.css';

import React from 'react';
import { ThemeProvider } from '@emotion/react';
import { CssBaseline } from '@mui/material';
import { getDefaultConfig } from '@rainbow-me/rainbowkit';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { baseSepolia, optimismSepolia } from 'viem/chains';
import { http, WagmiProvider } from 'wagmi';

import App from './App';
import theme from './libs/theme';

if (!import.meta.env.VITE_PROJECT_ID) {
throw new Error('VITE_PROJECT_ID environment variable is required');
Expand All @@ -31,7 +34,10 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<BrowserRouter>
<WagmiProvider config={config}>
<App />
<ThemeProvider theme={theme}>
<CssBaseline />
<App />
</ThemeProvider>
</WagmiProvider>
</BrowserRouter>
</React.StrictMode>
Expand Down

0 comments on commit 780b423

Please sign in to comment.