diff --git a/src/components/MasonryGallery.js b/src/components/MasonryGallery.js index e131355..0051a81 100644 --- a/src/components/MasonryGallery.js +++ b/src/components/MasonryGallery.js @@ -11,7 +11,8 @@ import classNames from "classnames"; const MasonryGallery = ({ images, aspectsByBreakpoint: aspectTargetsByBreakpoint, - debug, + debugHue, + debugRating, }) => { const breakpoints = React.useMemo( () => R.pick(R.keys(aspectTargetsByBreakpoint), themeBreakpoints), @@ -114,7 +115,7 @@ const MasonryGallery = ({ - {debug && ( + {debugHue && ( hsl( {image.fields.imageMeta.dominantHue[0]},{" "} @@ -142,6 +143,11 @@ const MasonryGallery = ({ {(image.fields.imageMeta.dominantHue[2] * 100).toFixed(2)}% ) )} + {debugRating && ( + + rating: {image.fields.imageMeta.meta.Rating} + + )} { - const [sortKey, _setSortKey] = React.useState("date"); + const [sortKey, _setSortKey] = React.useState("rating"); const setSortKey = React.useCallback( (key) => { try { @@ -51,7 +52,7 @@ const GalleryPage = ({ data }) => { ); return -1 * (date1.getTime() - date2.getTime()); }) - : R.sortBy(R.path(SORT_KEYS[sortKey])) + : R.sort(R.descend(R.path(SORT_KEYS[sortKey]))) )(data.allFile.edges), [data, sortKey] ); @@ -98,9 +99,10 @@ const GalleryPage = ({ data }) => { onSelectionChange={setSortKey} selectedKey={sortKey} > + Default + Date Hue {showDebug && Dominant hue[debug]} - Date @@ -113,7 +115,8 @@ const GalleryPage = ({ data }) => { xl: 5, // '2xl': 6.1, }} - debug={sortKey === "hue_debug"} + debugHue={sortKey === "hue_debug"} + debugRating={sortKey === "rating" && showDebug} images={images} /> @@ -122,7 +125,10 @@ const GalleryPage = ({ data }) => { export const query = graphql` query GalleryPageQuery { - allFile(filter: { sourceInstanceName: { eq: "gallery" } }) { + allFile( + filter: { sourceInstanceName: { eq: "gallery" } } + sort: { fields: fields___imageMeta___dateTaken, order: DESC } + ) { edges { node { relativePath @@ -143,6 +149,7 @@ export const query = graphql` dominantHue dateTaken meta { + Rating ObjectName } vibrant {