Skip to content

Commit

Permalink
- currentUser is no longer passed as a prop to the Footer component.
Browse files Browse the repository at this point in the history
  Footer component imports useAuth to get the current user
  • Loading branch information
alihadimazeh committed Jul 25, 2024
1 parent fdd40e0 commit 0506021
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/javascript/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function App() {
newestOnTop
autoClose={3000}
/>
<Footer currentUser={currentUser} />
<Footer />
</>
);
}
9 changes: 3 additions & 6 deletions app/javascript/components/shared_components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Container } from 'react-bootstrap';
import PropTypes from 'prop-types';
import useEnv from '../../hooks/queries/env/useEnv';
import useSiteSetting from '../../hooks/queries/site_settings/useSiteSetting';
import { useAuth } from '../../contexts/auth/AuthProvider';

export default function Footer({ currentUser = null }) {
export default function Footer() {
const { t } = useTranslation();
const { data: env } = useEnv();
const { data: links } = useSiteSetting(['Terms', 'PrivacyPolicy']);
const currentUser = useAuth();
const isAdmin = currentUser && currentUser.role && currentUser?.role.name === 'Administrator';

return (
Expand All @@ -48,7 +49,3 @@ export default function Footer({ currentUser = null }) {
</footer>
);
}

Footer.propTypes = {
currentUser: PropTypes.func.isRequired,
};

0 comments on commit 0506021

Please sign in to comment.