sort pictures by most recent

This commit is contained in:
2020-10-15 14:53:41 +03:00
committed by Stepan Usatiuk
parent 0b44f10a56
commit 3313c52086
10 changed files with 86 additions and 25 deletions

View File

@@ -29,9 +29,9 @@ export const OverviewComponent: React.FunctionComponent<IOverviewComponentProps>
return <LoadingStub spinner={props.fetchingSpinner} />;
}
const photos = props.photos.map((photo) => (
<PhotoCard key={photo.id} photo={photo} />
));
const photos = props.photos
.sort((a, b) => b.shotAt - a.shotAt)
.map((photo) => <PhotoCard key={photo.id} photo={photo} />);
return (
<div id="overview">

View File

@@ -42,7 +42,7 @@ export class PhotoCardComponent extends React.PureComponent<
}
*/
public render(): JSX.Element {
const isUploaded = this.props.photo.uploaded;
const fileExists = this.props.photo.uploaded;
return (
<Card
className="photoCard"
@@ -53,7 +53,7 @@ export class PhotoCardComponent extends React.PureComponent<
}
*/
>
{isUploaded ? (
{fileExists ? (
<img src={getPhotoThumbPath(this.props.photo, 512)}></img>
) : (
<Spinner />