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,15 +24,18 @@ 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) ?
<li key={`${entry.revision_id}`} className="edit-history-list-element"> <InfoBox msg="No changes in the last week"></InfoBox> :
<BuildingEditSummary history.map(entry => (
historyEntry={entry} <li key={`${entry.revision_id}`} className="edit-history-list-element">
showBuildingId={true} <BuildingEditSummary
hyperlinkCategories={true} historyEntry={entry}
/> showBuildingId={true}
</li> hyperlinkCategories={true}
))} />
</li>
))
}
</ul> </ul>
</section> </section>
</article> </article>