Skip to content

Commit

Permalink
Merge pull request #726 from WildMeOrg/644_add_version_in_footer
Browse files Browse the repository at this point in the history
644 add version in footer
  • Loading branch information
TanyaStere42 authored Sep 4, 2024
2 parents f8e1b48 + 905075b commit b6202f1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
22 changes: 20 additions & 2 deletions frontend/src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useContext } from "react";
import React, { useContext, useState, useEffect } from "react";
import { Container, Row, Col } from "react-bootstrap";
import { FormattedMessage } from "react-intl";
import FooterLink from "./footer/FooterLink";
import ThemeColorContext from "../ThemeColorProvider";
import FooterVisibilityContext from "../FooterVisibilityContext";
import useGetSiteSettings from "../models/useGetSiteSettings";
import {
footerLinks1,
footerLinks2,
Expand All @@ -13,7 +14,13 @@ import {
const Footer = () => {
const theme = useContext(ThemeColorContext);
const { visible } = useContext(FooterVisibilityContext);

const [version, setVersion] = useState();
const { data } = useGetSiteSettings();
useEffect(() => {
if (data) {
setVersion(data.system.wildbookVersion);
}
}, [data]);
return visible ? (
<footer
className="footer py-3 w-100"
Expand Down Expand Up @@ -62,6 +69,17 @@ const Footer = () => {
<Row className="justify-content-md-center py-3">
<Col md="auto">
<p>
{version ? (
<a
href={`https://github.com/WildMeOrg/Wildbook/releases/tag/${version}`}
style={{ color: "inherit", textDecoration: "none" }}
target="_blank"
rel="noreferrer"
>
{`V${version}`}
{" | "}
</a>
) : null}
<FormattedMessage id="FOOTER_COPYRIGHT" />
</p>
</Col>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/ecocean/api/SiteSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import org.ecocean.Annotation;
import org.ecocean.CommonConfiguration;
import org.ecocean.ContextConfiguration;
import org.ecocean.IAJsonProperties;
import org.ecocean.Keyword;
import org.ecocean.LabeledKeyword;
Expand Down Expand Up @@ -103,6 +104,10 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
}
settings.put("organizations", orgs);

JSONObject system = new JSONObject();
system.put("wildbookVersion", ContextConfiguration.getVersion());
settings.put("system", system);

sortArray = myShepherd.getAllSocialUnitNames().toArray();
Arrays.sort(sortArray);
settings.put("socialUnitName", sortArray);
Expand Down
4 changes: 1 addition & 3 deletions src/main/webapp/footer.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ String urlLoc = "//" + CommonConfiguration.getURLLocation(request);
<a href="https://www.linkedin.com/company/conservationxlabs/" class="footer-link text-reset px-2 footer-text">LinkedIn</a>
</div>
</div>
<div class="footer-text w-100 py-3 text-center">2024 © Conservation X Labs | All Rights Reserved</div>
<div class="footer-text w-100 py-3 text-center"><a href="https://github.com/WildMeOrg/Wildbook/releases/tag/<%=ContextConfiguration.getVersion() %>" target="_blank" style="color: inherit; text-decoration: none">V<%=ContextConfiguration.getVersion() %></a> | 2024 © Conservation X Labs | All Rights Reserved</div>
</div>



<!-- /footer -->
</body>
</html>

0 comments on commit b6202f1

Please sign in to comment.