add BuildingEditSummaryBrief to Age category

This commit is contained in:
Ed Chalstrey 2022-08-09 14:09:59 +01:00
parent b2373c6abb
commit cee05b5979
2 changed files with 27 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import TextboxDataEntry from '../data-components/textbox-data-entry';
import Verification from '../data-components/verification'; import Verification from '../data-components/verification';
import YearDataEntry from '../data-components/year-data-entry'; import YearDataEntry from '../data-components/year-data-entry';
import withCopyEdit from '../data-container'; import withCopyEdit from '../data-container';
import BuildingEditSummaryBrief from '../edit-history/building-edit-summary';
import { CategoryViewProps } from './category-view-props'; import { CategoryViewProps } from './category-view-props';
@ -22,6 +23,7 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
){ ){
return ( return (
<Fragment> <Fragment>
<BuildingEditSummaryBrief/>
<YearDataEntry <YearDataEntry
year={props.building.date_year} year={props.building.date_year}
upper={props.building.date_upper} upper={props.building.date_upper}
@ -93,6 +95,7 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
}; };
return ( return (
<Fragment> <Fragment>
<BuildingEditSummaryBrief/>
<YearDataEntry <YearDataEntry
year={props.building.date_year} year={props.building.date_year}
upper={props.building.date_upper} upper={props.building.date_upper}

View File

@ -82,6 +82,30 @@ const BuildingEditSummary: React.FunctionComponent<BuildingEditSummaryProps> = (
); );
}; };
const BuildingEditSummaryBrief: React.FunctionComponent<BuildingEditSummaryProps> = ({
historyEntry,
showBuildingId = false,
hyperlinkCategories = false
}) => {
const entriesWithMetadata = enrichHistoryEntries(historyEntry.forward_patch, historyEntry.reverse_patch);
const entriesByCategory = arrayToDictionary(entriesWithMetadata, x => x.category);
const categoryHyperlinkTemplate = hyperlinkCategories && historyEntry.building_id != undefined ?
`/edit/$category/${historyEntry.building_id}` :
undefined;
return (
<div className="edit-history-entry">
<h2 className="edit-history-timestamp">Edited on {formatDate(parseDate(historyEntry.revision_timestamp))}</h2>
</div>
);
};
export { export {
BuildingEditSummary BuildingEditSummary
}; };
export {
BuildingEditSummaryBrief
};