Skip to content

Commit

Permalink
[ADD] Fetch all licenses from API and display as foldable elements
Browse files Browse the repository at this point in the history
  • Loading branch information
KeyWeeUsr committed May 3, 2019
1 parent 55799cb commit 5e44307
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions frostmark/core/gui/react/src/About.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
import React, { Component } from 'react';

import './About.css';
import Foldable from './Foldable';


class About extends Component {
constructor() {
super();
this.state = {
licenses: {}
};
}

componentWillMount() {
this.getLicenses();
}

getLicenses() {
fetch(
'/api/all_licenses',
{ mode: "cors" }
).then(response => response.json()).then(data => {
this.setState({ licenses: data });
});
}

render() {
return <div className='about'>
<p>Frostmark is a simple bookmarks manager. It can import all
Expand All @@ -22,6 +43,19 @@ class About extends Component {
and talk about the project in the &nbsp;
<a href="https://riot.im/app/#/group/+frostmark:matrix.org">
Matrix community</a></p>

{
Object.keys(this.state.licenses).map(
key => <Foldable
title={
this.state.licenses[key].commit
? `${key} (${this.state.licenses[key].commit})`
: key
}
text={ this.state.licenses[key].license }
/>
)
}
</div>;
}
}
Expand Down

0 comments on commit 5e44307

Please sign in to comment.