add a few images and attempt singleRow masonry gallery

update gpu pics

add can pic
This commit is contained in:
2023-03-08 01:29:58 -08:00
parent 3116cc197d
commit 660b231d44
16 changed files with 55 additions and 9 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -91,7 +91,7 @@ function Option({ item, state }: OptionProps) {
return ( return (
<li <li
{...optionProps} {...optionProps}
className={`p-3 outline-none cursor-default flex items-center justify-between ${text} text-sm ${ className={`p-2 outline-none cursor-default flex items-center justify-between ${text} text-sm ${
isFocused ? "bg-transparentblack" : "" isFocused ? "bg-transparentblack" : ""
} ${isSelected ? "font-bold" : ""}`} } ${isSelected ? "font-bold" : ""}`}
ref={ref} ref={ref}
+10
View File
@@ -26,6 +26,7 @@ interface MasonryGalleryProps {
debugRating?: boolean; debugRating?: boolean;
linkState?: object; linkState?: object;
showPalette?: boolean; showPalette?: boolean;
singleRow?: boolean;
} }
const MasonryGallery = ({ const MasonryGallery = ({
@@ -35,6 +36,7 @@ const MasonryGallery = ({
debugRating, debugRating,
linkState, linkState,
showPalette, showPalette,
singleRow,
}: MasonryGalleryProps) => { }: MasonryGalleryProps) => {
const [isClient, setIsClient] = React.useState(false); const [isClient, setIsClient] = React.useState(false);
React.useEffect(() => { React.useEffect(() => {
@@ -83,6 +85,14 @@ const MasonryGallery = ({
}, },
]; ];
} }
// no-op instead of starting a new row
if (singleRow) {
return [
...acc,
currentRow,
]
}
// start a new row
return [ return [
...acc, ...acc,
currentRow, currentRow,
+8 -5
View File
@@ -20,7 +20,8 @@ const SORT_KEYS = {
hue: ["fields", "imageMeta", "vibrantHue"], hue: ["fields", "imageMeta", "vibrantHue"],
rating: ["fields", "imageMeta", "meta", "Rating"], rating: ["fields", "imageMeta", "meta", "Rating"],
hue_debug: ["fields", "imageMeta", "dominantHue", 0], hue_debug: ["fields", "imageMeta", "dominantHue", 0],
date: [], date: ["fields", "imageMeta", "dateTaken"],
modified: ["fields", "imageMeta", "meta", "ModifyDate"]
} as const; } as const;
export type GalleryImage = export type GalleryImage =
@@ -128,13 +129,13 @@ const GalleryPage = ({ data }: PageProps<Queries.GalleryPageQueryQuery>) => {
const images: GalleryImage[] = React.useMemo(() => { const images: GalleryImage[] = React.useMemo(() => {
const sort = const sort =
sortKey === "date" sortKey === "date" || sortKey === "modified"
? R.sort((node1: typeof data["all"]["nodes"][number], node2) => { ? R.sort((node1: typeof data["all"]["nodes"][number], node2) => {
const date1 = new Date( const date1 = new Date(
R.pathOr("", ["fields", "imageMeta", "dateTaken"], node1) R.pathOr("", SORT_KEYS[sortKey], node1)
); );
const date2 = new Date( const date2 = new Date(
R.pathOr("", ["fields", "imageMeta", "dateTaken"], node2) R.pathOr("", SORT_KEYS[sortKey], node2)
); );
return -1 * (date1.getTime() - date2.getTime()); return -1 * (date1.getTime() - date2.getTime());
}) })
@@ -210,6 +211,7 @@ const GalleryPage = ({ data }: PageProps<Queries.GalleryPageQueryQuery>) => {
"3xl": 8, "3xl": 8,
}} }}
images={data.recents.nodes} images={data.recents.nodes}
singleRow
/> />
<div className="px-4 md:px-8 mt-4 pt-2 border-t"> <div className="px-4 md:px-8 mt-4 pt-2 border-t">
<h3 id="all" className="mx-2 font-bold">All images</h3> <h3 id="all" className="mx-2 font-bold">All images</h3>
@@ -256,7 +258,8 @@ const GalleryPage = ({ data }: PageProps<Queries.GalleryPageQueryQuery>) => {
selectedKey={sortKey} selectedKey={sortKey}
> >
<Item key="rating">Curated</Item> <Item key="rating">Curated</Item>
<Item key="date">Date</Item> <Item key="modified">Date Updated</Item>
<Item key="date">Date taken</Item>
<Item key="hue">Hue</Item> <Item key="hue">Hue</Item>
</Select> </Select>
</div> </div>
+3
View File
@@ -55,6 +55,9 @@ const gcd = (a: number, b: number): number => {
}; };
export const getShutterFractionFromExposureTime = (exposureTime: number) => { export const getShutterFractionFromExposureTime = (exposureTime: number) => {
if (exposureTime === 0.3333333333333333) {
return "1/3";
}
if (exposureTime === 0.03333333333333333) { if (exposureTime === 0.03333333333333333) {
return "1/30"; return "1/30";
} }