Skip to content

Commit

Permalink
Greenlight version number only appears for admins
Browse files Browse the repository at this point in the history
- Changes to App.jsx: passed in currentUser to the Footer
- Footer renders the version number if the current user is an admin
  • Loading branch information
alihadimazeh committed Jul 24, 2024
1 parent 77873eb commit f3580dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 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 />
<Footer currentUser={currentUser} />
</>
);
}
10 changes: 8 additions & 2 deletions app/javascript/components/shared_components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
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';

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

return (
<footer id="footer" className="footer background-whitesmoke text-center">
<Container id="footer-container" className="py-3">
<a href="https://docs.bigbluebutton.org/greenlight/v3/install" target="_blank" rel="noreferrer">Greenlight</a>
<span className="text-muted"> {env?.VERSION_TAG} </span>
{ isAdmin && <span className="text-muted"> {env?.VERSION_TAG} </span> }
{ links?.Terms
&& (
<a className="ps-3" href={links?.Terms} target="_blank" rel="noreferrer">
Expand All @@ -46,3 +48,7 @@ export default function Footer() {
</footer>
);
}

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

0 comments on commit f3580dc

Please sign in to comment.