Skip to content

Commit

Permalink
Merge pull request #156 from IT-Cotato/hotfix/COT-45-resolve-attendan…
Browse files Browse the repository at this point in the history
…ce-fab-issue

fix: specify fab conditions
  • Loading branch information
Ea-st-ring authored Nov 3, 2024
2 parents 5502046 + 00709a4 commit d56a7f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import './App.css';
import { Routes, Route, useLocation } from 'react-router-dom';
import { Routes, Route, useLocation, useMatch } from 'react-router-dom';
import Header from '@components/Header';
import Home from '@pages/Home/Home';
import Login from '@pages/Login/Login';
Expand All @@ -27,9 +27,13 @@ import 'react-toastify/dist/ReactToastify.css';
import { ToastContainer } from 'react-toastify';

function App() {
//
const location = useLocation();
const isInHome = location.pathname === '/';

//
const isInAttendanceList = useMatch('/attendance/list/generation/:generationId');

//
//
//
Expand All @@ -41,8 +45,6 @@ function App() {
}
}, [isInHome]);

const isAttendance = useLocation().pathname.includes('/attendance');

//
//
//
Expand Down Expand Up @@ -72,7 +74,7 @@ function App() {
<Route path="/signin" element={<Login />} />
<Route path="/*" element={<NotFound />} />
</Routes>
{isAttendance ? <AttendanceFab /> : <CotatoGlobalFab />}
{isInAttendanceList ? <AttendanceFab /> : <CotatoGlobalFab />}
</CotatoThemeProvider>
</div>
);
Expand Down

0 comments on commit d56a7f0

Please sign in to comment.