Add info when no recent edit history to display

This commit is contained in:
Maciej Ziarkowski 2019-11-18 14:18:19 +00:00
parent fe84016e79
commit 2ffa14cdbb

View File

@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { BuildingEditSummary } from '../building/edit-history/building-edit-summary'; import { BuildingEditSummary } from '../building/edit-history/building-edit-summary';
import InfoBox from '../components/info-box';
import { EditHistoryEntry } from '../models/edit-history-entry'; import { EditHistoryEntry } from '../models/edit-history-entry';
const ChangesPage = () => { const ChangesPage = () => {
@ -23,7 +24,9 @@ const ChangesPage = () => {
<h1>Global edit history</h1> <h1>Global edit history</h1>
<ul className="edit-history-list"> <ul className="edit-history-list">
{history && history.map(entry => ( {(history == undefined || history.length == 0) ?
<InfoBox msg="No changes in the last week"></InfoBox> :
history.map(entry => (
<li key={`${entry.revision_id}`} className="edit-history-list-element"> <li key={`${entry.revision_id}`} className="edit-history-list-element">
<BuildingEditSummary <BuildingEditSummary
historyEntry={entry} historyEntry={entry}
@ -31,7 +34,8 @@ const ChangesPage = () => {
hyperlinkCategories={true} hyperlinkCategories={true}
/> />
</li> </li>
))} ))
}
</ul> </ul>
</section> </section>
</article> </article>