diff --git a/frontend/src/components/Footer.jsx b/frontend/src/components/Footer.jsx index 1c673df..b2189dd 100644 --- a/frontend/src/components/Footer.jsx +++ b/frontend/src/components/Footer.jsx @@ -1,125 +1,119 @@ import { Link, useLocation } from 'react-router-dom' import { useAuth } from '../context/AuthContext' - + +function FooterLink({ to, children, className = '', pathname }) { + return pathname === to ? ( + {children} + ) : ( + + {children} + + ) +} + export default function Footer() { const { pathname } = useLocation() const { user } = useAuth() const isLoggedIn = !!user - - function FooterLink({ to, children, className=''}) { - return pathname === to ? ( - {children} - ) : ( - - {children} - - ) - } + return ( ) -} \ No newline at end of file +} diff --git a/frontend/src/context/AuthContext.jsx b/frontend/src/context/AuthContext.jsx index 552cb66..5035bb7 100644 --- a/frontend/src/context/AuthContext.jsx +++ b/frontend/src/context/AuthContext.jsx @@ -1,3 +1,5 @@ +/* eslint-disable react-refresh/only-export-components */ + import { createContext, useContext, useState } from 'react' const AuthContext = createContext(null) diff --git a/frontend/src/pages/Admin.jsx b/frontend/src/pages/Admin.jsx index 4272e81..94c0750 100644 --- a/frontend/src/pages/Admin.jsx +++ b/frontend/src/pages/Admin.jsx @@ -56,7 +56,7 @@ export default function Admin() { if (!handleAuthError(e)) setError(e.message) }) .finally(() => setLoading(false)) - }, []) + }, [handleAuthError]) const handleDraw = async () => { setShowConfirm(false) @@ -94,7 +94,7 @@ export default function Admin() { const csv = [header, ...rows] .map((row) => row.map((cell) => `"${String(cell).replace(/"/g, '""')}"`).join(';')) .join('\n') - const blob = new Blob([`${csv}`], { type: 'text/csv;charset=utf-8;' }) + const blob = new Blob(['\uFEFF' + csv], { type: 'text/csv;charset=utf-8;' }) const url = URL.createObjectURL(blob) const link = document.createElement('a') link.href = url diff --git a/frontend/src/pages/MesGains.jsx b/frontend/src/pages/MesGains.jsx index dcb45f3..d432a44 100644 --- a/frontend/src/pages/MesGains.jsx +++ b/frontend/src/pages/MesGains.jsx @@ -50,7 +50,20 @@ export default function MesGains() { } }, [handleAuthError]) - useEffect(() => { fetchGains() }, [fetchGains]) + useEffect(() => { + const loadGains = async () => { + try { + const data = await myGainsApi() + setGains(data.gains) + } catch (err) { + if (!handleAuthError(err)) setError(err.message) + } finally { + setLoading(false) + } + } + + loadGains() +}, [handleAuthError]) return (