Skip to content

Commit

Permalink
Add Api Version Number in Footer (#2075)
Browse files Browse the repository at this point in the history
* Add Api Version Number in Footer

* fix formatting
  • Loading branch information
CollinBeczak authored Sep 1, 2023
1 parent 49768bd commit 3972e6c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/components/Footer/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ import SvgSymbol from '../SvgSymbol/SvgSymbol'
import messages from './Messages'

class Footer extends Component {
constructor(props) {
super(props);

this.state = {
data : null
};
}

componentDidMount() {
this.renderMyData();
}

renderMyData(){
fetch(`${process.env.REACT_APP_MAP_ROULETTE_SERVER_URL}/api/v2/service/info`)
.then((response) => response.json())
.then((responseJson) => {
this.setState({ data : responseJson })
})
.catch((error) => {
console.error(error);
});
}

render() {
return (
<footer
Expand All @@ -22,6 +45,19 @@ class Footer extends Component {
</a>
</span>
</h3>
{ this.state.data ?
<h3 className="mr-text-white mr-text-md mr-mb-2">
<FormattedMessage {...messages.APIVersionLabel} />{' '}
<span className="mr-text-green-light mr-font-mono mr-text-base">
<a
href={`https://github.com/maproulette/maproulette-backend/releases/tag/v${this.state.data.compiletime.version}`}
>
v{this.state.data.compiletime.version}
</a>
</span>
</h3> :
null
}
</div>

<div className="mr-mb-8 md:mr-mb-0 md:mr-px-4 md:mr-flex-1">
Expand Down
5 changes: 5 additions & 0 deletions src/components/Footer/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export default defineMessages({
defaultMessage: "MapRoulette",
},

APIVersionLabel: {
id: "Footer.APIversionLabel",
defaultMessage: "MaprouletteAPI",
},

getHelp: {
id: "Footer.getHelp",
defaultMessage: "Get Help",
Expand Down

0 comments on commit 3972e6c

Please sign in to comment.