From 0d9ba09dee4be8609f50be1de91f07ab918bd5e1 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 08:42:08 -0600 Subject: [PATCH 01/24] Change cmd-k loading text to 'searching' --- src/components/CommandKClient.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 91dcd4ba..450e89dd 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -139,7 +139,7 @@ export default function CommandKClient({ - {isLoading ? 'Loading ...' : 'No results found'} + {isLoading ? 'Searching ...' : 'No results found'} {queriedSections .concat(sections) From 02cfa4ee524b9cc20324aced644f223e018ba168 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 12:33:31 -0600 Subject: [PATCH 02/24] Create cmd-k affordance in nav --- .vscode/settings.json | 1 + src/app/layout.tsx | 6 ++-- src/components/CommandKClient.tsx | 59 ++++++++++++++++++++---------- src/components/Modal.tsx | 8 ++--- src/site/IconSearch.tsx | 27 ++++++++++++++ src/site/IconSets.tsx | 31 ---------------- src/site/NavClient.tsx | 3 -- src/site/ViewSwitcher.tsx | 60 ++++++++++++++++--------------- src/site/paths.ts | 5 --- src/state/AppStateProvider.tsx | 6 +++- src/state/index.ts | 6 ++-- 11 files changed, 117 insertions(+), 95 deletions(-) create mode 100644 src/site/IconSearch.tsx delete mode 100644 src/site/IconSets.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index ea2c7fe4..637cea4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "cSpell.words": [ "ABCDEFGHIJKLMNOP", "Acros", + "affordance", "ARROWLEFT", "ARROWRIGHT", "Astia", diff --git a/src/app/layout.tsx b/src/app/layout.tsx index fc091c62..95f0a523 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,7 +4,7 @@ import { clsx } from 'clsx/lite'; import { IBM_Plex_Mono } from 'next/font/google'; import { Metadata } from 'next'; import { BASE_URL, SITE_DESCRIPTION, SITE_TITLE } from '@/site/config'; -import StateProvider from '@/state/AppStateProvider'; +import AppStateProvider from '@/state/AppStateProvider'; import ThemeProviderClient from '@/site/ThemeProviderClient'; import Nav from '@/site/Nav'; import ToasterWithThemes from '@/toast/ToasterWithThemes'; @@ -73,7 +73,7 @@ export default function RootLayout({ suppressHydrationWarning > - +
- + diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 450e89dd..ba53b62f 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -1,7 +1,7 @@ 'use client'; import { Command } from 'cmdk'; -import { ReactNode, useEffect, useState } from 'react'; +import { ReactNode, useEffect, useMemo, useState } from 'react'; import Modal from './Modal'; import { clsx } from 'clsx/lite'; import { useDebounce } from 'use-debounce'; @@ -10,6 +10,8 @@ import { useRouter } from 'next/navigation'; import { useTheme } from 'next-themes'; import { BiDesktop, BiMoon, BiSun } from 'react-icons/bi'; import { IoInvertModeSharp } from 'react-icons/io5'; +import { useAppState } from '@/state'; +import { parameterize } from '@/utility/string'; const LISTENER_KEYDOWN = 'keydown'; const MINIMUM_QUERY_LENGTH = 2; @@ -34,9 +36,22 @@ export default function CommandKClient({ onQueryChange?: (query: string) => Promise sections?: CommandKSection[] }) { - const [isOpen, setIsOpen] = useState(false); - const [queryRaw, setQueryRaw] = useState(''); - const [queryDebounced] = useDebounce(queryRaw, 500, { trailing: true }); + const { + isCommandKOpen: isOpen, + setIsCommandKOpen: setIsOpen, + } = useAppState(); + + // Raw query values + const [queryLiveRaw, setQueryLive] = useState(''); + const [queryDebouncedRaw] = + useDebounce(queryLiveRaw, 500, { trailing: true }); + const isPlaceholderVisible = queryLiveRaw === ''; + + // Parameterized query values + const queryLive = useMemo(() => + parameterize(queryLiveRaw), [queryLiveRaw]); + const queryDebounced = useMemo(() => + parameterize(queryDebouncedRaw), [queryDebouncedRaw]); const [isLoading, setIsLoading] = useState(false); const [queriedSections, setQueriedSections] = useState([]); @@ -49,12 +64,12 @@ export default function CommandKClient({ const down = (e: KeyboardEvent) => { if (e.key === 'k' && (e.metaKey || e.ctrlKey)) { e.preventDefault(); - setIsOpen((open) => !open); + setIsOpen?.((open) => !open); } }; document.addEventListener(LISTENER_KEYDOWN, down); return () => document.removeEventListener(LISTENER_KEYDOWN, down); - }, []); + }, [setIsOpen]); useEffect(() => { if (queryDebounced.length >= MINIMUM_QUERY_LENGTH) { @@ -67,16 +82,17 @@ export default function CommandKClient({ }, [queryDebounced, onQueryChange]); useEffect(() => { - if (queryRaw === '') { + if (queryLive === '') { setQueriedSections([]); - } else if (queryRaw.length >= MINIMUM_QUERY_LENGTH) { + setIsLoading(false); + } else if (queryLive.length >= MINIMUM_QUERY_LENGTH) { setIsLoading(true); } - }, [queryRaw]); + }, [queryLive]); useEffect(() => { if (!isOpen) { - setQueryRaw(''); + setQueryLive(''); setQueriedSections([]); setIsLoading(false); } @@ -114,30 +130,37 @@ export default function CommandKClient({ > setIsOpen(false)} + onClose={() => setIsOpen?.(false)} fast >
-
+
setQueryRaw(e.currentTarget.value)} + onChangeCapture={(e) => setQueryLive(e.currentTarget.value)} className={clsx( - 'w-full', + 'w-full !max-w-full !min-w-0', 'focus:ring-0', + isPlaceholderVisible || isLoading && '!pr-8', '!border-gray-200 dark:!border-gray-800', 'focus:border-gray-200 focus:dark:border-gray-800', 'placeholder:text-gray-400/80', 'placeholder:dark:text-gray-700', )} - style={{ paddingRight: '2rem' }} placeholder="Search photos, views, settings ..." /> {isLoading && - + }
- + {isLoading ? 'Searching ...' : 'No results found'} @@ -185,7 +208,7 @@ export default function CommandKClient({ 'data-[selected=true]:dark:bg-gray-900/75', )} onSelect={() => { - setIsOpen(false); + setIsOpen?.(false); action?.(); if (path) { router.push(path); diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index 646b4d84..12ea5efa 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -57,7 +57,7 @@ export default function Modal({ className={clsx( 'fixed inset-0 z-50 flex justify-center', anchor === 'top' - ? 'items-start pt-4 sm:pt-24' + ? 'items-start pt-4 xs:pt-12 sm:pt-24' : 'items-center', 'bg-black', )} @@ -70,16 +70,16 @@ export default function Modal({ {children}
]} diff --git a/src/site/IconSearch.tsx b/src/site/IconSearch.tsx new file mode 100644 index 00000000..d7ae0ff9 --- /dev/null +++ b/src/site/IconSearch.tsx @@ -0,0 +1,27 @@ +/* eslint-disable max-len */ + +const INTRINSIC_WIDTH = 28; +const INTRINSIC_HEIGHT = 24; + +export default function IconSearch({ + width = INTRINSIC_WIDTH, + includeTitle = true, +}: { + width?: number; + includeTitle?: boolean; +}) { + return ( + + {includeTitle && Search} + + + + ); +} diff --git a/src/site/IconSets.tsx b/src/site/IconSets.tsx deleted file mode 100644 index 7d26b32d..00000000 --- a/src/site/IconSets.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-disable max-len */ - -const INTRINSIC_WIDTH = 28; -const INTRINSIC_HEIGHT = 24; - -export default function IconSets({ - width = INTRINSIC_WIDTH, - includeTitle = true, -}: { - width?: number - includeTitle?: boolean -}) { - return ( - - {includeTitle && Photo Sets} - - - - - - - - ); -}; diff --git a/src/site/NavClient.tsx b/src/site/NavClient.tsx index e15e3590..7bc8b208 100644 --- a/src/site/NavClient.tsx +++ b/src/site/NavClient.tsx @@ -11,7 +11,6 @@ import { isPathAdmin, isPathGrid, isPathProtected, - isPathSets, isPathSignIn, } from '@/site/paths'; import AnimateItems from '../components/AnimateItems'; @@ -40,8 +39,6 @@ export default function NavClient({ return 'full-frame'; } else if (isPathGrid(pathname)) { return 'grid'; - } else if (isPathSets(pathname)) { - return 'sets'; } else if (isPathProtected(pathname)) { return 'admin'; } diff --git a/src/site/ViewSwitcher.tsx b/src/site/ViewSwitcher.tsx index 7f7fa149..cb91b9c2 100644 --- a/src/site/ViewSwitcher.tsx +++ b/src/site/ViewSwitcher.tsx @@ -2,9 +2,10 @@ import Switcher from '@/components/Switcher'; import SwitcherItem from '@/components/SwitcherItem'; import IconFullFrame from '@/site/IconFullFrame'; import IconGrid from '@/site/IconGrid'; -import { PATH_ADMIN_PHOTOS, PATH_GRID, PATH_SETS } from '@/site/paths'; +import { PATH_ADMIN_PHOTOS, PATH_GRID } from '@/site/paths'; import { BiLockAlt } from 'react-icons/bi'; -import IconSets from './IconSets'; +import { useAppState } from '@/state'; +import IconSearch from './IconSearch'; export type SwitcherSelection = 'full-frame' | 'grid' | 'sets' | 'admin'; @@ -15,33 +16,36 @@ export default function ViewSwitcher({ currentSelection?: SwitcherSelection showAdmin?: boolean }) { + const { setIsCommandKOpen } = useAppState(); + return ( - - } - href="/" - active={currentSelection === 'full-frame'} - noPadding - /> - } - href={PATH_GRID} - active={currentSelection === 'grid'} - noPadding - /> - } - href={PATH_SETS} - active={currentSelection === 'sets'} - noPadding - /> - {showAdmin && +
+ } - href={PATH_ADMIN_PHOTOS} - active={currentSelection === 'admin'} - />} - + icon={} + href="/" + active={currentSelection === 'full-frame'} + noPadding + /> + } + href={PATH_GRID} + active={currentSelection === 'grid'} + noPadding + /> + {showAdmin && + } + href={PATH_ADMIN_PHOTOS} + active={currentSelection === 'admin'} + />} + + + } + onClick={() => setIsCommandKOpen?.(true)} + /> + +
); } diff --git a/src/site/paths.ts b/src/site/paths.ts index e6b699ce..0d500be6 100644 --- a/src/site/paths.ts +++ b/src/site/paths.ts @@ -10,7 +10,6 @@ import { FilmSimulation } from '@/simulation'; // Core paths export const PATH_ROOT = '/'; export const PATH_GRID = '/grid'; -export const PATH_SETS = '/sets'; export const PATH_ADMIN = '/admin'; export const PATH_API = '/api'; export const PATH_SIGN_IN = '/sign-in'; @@ -55,7 +54,6 @@ export const PATHS_ADMIN = [ export const PATHS_TO_CACHE = [ PATH_ROOT, PATH_GRID, - PATH_SETS, PATH_OG, PATH_PHOTO_DYNAMIC, PATH_TAG_DYNAMIC, @@ -236,9 +234,6 @@ export const checkPathPrefix = (pathname = '', prefix: string) => export const isPathGrid = (pathname?: string) => checkPathPrefix(pathname, PATH_GRID); -export const isPathSets = (pathname?: string) => - checkPathPrefix(pathname, PATH_SETS); - export const isPathSignIn = (pathname?: string) => checkPathPrefix(pathname, PATH_SIGN_IN); diff --git a/src/state/AppStateProvider.tsx b/src/state/AppStateProvider.tsx index 082df160..7001d824 100644 --- a/src/state/AppStateProvider.tsx +++ b/src/state/AppStateProvider.tsx @@ -5,7 +5,7 @@ import { AppStateContext } from '.'; import { AnimationConfig } from '@/components/AnimateItems'; import usePathnames from '@/utility/usePathnames'; -export default function StateProvider({ +export default function AppStateProvider({ children, }: { children: ReactNode @@ -17,6 +17,8 @@ export default function StateProvider({ const [nextPhotoAnimation, setNextPhotoAnimation] = useState(); + const [isCommandKOpen, setIsCommandKOpen] = useState(false); + useEffect(() => { setHasLoaded?.(true); }, [setHasLoaded]); @@ -28,6 +30,8 @@ export default function StateProvider({ hasLoaded, setHasLoaded, nextPhotoAnimation, + isCommandKOpen, + setIsCommandKOpen, setNextPhotoAnimation, clearNextPhotoAnimation: () => setNextPhotoAnimation?.(undefined), }} diff --git a/src/state/index.ts b/src/state/index.ts index c8b70912..b91f43af 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -1,11 +1,13 @@ -import { createContext, useContext } from 'react'; +import { Dispatch, SetStateAction, createContext, useContext } from 'react'; import { AnimationConfig } from '@/components/AnimateItems'; export interface AppStateContext { previousPathname?: string hasLoaded?: boolean - setHasLoaded?: (hasLoaded: boolean) => void + setHasLoaded?: Dispatch> nextPhotoAnimation?: AnimationConfig + isCommandKOpen?: boolean + setIsCommandKOpen?: Dispatch> setNextPhotoAnimation?: (animation?: AnimationConfig) => void clearNextPhotoAnimation?: () => void } From bea16bad6086fb45dae141f9ed1d69cc0c8a4238 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 12:50:18 -0600 Subject: [PATCH 03/24] Switch to next.js canary --- package.json | 2 +- pnpm-lock.yaml | 103 ++++++++++++++++++++++++++----------------------- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index 9531e880..1a2bee9c 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.6", - "next": "14.1.0", + "next": "14.1.1-canary.67", "next-auth": "5.0.0-beta.9", "next-themes": "^0.2.1", "postcss": "8.4.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 77e35e51..0734155d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,7 @@ dependencies: version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.1.0)(react@18.2.0) + version: 1.2.2(next@14.1.1-canary.67)(react@18.2.0) '@vercel/blob': specifier: ^0.22.0 version: 0.22.0 @@ -55,7 +55,7 @@ dependencies: version: 0.7.2 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.1.0)(react@18.2.0) + version: 1.0.10(next@14.1.1-canary.67)(react@18.2.0) autoprefixer: specifier: 10.4.17 version: 10.4.17(postcss@8.4.35) @@ -93,14 +93,14 @@ dependencies: specifier: ^5.0.6 version: 5.0.6 next: - specifier: 14.1.0 - version: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.1.1-canary.67 + version: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 5.0.0-beta.9 - version: 5.0.0-beta.9(next@14.1.0)(react@18.2.0) + version: 5.0.0-beta.9(next@14.1.1-canary.67)(react@18.2.0) next-themes: specifier: ^0.2.1 - version: 0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@14.1.1-canary.67)(react-dom@18.2.0)(react@18.2.0) postcss: specifier: 8.4.35 version: 8.4.35 @@ -1563,8 +1563,8 @@ packages: - utf-8-validate dev: false - /@next/env@14.1.0: - resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==} + /@next/env@14.1.1-canary.67: + resolution: {integrity: sha512-v7nB6WURXs7qqpCeChafiomTRmkcpwg7hhbjnusV0LRAtQ/kQrf7to7W/O5kC9d732t6INe7UBNz3Ib7WKd1uQ==} dev: false /@next/eslint-plugin-next@14.1.0: @@ -1573,8 +1573,8 @@ packages: glob: 10.3.10 dev: false - /@next/swc-darwin-arm64@14.1.0: - resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==} + /@next/swc-darwin-arm64@14.1.1-canary.67: + resolution: {integrity: sha512-wFmNv3aQ7Op6GZ3mCyXbNVgWxqHrvaOkloPWWvc+D9MZNtywT0/RU83t/WUuDU5NnkLi0S2zht4dqNrcgfZqtQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1582,8 +1582,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.1.0: - resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==} + /@next/swc-darwin-x64@14.1.1-canary.67: + resolution: {integrity: sha512-HbTOQzbL8BTKAygCVjJ27E0GShdW8gn1nG7js1msGo1XYtj85nC/VnEftcyDa3zsNJvC/xmfHAd5BkENOZWDNQ==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1591,8 +1591,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.1.0: - resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==} + /@next/swc-linux-arm64-gnu@14.1.1-canary.67: + resolution: {integrity: sha512-wMbqR2r2Tsi/TWU/LqEC2Mn+BVDgng/aXAQo+PlOhpmZEFSdqiMwXuZCxAgtgC/NbopaRM4jm4Xi0JLwwHnotw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1600,8 +1600,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.1.0: - resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==} + /@next/swc-linux-arm64-musl@14.1.1-canary.67: + resolution: {integrity: sha512-CwcPVm5oHk9SvzVMZVhRap6ETlyrFHuHFbWKNXhMLzuRdIP+6M2podqQ0rojFXyqysPmg5/g3/s3iKGbZmCogw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1609,8 +1609,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.1.0: - resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==} + /@next/swc-linux-x64-gnu@14.1.1-canary.67: + resolution: {integrity: sha512-VbiDqplc6TRL72//YuPc8pQnD+6W41g+438AE23Uq2JcN+M8uu3A//grZkWkObA/ICr52bG4afbs2iKVkYMlFw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1618,8 +1618,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.1.0: - resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==} + /@next/swc-linux-x64-musl@14.1.1-canary.67: + resolution: {integrity: sha512-qyuFmtImFpMoMdA19QOuCcUvjkA3HolZFqnPi31eQzed4eLW5EIBURWHCTj3yeYXGLR0na9hW7fFzRcg0Bu/xQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1627,8 +1627,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.1.0: - resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==} + /@next/swc-win32-arm64-msvc@14.1.1-canary.67: + resolution: {integrity: sha512-Di/JSatsweg9oACMFZrYtAfia+BFXpz2cdioNaXVT2fL+RXQ6V1LRU4jKFw8TLXt7dA4S5PfK/r/rxnjR5xN/Q==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1636,8 +1636,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.1.0: - resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==} + /@next/swc-win32-ia32-msvc@14.1.1-canary.67: + resolution: {integrity: sha512-Gr+v1NAOEpo+cajhlytm3RzKLYj3uyD9AKlAb1z9Qx6iTJC8o+PFYH9wnG9JndHb1dCLpWiCXEtU3ZHDpkD7NQ==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1645,8 +1645,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.1.0: - resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==} + /@next/swc-win32-x64-msvc@14.1.1-canary.67: + resolution: {integrity: sha512-bU+gq2EUl6cJi/TaaS03hoK4NGT3LRLcrkevMdLBHLVxgJRe2GUpqpXU0ZGFFoVdjJyZb28rFF0JRjJTtIpD4Q==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2817,9 +2817,14 @@ packages: tslib: 2.6.2 dev: false - /@swc/helpers@0.5.2: - resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} + /@swc/counter@0.1.3: + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + dev: false + + /@swc/helpers@0.5.5: + resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} dependencies: + '@swc/counter': 0.1.3 tslib: 2.6.2 dev: false @@ -3238,7 +3243,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: false - /@vercel/analytics@1.2.2(next@14.1.0)(react@18.2.0): + /@vercel/analytics@1.2.2(next@14.1.1-canary.67)(react@18.2.0): resolution: {integrity: sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==} peerDependencies: next: '>= 13' @@ -3249,7 +3254,7 @@ packages: react: optional: true dependencies: - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 server-only: 0.0.1 dev: false @@ -3273,7 +3278,7 @@ packages: ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) dev: false - /@vercel/speed-insights@1.0.10(next@14.1.0)(react@18.2.0): + /@vercel/speed-insights@1.0.10(next@14.1.1-canary.67)(react@18.2.0): resolution: {integrity: sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g==} requiresBuild: true peerDependencies: @@ -3297,7 +3302,7 @@ packages: vue-router: optional: true dependencies: - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false @@ -6183,7 +6188,7 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: false - /next-auth@5.0.0-beta.9(next@14.1.0)(react@18.2.0): + /next-auth@5.0.0-beta.9(next@14.1.1-canary.67)(react@18.2.0): resolution: {integrity: sha512-BWFiwJ/wzfxWpHnGpAoFsXHSlVofWgFns6tjtIGeDrXfEf3D+afnBpmzCNyek2RNYDVgMHi8Q5uXzFoNBd2l5g==} peerDependencies: '@simplewebauthn/browser': ^9.0.1 @@ -6200,24 +6205,24 @@ packages: optional: true dependencies: '@auth/core': 0.26.3 - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false - /next-themes@0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@14.1.1-canary.67)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==} + /next@14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-oCNdivm5oDvWJ91dUPq/vdt1bCjkQCypkKdiiUzEH1lxcsEOUbQbgxmk+YRh91Wm+HLhHtuZsyf+jwD6Lju+gw==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -6231,8 +6236,8 @@ packages: sass: optional: true dependencies: - '@next/env': 14.1.0 - '@swc/helpers': 0.5.2 + '@next/env': 14.1.1-canary.67 + '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001585 graceful-fs: 4.2.11 @@ -6241,15 +6246,15 @@ packages: react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.0 - '@next/swc-darwin-x64': 14.1.0 - '@next/swc-linux-arm64-gnu': 14.1.0 - '@next/swc-linux-arm64-musl': 14.1.0 - '@next/swc-linux-x64-gnu': 14.1.0 - '@next/swc-linux-x64-musl': 14.1.0 - '@next/swc-win32-arm64-msvc': 14.1.0 - '@next/swc-win32-ia32-msvc': 14.1.0 - '@next/swc-win32-x64-msvc': 14.1.0 + '@next/swc-darwin-arm64': 14.1.1-canary.67 + '@next/swc-darwin-x64': 14.1.1-canary.67 + '@next/swc-linux-arm64-gnu': 14.1.1-canary.67 + '@next/swc-linux-arm64-musl': 14.1.1-canary.67 + '@next/swc-linux-x64-gnu': 14.1.1-canary.67 + '@next/swc-linux-x64-musl': 14.1.1-canary.67 + '@next/swc-win32-arm64-msvc': 14.1.1-canary.67 + '@next/swc-win32-ia32-msvc': 14.1.1-canary.67 + '@next/swc-win32-x64-msvc': 14.1.1-canary.67 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros From dea48609a6c69fae4e436360b949d77e22d87b36 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 14:07:32 -0600 Subject: [PATCH 04/24] Refine cmd-k menu on mobile --- src/components/CommandKClient.tsx | 3 +-- src/components/Modal.tsx | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index ba53b62f..2c02e9af 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -158,8 +158,7 @@ export default function CommandKClient({
{isLoading ? 'Searching ...' : 'No results found'} diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index 12ea5efa..fb75a8ed 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -1,6 +1,6 @@ 'use client'; -import { ReactNode, useEffect, useRef, useState } from 'react'; +import { ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react'; import { motion } from 'framer-motion'; import { clsx } from 'clsx/lite'; import useClickInsideOutside from '@/utility/useClickInsideOutside'; @@ -8,6 +8,7 @@ import { useRouter } from 'next/navigation'; import AnimateItems from './AnimateItems'; import { PATH_ROOT } from '@/site/paths'; import usePrefersReducedMotion from '@/utility/usePrefersReducedMotion'; +import { useTheme } from 'next-themes'; export default function Modal({ onClosePath, @@ -38,6 +39,19 @@ export default function Modal({ } }, []); + const { resolvedTheme } = useTheme(); + useLayoutEffect(() => { + if (resolvedTheme === 'light') { + // Temporarily create meta tag for overlays in light mode, + // which prevents stale headers on theme changes + const meta = document.createElement('meta'); + meta.name = 'theme-color'; + meta.content = '#333'; + document.getElementsByTagName('head')[0]?.appendChild(meta); + return () => meta.remove(); + } + }, [resolvedTheme]); + useClickInsideOutside({ htmlElements, onClickOutside: () => { @@ -57,7 +71,7 @@ export default function Modal({ className={clsx( 'fixed inset-0 z-50 flex justify-center', anchor === 'top' - ? 'items-start pt-4 xs:pt-12 sm:pt-24' + ? 'items-start pt-4 sm:pt-24' : 'items-center', 'bg-black', )} @@ -73,7 +87,7 @@ export default function Modal({ ref={contentRef} key="modalContent" className={clsx( - 'w-[calc(100vw-1.5rem)] xs:w-[min(500px,90vw)]', + 'w-[calc(100vw-1.5rem)] sm:w-[min(500px,90vw)]', 'p-3 rounded-lg', 'md:p-4 md:rounded-xl', 'bg-white dark:bg-black', From 35efada24b27191178e3107da2b1fe755918e436 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 17:26:55 -0600 Subject: [PATCH 05/24] Refine cmd-k modal, primary navigation UI --- package.json | 2 +- pnpm-lock.yaml | 92 +++++++++++++++---------------- src/components/CommandKClient.tsx | 4 +- src/components/Modal.tsx | 2 +- src/components/Switcher.tsx | 11 ++-- src/components/SwitcherItem.tsx | 9 ++- src/site/IconSearch.tsx | 6 +- src/site/ViewSwitcher.tsx | 2 +- 8 files changed, 67 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 1a2bee9c..eb296c0a 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.6", - "next": "14.1.1-canary.67", + "next": "14.1.1-canary.68", "next-auth": "5.0.0-beta.9", "next-themes": "^0.2.1", "postcss": "8.4.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0734155d..6a9a4043 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,7 @@ dependencies: version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.1.1-canary.67)(react@18.2.0) + version: 1.2.2(next@14.1.1-canary.68)(react@18.2.0) '@vercel/blob': specifier: ^0.22.0 version: 0.22.0 @@ -55,7 +55,7 @@ dependencies: version: 0.7.2 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.1.1-canary.67)(react@18.2.0) + version: 1.0.10(next@14.1.1-canary.68)(react@18.2.0) autoprefixer: specifier: 10.4.17 version: 10.4.17(postcss@8.4.35) @@ -93,14 +93,14 @@ dependencies: specifier: ^5.0.6 version: 5.0.6 next: - specifier: 14.1.1-canary.67 - version: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.1.1-canary.68 + version: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 5.0.0-beta.9 - version: 5.0.0-beta.9(next@14.1.1-canary.67)(react@18.2.0) + version: 5.0.0-beta.9(next@14.1.1-canary.68)(react@18.2.0) next-themes: specifier: ^0.2.1 - version: 0.2.1(next@14.1.1-canary.67)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@14.1.1-canary.68)(react-dom@18.2.0)(react@18.2.0) postcss: specifier: 8.4.35 version: 8.4.35 @@ -1563,8 +1563,8 @@ packages: - utf-8-validate dev: false - /@next/env@14.1.1-canary.67: - resolution: {integrity: sha512-v7nB6WURXs7qqpCeChafiomTRmkcpwg7hhbjnusV0LRAtQ/kQrf7to7W/O5kC9d732t6INe7UBNz3Ib7WKd1uQ==} + /@next/env@14.1.1-canary.68: + resolution: {integrity: sha512-yoicBuz9kJC0jIS7XXU+W8a1a0Tr5sFuBuJO2w5DiYPhNHCQiSZsWgvkXY8ddFjZuxztoWPIvKPJvWzeVh3d2Q==} dev: false /@next/eslint-plugin-next@14.1.0: @@ -1573,8 +1573,8 @@ packages: glob: 10.3.10 dev: false - /@next/swc-darwin-arm64@14.1.1-canary.67: - resolution: {integrity: sha512-wFmNv3aQ7Op6GZ3mCyXbNVgWxqHrvaOkloPWWvc+D9MZNtywT0/RU83t/WUuDU5NnkLi0S2zht4dqNrcgfZqtQ==} + /@next/swc-darwin-arm64@14.1.1-canary.68: + resolution: {integrity: sha512-L7uuGuuhQlEFioGUj1xNIGyp9RZs0QaVuPS/Y9tiPAlEdIK12HTequRoplI/zD9pGoF6TjnuWu1s81RuBXQM1w==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1582,8 +1582,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.1.1-canary.67: - resolution: {integrity: sha512-HbTOQzbL8BTKAygCVjJ27E0GShdW8gn1nG7js1msGo1XYtj85nC/VnEftcyDa3zsNJvC/xmfHAd5BkENOZWDNQ==} + /@next/swc-darwin-x64@14.1.1-canary.68: + resolution: {integrity: sha512-4wc0BgPoGhrdETnscCe4Q2MX+LwRTyn3cZlBUNAFqPll7Q/sW2959HNepPKIOMvkb0gdGqXyYnPhCwIBeW1Z/A==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1591,8 +1591,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.1.1-canary.67: - resolution: {integrity: sha512-wMbqR2r2Tsi/TWU/LqEC2Mn+BVDgng/aXAQo+PlOhpmZEFSdqiMwXuZCxAgtgC/NbopaRM4jm4Xi0JLwwHnotw==} + /@next/swc-linux-arm64-gnu@14.1.1-canary.68: + resolution: {integrity: sha512-+c43JmcLmyCVnFBffUrjGQttv0Tc9XM64QJjUnwABqp0Q/k48gnJjGFiUOSnhrj6sHxL4iU9h8W+ti7I0br1aA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1600,8 +1600,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.1.1-canary.67: - resolution: {integrity: sha512-CwcPVm5oHk9SvzVMZVhRap6ETlyrFHuHFbWKNXhMLzuRdIP+6M2podqQ0rojFXyqysPmg5/g3/s3iKGbZmCogw==} + /@next/swc-linux-arm64-musl@14.1.1-canary.68: + resolution: {integrity: sha512-1Lsk/mCPKxM8vuqYQKFmCrNoyRwGa08ZVtM/+QHJADIw8DLp70jXTJ9teyJ3TzrEBk1ZfQdloHnUasgG50B/GA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1609,8 +1609,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.1.1-canary.67: - resolution: {integrity: sha512-VbiDqplc6TRL72//YuPc8pQnD+6W41g+438AE23Uq2JcN+M8uu3A//grZkWkObA/ICr52bG4afbs2iKVkYMlFw==} + /@next/swc-linux-x64-gnu@14.1.1-canary.68: + resolution: {integrity: sha512-4XHLafF58VKcKMxoFJR9MqcH4LO1mO1p00CQmSzPB9TkNivFHuIoAsO/5f9rKcCzZMvRf44Akuqne2avfTtE8Q==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1618,8 +1618,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.1.1-canary.67: - resolution: {integrity: sha512-qyuFmtImFpMoMdA19QOuCcUvjkA3HolZFqnPi31eQzed4eLW5EIBURWHCTj3yeYXGLR0na9hW7fFzRcg0Bu/xQ==} + /@next/swc-linux-x64-musl@14.1.1-canary.68: + resolution: {integrity: sha512-gRve6Sw5SMff1m21PSxbcIUc7FSn3PugubGCDYPSoMi7qdmejOWZopioLupcaAg5qxnB+i/n+C+NP3x5L24sqQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1627,8 +1627,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.1.1-canary.67: - resolution: {integrity: sha512-Di/JSatsweg9oACMFZrYtAfia+BFXpz2cdioNaXVT2fL+RXQ6V1LRU4jKFw8TLXt7dA4S5PfK/r/rxnjR5xN/Q==} + /@next/swc-win32-arm64-msvc@14.1.1-canary.68: + resolution: {integrity: sha512-1tIuQfsS7OPWYy535/nnOd5/4wOTsWZoOTZpqKXdTYkroYWw2aN7nCsK11Mwz5XKqyFUSP8jofXg6kj07VhTNQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1636,8 +1636,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.1.1-canary.67: - resolution: {integrity: sha512-Gr+v1NAOEpo+cajhlytm3RzKLYj3uyD9AKlAb1z9Qx6iTJC8o+PFYH9wnG9JndHb1dCLpWiCXEtU3ZHDpkD7NQ==} + /@next/swc-win32-ia32-msvc@14.1.1-canary.68: + resolution: {integrity: sha512-wGS8neaZKlsliTGla3AuTFwK16/KqE4TBnxrc8er4T+ZpiBrluVPX6OR7x017cWf1nkruNAAgXyAdCZlPCe8mg==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1645,8 +1645,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.1.1-canary.67: - resolution: {integrity: sha512-bU+gq2EUl6cJi/TaaS03hoK4NGT3LRLcrkevMdLBHLVxgJRe2GUpqpXU0ZGFFoVdjJyZb28rFF0JRjJTtIpD4Q==} + /@next/swc-win32-x64-msvc@14.1.1-canary.68: + resolution: {integrity: sha512-LpMabXAnbJ+/2NBv4HphFfYhvfIFpxTXoLHZ8lI4V15YJ6KlFbBvKYi0LoyL1UEOBywyhgc7zJ9oASlf/ZKgfg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -3243,7 +3243,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: false - /@vercel/analytics@1.2.2(next@14.1.1-canary.67)(react@18.2.0): + /@vercel/analytics@1.2.2(next@14.1.1-canary.68)(react@18.2.0): resolution: {integrity: sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==} peerDependencies: next: '>= 13' @@ -3254,7 +3254,7 @@ packages: react: optional: true dependencies: - next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 server-only: 0.0.1 dev: false @@ -3278,7 +3278,7 @@ packages: ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) dev: false - /@vercel/speed-insights@1.0.10(next@14.1.1-canary.67)(react@18.2.0): + /@vercel/speed-insights@1.0.10(next@14.1.1-canary.68)(react@18.2.0): resolution: {integrity: sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g==} requiresBuild: true peerDependencies: @@ -3302,7 +3302,7 @@ packages: vue-router: optional: true dependencies: - next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false @@ -6188,7 +6188,7 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: false - /next-auth@5.0.0-beta.9(next@14.1.1-canary.67)(react@18.2.0): + /next-auth@5.0.0-beta.9(next@14.1.1-canary.68)(react@18.2.0): resolution: {integrity: sha512-BWFiwJ/wzfxWpHnGpAoFsXHSlVofWgFns6tjtIGeDrXfEf3D+afnBpmzCNyek2RNYDVgMHi8Q5uXzFoNBd2l5g==} peerDependencies: '@simplewebauthn/browser': ^9.0.1 @@ -6205,24 +6205,24 @@ packages: optional: true dependencies: '@auth/core': 0.26.3 - next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false - /next-themes@0.2.1(next@14.1.1-canary.67)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@14.1.1-canary.68)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@14.1.1-canary.67(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-oCNdivm5oDvWJ91dUPq/vdt1bCjkQCypkKdiiUzEH1lxcsEOUbQbgxmk+YRh91Wm+HLhHtuZsyf+jwD6Lju+gw==} + /next@14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-fYS6LFYwEI3rMzLc/htS3L3z/eTHNiXA33nioXYApShvUUewI3KSRwbpjFOONxW0crux2JZXNrPWEG2N41iHSA==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -6236,7 +6236,7 @@ packages: sass: optional: true dependencies: - '@next/env': 14.1.1-canary.67 + '@next/env': 14.1.1-canary.68 '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001585 @@ -6246,15 +6246,15 @@ packages: react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.1-canary.67 - '@next/swc-darwin-x64': 14.1.1-canary.67 - '@next/swc-linux-arm64-gnu': 14.1.1-canary.67 - '@next/swc-linux-arm64-musl': 14.1.1-canary.67 - '@next/swc-linux-x64-gnu': 14.1.1-canary.67 - '@next/swc-linux-x64-musl': 14.1.1-canary.67 - '@next/swc-win32-arm64-msvc': 14.1.1-canary.67 - '@next/swc-win32-ia32-msvc': 14.1.1-canary.67 - '@next/swc-win32-x64-msvc': 14.1.1-canary.67 + '@next/swc-darwin-arm64': 14.1.1-canary.68 + '@next/swc-darwin-x64': 14.1.1-canary.68 + '@next/swc-linux-arm64-gnu': 14.1.1-canary.68 + '@next/swc-linux-arm64-musl': 14.1.1-canary.68 + '@next/swc-linux-x64-gnu': 14.1.1-canary.68 + '@next/swc-linux-x64-musl': 14.1.1-canary.68 + '@next/swc-win32-arm64-msvc': 14.1.1-canary.68 + '@next/swc-win32-ia32-msvc': 14.1.1-canary.68 + '@next/swc-win32-x64-msvc': 14.1.1-canary.68 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 2c02e9af..557f201c 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -134,11 +134,11 @@ export default function CommandKClient({ fast >
-
+
setQueryLive(e.currentTarget.value)} className={clsx( - 'w-full !max-w-full !min-w-0', + 'w-full !min-w-0', 'focus:ring-0', isPlaceholderVisible || isLoading && '!pr-8', '!border-gray-200 dark:!border-gray-800', diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index fb75a8ed..6c35b83b 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -87,7 +87,7 @@ export default function Modal({ ref={contentRef} key="modalContent" className={clsx( - 'w-[calc(100vw-1.5rem)] sm:w-[min(500px,90vw)]', + 'w-[calc(100vw-1.5rem)] sm:w-[min(540px,90vw)]', 'p-3 rounded-lg', 'md:p-4 md:rounded-xl', 'bg-white dark:bg-black', diff --git a/src/components/Switcher.tsx b/src/components/Switcher.tsx index 74acf151..63be9212 100644 --- a/src/components/Switcher.tsx +++ b/src/components/Switcher.tsx @@ -3,17 +3,20 @@ import { clsx } from 'clsx/lite'; export default function Switcher({ children, + type = 'regular', }: { children: ReactNode + type?: 'regular' | 'borderless' }) { return (
{children}
diff --git a/src/components/SwitcherItem.tsx b/src/components/SwitcherItem.tsx index 4e41be1b..0a91e636 100644 --- a/src/components/SwitcherItem.tsx +++ b/src/components/SwitcherItem.tsx @@ -20,12 +20,15 @@ export default function SwitcherItem({ classNameProp, 'py-0.5 px-1.5', 'cursor-pointer', - 'hover:bg-gray-50 active:bg-gray-100 active:text-gray-400', + 'hover:bg-gray-100/60 active:bg-gray-100', // eslint-disable-next-line max-len - 'dark:hover:bg-gray-950 dark:active:bg-gray-900/75 dark:active:text-gray-600', + 'dark:hover:bg-gray-900/75 dark:active:bg-gray-900', active ? 'text-black dark:text-white' - : 'text-gray-300 dark:text-gray-700', + : 'text-gray-400 dark:text-gray-600', + active + ? 'hover:text-black hover:dark:text-white' + : 'hover:text-gray-700 dark:hover:text-gray-400', ); const renderIcon = () => noPadding diff --git a/src/site/IconSearch.tsx b/src/site/IconSearch.tsx index d7ae0ff9..102f672f 100644 --- a/src/site/IconSearch.tsx +++ b/src/site/IconSearch.tsx @@ -19,9 +19,9 @@ export default function IconSearch({ stroke="currentColor" xmlns="http://www.w3.org/2000/svg" > - {includeTitle && Search} - - + {includeTitle && Search ⌘K} + + ); } diff --git a/src/site/ViewSwitcher.tsx b/src/site/ViewSwitcher.tsx index cb91b9c2..a4816c14 100644 --- a/src/site/ViewSwitcher.tsx +++ b/src/site/ViewSwitcher.tsx @@ -40,7 +40,7 @@ export default function ViewSwitcher({ active={currentSelection === 'admin'} />} - + } onClick={() => setIsCommandKOpen?.(true)} From fdd02f1978afb0e9a80e9929d213227b7da63fe2 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 17:27:18 -0600 Subject: [PATCH 06/24] Remove unneeded eslint annotation --- src/components/SwitcherItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/SwitcherItem.tsx b/src/components/SwitcherItem.tsx index 0a91e636..1117e2b4 100644 --- a/src/components/SwitcherItem.tsx +++ b/src/components/SwitcherItem.tsx @@ -21,7 +21,6 @@ export default function SwitcherItem({ 'py-0.5 px-1.5', 'cursor-pointer', 'hover:bg-gray-100/60 active:bg-gray-100', - // eslint-disable-next-line max-len 'dark:hover:bg-gray-900/75 dark:active:bg-gray-900', active ? 'text-black dark:text-white' From 79248a17f299fe7e90098c5a0baf96074f81bbfb Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 18:01:34 -0600 Subject: [PATCH 07/24] Final cmd-k adjustments --- src/components/CommandKClient.tsx | 6 ++++++ src/site/CommandK.tsx | 8 ++++++-- src/site/NavClient.tsx | 2 +- src/site/ViewSwitcher.tsx | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 557f201c..278328aa 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -32,9 +32,11 @@ export type CommandKSection = { export default function CommandKClient({ onQueryChange, sections = [], + footer, }: { onQueryChange?: (query: string) => Promise sections?: CommandKSection[] + footer?: string }) { const { isCommandKOpen: isOpen, @@ -231,6 +233,10 @@ export default function CommandKClient({
)} )} + {footer && !queryLive && +
+ {footer} +
}
diff --git a/src/site/CommandK.tsx b/src/site/CommandK.tsx index 6a091f4c..366ea374 100644 --- a/src/site/CommandK.tsx +++ b/src/site/CommandK.tsx @@ -1,5 +1,6 @@ import CommandKClient, { CommandKSection } from '@/components/CommandKClient'; import { + getPhotosCountCached, getUniqueCamerasCached, getUniqueFilmSimulationsCached, getUniqueTagsCached, @@ -17,7 +18,7 @@ import { import { formatCameraText } from '@/camera'; import { authCached } from '@/auth/cache'; import { getPhotos } from '@/services/vercel-postgres'; -import { titleForPhoto } from '@/photo'; +import { photoQuantityText, titleForPhoto } from '@/photo'; import PhotoTiny from '@/photo/PhotoTiny'; import { formatDate } from '@/utility/date'; import { formatCount, formatCountDescriptive } from '@/utility/string'; @@ -31,10 +32,12 @@ import { HiDocumentText } from 'react-icons/hi'; export default async function CommandK() { const [ + count, tags, cameras, filmSimulations, ] = await Promise.all([ + getPhotosCountCached().catch(() => 0), getUniqueTagsCached().catch(() => []), getUniqueCamerasCached().catch(() => []), getUniqueFilmSimulationsCached().catch(() => []), @@ -119,7 +122,7 @@ export default async function CommandK() { ]} onQueryChange={async (query) => { 'use server'; - const photos = (await getPhotos({ title: query })) + const photos = (await getPhotos({ title: query, limit: 10 })) .filter(({ title }) => Boolean(title)); return photos.length > 0 ? [{ @@ -134,5 +137,6 @@ export default async function CommandK() { }] : []; }} + footer={photoQuantityText(count, false)} />; } diff --git a/src/site/NavClient.tsx b/src/site/NavClient.tsx index 7bc8b208..9ff3f75c 100644 --- a/src/site/NavClient.tsx +++ b/src/site/NavClient.tsx @@ -59,7 +59,7 @@ export default function NavClient({ 'w-full min-h-[4rem]', 'leading-none', )}> -
+
+
} From d77d7ee508efc0443cbd1a57209e076af48ad739 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 18:28:52 -0600 Subject: [PATCH 08/24] Ignore stale requests that come in after cmd-k is closed --- src/components/CommandKClient.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 278328aa..6bee8164 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -1,7 +1,7 @@ 'use client'; import { Command } from 'cmdk'; -import { ReactNode, useEffect, useMemo, useState } from 'react'; +import { ReactNode, useEffect, useMemo, useRef, useState } from 'react'; import Modal from './Modal'; import { clsx } from 'clsx/lite'; import { useDebounce } from 'use-debounce'; @@ -43,6 +43,8 @@ export default function CommandKClient({ setIsCommandKOpen: setIsOpen, } = useAppState(); + const isOpenRef = useRef(isOpen); + // Raw query values const [queryLiveRaw, setQueryLive] = useState(''); const [queryDebouncedRaw] = @@ -62,6 +64,10 @@ export default function CommandKClient({ const router = useRouter(); + useEffect(() => { + isOpenRef.current = isOpen; + }, [isOpen]); + useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === 'k' && (e.metaKey || e.ctrlKey)) { @@ -77,7 +83,12 @@ export default function CommandKClient({ if (queryDebounced.length >= MINIMUM_QUERY_LENGTH) { setIsLoading(true); onQueryChange?.(queryDebounced).then(querySections => { - setQueriedSections(querySections); + if (isOpenRef.current) { + setQueriedSections(querySections); + } else { + // Ignore stale requests that come in after dialog is closed + setQueriedSections([]); + } setIsLoading(false); }); } From f2567d7108139a828fc4f927f646b6e3d8cb4667 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 18:29:42 -0600 Subject: [PATCH 09/24] Bump dependencies --- package.json | 4 +- pnpm-lock.yaml | 112 ++++++++++++++++++++++++++----------------------- 2 files changed, 61 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index eb296c0a..bb682c38 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "@vercel/analytics": "^1.2.2", - "@vercel/blob": "^0.22.0", + "@vercel/blob": "^0.22.1", "@vercel/postgres": "0.7.2", "@vercel/speed-insights": "^1.0.10", "autoprefixer": "10.4.17", @@ -38,7 +38,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.6", - "next": "14.1.1-canary.68", + "next": "14.1.1-canary.69", "next-auth": "5.0.0-beta.9", "next-themes": "^0.2.1", "postcss": "8.4.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6a9a4043..28c0ab60 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,16 +46,16 @@ dependencies: version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.1.1-canary.68)(react@18.2.0) + version: 1.2.2(next@14.1.1-canary.69)(react@18.2.0) '@vercel/blob': - specifier: ^0.22.0 - version: 0.22.0 + specifier: ^0.22.1 + version: 0.22.1 '@vercel/postgres': specifier: 0.7.2 version: 0.7.2 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.1.1-canary.68)(react@18.2.0) + version: 1.0.10(next@14.1.1-canary.69)(react@18.2.0) autoprefixer: specifier: 10.4.17 version: 10.4.17(postcss@8.4.35) @@ -93,14 +93,14 @@ dependencies: specifier: ^5.0.6 version: 5.0.6 next: - specifier: 14.1.1-canary.68 - version: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.1.1-canary.69 + version: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 5.0.0-beta.9 - version: 5.0.0-beta.9(next@14.1.1-canary.68)(react@18.2.0) + version: 5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0) next-themes: specifier: ^0.2.1 - version: 0.2.1(next@14.1.1-canary.68)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0) postcss: specifier: 8.4.35 version: 8.4.35 @@ -1563,8 +1563,8 @@ packages: - utf-8-validate dev: false - /@next/env@14.1.1-canary.68: - resolution: {integrity: sha512-yoicBuz9kJC0jIS7XXU+W8a1a0Tr5sFuBuJO2w5DiYPhNHCQiSZsWgvkXY8ddFjZuxztoWPIvKPJvWzeVh3d2Q==} + /@next/env@14.1.1-canary.69: + resolution: {integrity: sha512-R9JWNDWRKXxjt5DSOiTNOFXnp9TuDv3CaHvXLILiK5s/y0W2v7I2hsza7TKU36R1hWE1wv+hqq/IGMd/U5kM+g==} dev: false /@next/eslint-plugin-next@14.1.0: @@ -1573,8 +1573,8 @@ packages: glob: 10.3.10 dev: false - /@next/swc-darwin-arm64@14.1.1-canary.68: - resolution: {integrity: sha512-L7uuGuuhQlEFioGUj1xNIGyp9RZs0QaVuPS/Y9tiPAlEdIK12HTequRoplI/zD9pGoF6TjnuWu1s81RuBXQM1w==} + /@next/swc-darwin-arm64@14.1.1-canary.69: + resolution: {integrity: sha512-YhNjK/rW+dLNBCQkCTQ/td+CuiC7Cjf7P72FZQLoWf552JxWBDWHCb/AoppeXNHhlCJAR8bEow8UU9WUzXNP0A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1582,8 +1582,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.1.1-canary.68: - resolution: {integrity: sha512-4wc0BgPoGhrdETnscCe4Q2MX+LwRTyn3cZlBUNAFqPll7Q/sW2959HNepPKIOMvkb0gdGqXyYnPhCwIBeW1Z/A==} + /@next/swc-darwin-x64@14.1.1-canary.69: + resolution: {integrity: sha512-tOyHQqsKCYNXqxnQHdR+M13QaDx+/pOgz6//H0JhoVN1/wieWg65Z18ngJfqe1iq9XINjI3XsIPiWaNrPLiNoA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1591,8 +1591,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.1.1-canary.68: - resolution: {integrity: sha512-+c43JmcLmyCVnFBffUrjGQttv0Tc9XM64QJjUnwABqp0Q/k48gnJjGFiUOSnhrj6sHxL4iU9h8W+ti7I0br1aA==} + /@next/swc-linux-arm64-gnu@14.1.1-canary.69: + resolution: {integrity: sha512-tXh5rctbRDBwpRdEwy/8MhVOT/V9YrOuDXjS2Aq38ze0MX11V3qDIfg8yDqHxwrOfpBxaa1n9J6t/WEADErCWw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1600,8 +1600,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.1.1-canary.68: - resolution: {integrity: sha512-1Lsk/mCPKxM8vuqYQKFmCrNoyRwGa08ZVtM/+QHJADIw8DLp70jXTJ9teyJ3TzrEBk1ZfQdloHnUasgG50B/GA==} + /@next/swc-linux-arm64-musl@14.1.1-canary.69: + resolution: {integrity: sha512-vbyyLskTM67Z/YXUtU8Qy7ly1zssvsbEeE2eyfu6zdvFoUeG7InVE1NsnRXU9W7w/ekK9CS44jtGGznsT/Qt9w==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1609,8 +1609,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.1.1-canary.68: - resolution: {integrity: sha512-4XHLafF58VKcKMxoFJR9MqcH4LO1mO1p00CQmSzPB9TkNivFHuIoAsO/5f9rKcCzZMvRf44Akuqne2avfTtE8Q==} + /@next/swc-linux-x64-gnu@14.1.1-canary.69: + resolution: {integrity: sha512-oiK5K6NY3OtxxJXJJykgPDWbuBcgd4HJI3YL8f+UaifiJQSnqqZTzDQvdVS4FY84uES3moH1JjXHJbg9AUN/Qw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1618,8 +1618,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.1.1-canary.68: - resolution: {integrity: sha512-gRve6Sw5SMff1m21PSxbcIUc7FSn3PugubGCDYPSoMi7qdmejOWZopioLupcaAg5qxnB+i/n+C+NP3x5L24sqQ==} + /@next/swc-linux-x64-musl@14.1.1-canary.69: + resolution: {integrity: sha512-nkm36Js4zh4tzVmRxc4jgDGaAYhGqd8DCaih17/hryD9ghxvK5gMWuHgLjCmFf/4K0mVL6CX0quRle0lP9zGZg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1627,8 +1627,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.1.1-canary.68: - resolution: {integrity: sha512-1tIuQfsS7OPWYy535/nnOd5/4wOTsWZoOTZpqKXdTYkroYWw2aN7nCsK11Mwz5XKqyFUSP8jofXg6kj07VhTNQ==} + /@next/swc-win32-arm64-msvc@14.1.1-canary.69: + resolution: {integrity: sha512-UymXQvAYAMqfmrcW/S5SGC0R3aq6m3kLi6R+z5KlYSFBOGa9Or2A4n7/JRbn4GWB86R+PS3NruquAgCtWZU/mQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1636,8 +1636,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.1.1-canary.68: - resolution: {integrity: sha512-wGS8neaZKlsliTGla3AuTFwK16/KqE4TBnxrc8er4T+ZpiBrluVPX6OR7x017cWf1nkruNAAgXyAdCZlPCe8mg==} + /@next/swc-win32-ia32-msvc@14.1.1-canary.69: + resolution: {integrity: sha512-mBO+yc2SqqHiEYinP7vQczgg4L9GPSIpwaKJ9xLPcEtAQ4VlGUIZCFFL+zSN44EZNnCjHMz5MaGuFidLc3j8/w==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1645,8 +1645,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.1.1-canary.68: - resolution: {integrity: sha512-LpMabXAnbJ+/2NBv4HphFfYhvfIFpxTXoLHZ8lI4V15YJ6KlFbBvKYi0LoyL1UEOBywyhgc7zJ9oASlf/ZKgfg==} + /@next/swc-win32-x64-msvc@14.1.1-canary.69: + resolution: {integrity: sha512-kv29K09RRG+OQC+svrWKVWGjTP8JeXnwesymXFI+b2BsTPIXRRv60V0FEINhzj61mTI+Dr7M4qL9lQJ8fkHtrQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -3243,7 +3243,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: false - /@vercel/analytics@1.2.2(next@14.1.1-canary.68)(react@18.2.0): + /@vercel/analytics@1.2.2(next@14.1.1-canary.69)(react@18.2.0): resolution: {integrity: sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==} peerDependencies: next: '>= 13' @@ -3254,18 +3254,19 @@ packages: react: optional: true dependencies: - next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 server-only: 0.0.1 dev: false - /@vercel/blob@0.22.0: - resolution: {integrity: sha512-l0o5bN5ih1H1DG29goULMpCzNIoFI3knFYNFwvGN7iZhK9vltCdlDy77AmrFldRP5af02YczUkjSXWLHMrHStg==} + /@vercel/blob@0.22.1: + resolution: {integrity: sha512-LtHmiYAdJhiSAfBP+5hHXtVyqZUND2G+ild/XVY0SOiB46ab7VUrQctwUMGcVx+yZyXZ2lXPT1HvRJtXFnKvHA==} engines: {node: '>=16.14'} dependencies: async-retry: 1.3.3 bytes: 3.1.2 - undici: 5.28.2 + is-buffer: 2.0.5 + undici: 5.28.3 dev: false /@vercel/postgres@0.7.2: @@ -3278,7 +3279,7 @@ packages: ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) dev: false - /@vercel/speed-insights@1.0.10(next@14.1.1-canary.68)(react@18.2.0): + /@vercel/speed-insights@1.0.10(next@14.1.1-canary.69)(react@18.2.0): resolution: {integrity: sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g==} requiresBuild: true peerDependencies: @@ -3302,7 +3303,7 @@ packages: vue-router: optional: true dependencies: - next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false @@ -5184,6 +5185,11 @@ packages: has-tostringtag: 1.0.2 dev: false + /is-buffer@2.0.5: + resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} + engines: {node: '>=4'} + dev: false + /is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} @@ -6188,7 +6194,7 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: false - /next-auth@5.0.0-beta.9(next@14.1.1-canary.68)(react@18.2.0): + /next-auth@5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0): resolution: {integrity: sha512-BWFiwJ/wzfxWpHnGpAoFsXHSlVofWgFns6tjtIGeDrXfEf3D+afnBpmzCNyek2RNYDVgMHi8Q5uXzFoNBd2l5g==} peerDependencies: '@simplewebauthn/browser': ^9.0.1 @@ -6205,24 +6211,24 @@ packages: optional: true dependencies: '@auth/core': 0.26.3 - next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false - /next-themes@0.2.1(next@14.1.1-canary.68)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@14.1.1-canary.68(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-fYS6LFYwEI3rMzLc/htS3L3z/eTHNiXA33nioXYApShvUUewI3KSRwbpjFOONxW0crux2JZXNrPWEG2N41iHSA==} + /next@14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-9R5upfn+uTNtLTT+OQqQyGPtethX+UV6Xn9mIxhB/h10aBV4DZGKEubJ6mBnyB96OCAA/20G3li1VmxQd7cFOQ==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -6236,7 +6242,7 @@ packages: sass: optional: true dependencies: - '@next/env': 14.1.1-canary.68 + '@next/env': 14.1.1-canary.69 '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001585 @@ -6246,15 +6252,15 @@ packages: react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.1-canary.68 - '@next/swc-darwin-x64': 14.1.1-canary.68 - '@next/swc-linux-arm64-gnu': 14.1.1-canary.68 - '@next/swc-linux-arm64-musl': 14.1.1-canary.68 - '@next/swc-linux-x64-gnu': 14.1.1-canary.68 - '@next/swc-linux-x64-musl': 14.1.1-canary.68 - '@next/swc-win32-arm64-msvc': 14.1.1-canary.68 - '@next/swc-win32-ia32-msvc': 14.1.1-canary.68 - '@next/swc-win32-x64-msvc': 14.1.1-canary.68 + '@next/swc-darwin-arm64': 14.1.1-canary.69 + '@next/swc-darwin-x64': 14.1.1-canary.69 + '@next/swc-linux-arm64-gnu': 14.1.1-canary.69 + '@next/swc-linux-arm64-musl': 14.1.1-canary.69 + '@next/swc-linux-x64-gnu': 14.1.1-canary.69 + '@next/swc-linux-x64-musl': 14.1.1-canary.69 + '@next/swc-win32-arm64-msvc': 14.1.1-canary.69 + '@next/swc-win32-ia32-msvc': 14.1.1-canary.69 + '@next/swc-win32-x64-msvc': 14.1.1-canary.69 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros @@ -7526,8 +7532,8 @@ packages: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: false - /undici@5.28.2: - resolution: {integrity: sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==} + /undici@5.28.3: + resolution: {integrity: sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==} engines: {node: '>=14.0'} dependencies: '@fastify/busboy': 2.1.0 From d51dd06da81a0b0bda5dc86eaee7615e8a74529e Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 18:42:07 -0600 Subject: [PATCH 10/24] Remove signed url generator from edge to reduce bundle size --- src/app/api/storage/presigned-url/[key]/route.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/api/storage/presigned-url/[key]/route.ts b/src/app/api/storage/presigned-url/[key]/route.ts index da506a22..7d01b2af 100644 --- a/src/app/api/storage/presigned-url/[key]/route.ts +++ b/src/app/api/storage/presigned-url/[key]/route.ts @@ -10,8 +10,6 @@ import { import { CURRENT_STORAGE } from '@/site/config'; import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; -export const runtime = 'edge'; - export async function GET( _: Request, { params: { key } }: { params: { key: string } }, From 4bad013c66242c10b0e30fbc80213ac62cc729ad Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 18:47:32 -0600 Subject: [PATCH 11/24] Restore presigned url route to edge runtime --- src/app/api/storage/presigned-url/[key]/route.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/api/storage/presigned-url/[key]/route.ts b/src/app/api/storage/presigned-url/[key]/route.ts index 7d01b2af..da506a22 100644 --- a/src/app/api/storage/presigned-url/[key]/route.ts +++ b/src/app/api/storage/presigned-url/[key]/route.ts @@ -10,6 +10,8 @@ import { import { CURRENT_STORAGE } from '@/site/config'; import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; +export const runtime = 'edge'; + export async function GET( _: Request, { params: { key } }: { params: { key: string } }, From 09058282f588c8147680f9a11bc35bc3e4db262d Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 18:53:34 -0600 Subject: [PATCH 12/24] Revert back to non-canary next --- package.json | 2 +- pnpm-lock.yaml | 103 +++++++++++++++++++++++-------------------------- 2 files changed, 50 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index bb682c38..52d750a1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.6", - "next": "14.1.1-canary.69", + "next": "14.1.0", "next-auth": "5.0.0-beta.9", "next-themes": "^0.2.1", "postcss": "8.4.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28c0ab60..1ce8f7a2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,7 @@ dependencies: version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.1.1-canary.69)(react@18.2.0) + version: 1.2.2(next@14.1.0)(react@18.2.0) '@vercel/blob': specifier: ^0.22.1 version: 0.22.1 @@ -55,7 +55,7 @@ dependencies: version: 0.7.2 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.1.1-canary.69)(react@18.2.0) + version: 1.0.10(next@14.1.0)(react@18.2.0) autoprefixer: specifier: 10.4.17 version: 10.4.17(postcss@8.4.35) @@ -93,14 +93,14 @@ dependencies: specifier: ^5.0.6 version: 5.0.6 next: - specifier: 14.1.1-canary.69 - version: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.1.0 + version: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 5.0.0-beta.9 - version: 5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0) + version: 5.0.0-beta.9(next@14.1.0)(react@18.2.0) next-themes: specifier: ^0.2.1 - version: 0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0) postcss: specifier: 8.4.35 version: 8.4.35 @@ -1563,8 +1563,8 @@ packages: - utf-8-validate dev: false - /@next/env@14.1.1-canary.69: - resolution: {integrity: sha512-R9JWNDWRKXxjt5DSOiTNOFXnp9TuDv3CaHvXLILiK5s/y0W2v7I2hsza7TKU36R1hWE1wv+hqq/IGMd/U5kM+g==} + /@next/env@14.1.0: + resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==} dev: false /@next/eslint-plugin-next@14.1.0: @@ -1573,8 +1573,8 @@ packages: glob: 10.3.10 dev: false - /@next/swc-darwin-arm64@14.1.1-canary.69: - resolution: {integrity: sha512-YhNjK/rW+dLNBCQkCTQ/td+CuiC7Cjf7P72FZQLoWf552JxWBDWHCb/AoppeXNHhlCJAR8bEow8UU9WUzXNP0A==} + /@next/swc-darwin-arm64@14.1.0: + resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1582,8 +1582,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.1.1-canary.69: - resolution: {integrity: sha512-tOyHQqsKCYNXqxnQHdR+M13QaDx+/pOgz6//H0JhoVN1/wieWg65Z18ngJfqe1iq9XINjI3XsIPiWaNrPLiNoA==} + /@next/swc-darwin-x64@14.1.0: + resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1591,8 +1591,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.1.1-canary.69: - resolution: {integrity: sha512-tXh5rctbRDBwpRdEwy/8MhVOT/V9YrOuDXjS2Aq38ze0MX11V3qDIfg8yDqHxwrOfpBxaa1n9J6t/WEADErCWw==} + /@next/swc-linux-arm64-gnu@14.1.0: + resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1600,8 +1600,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.1.1-canary.69: - resolution: {integrity: sha512-vbyyLskTM67Z/YXUtU8Qy7ly1zssvsbEeE2eyfu6zdvFoUeG7InVE1NsnRXU9W7w/ekK9CS44jtGGznsT/Qt9w==} + /@next/swc-linux-arm64-musl@14.1.0: + resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1609,8 +1609,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.1.1-canary.69: - resolution: {integrity: sha512-oiK5K6NY3OtxxJXJJykgPDWbuBcgd4HJI3YL8f+UaifiJQSnqqZTzDQvdVS4FY84uES3moH1JjXHJbg9AUN/Qw==} + /@next/swc-linux-x64-gnu@14.1.0: + resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1618,8 +1618,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.1.1-canary.69: - resolution: {integrity: sha512-nkm36Js4zh4tzVmRxc4jgDGaAYhGqd8DCaih17/hryD9ghxvK5gMWuHgLjCmFf/4K0mVL6CX0quRle0lP9zGZg==} + /@next/swc-linux-x64-musl@14.1.0: + resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1627,8 +1627,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.1.1-canary.69: - resolution: {integrity: sha512-UymXQvAYAMqfmrcW/S5SGC0R3aq6m3kLi6R+z5KlYSFBOGa9Or2A4n7/JRbn4GWB86R+PS3NruquAgCtWZU/mQ==} + /@next/swc-win32-arm64-msvc@14.1.0: + resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1636,8 +1636,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.1.1-canary.69: - resolution: {integrity: sha512-mBO+yc2SqqHiEYinP7vQczgg4L9GPSIpwaKJ9xLPcEtAQ4VlGUIZCFFL+zSN44EZNnCjHMz5MaGuFidLc3j8/w==} + /@next/swc-win32-ia32-msvc@14.1.0: + resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1645,8 +1645,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.1.1-canary.69: - resolution: {integrity: sha512-kv29K09RRG+OQC+svrWKVWGjTP8JeXnwesymXFI+b2BsTPIXRRv60V0FEINhzj61mTI+Dr7M4qL9lQJ8fkHtrQ==} + /@next/swc-win32-x64-msvc@14.1.0: + resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2817,14 +2817,9 @@ packages: tslib: 2.6.2 dev: false - /@swc/counter@0.1.3: - resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} - dev: false - - /@swc/helpers@0.5.5: - resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} + /@swc/helpers@0.5.2: + resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} dependencies: - '@swc/counter': 0.1.3 tslib: 2.6.2 dev: false @@ -3243,7 +3238,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: false - /@vercel/analytics@1.2.2(next@14.1.1-canary.69)(react@18.2.0): + /@vercel/analytics@1.2.2(next@14.1.0)(react@18.2.0): resolution: {integrity: sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==} peerDependencies: next: '>= 13' @@ -3254,7 +3249,7 @@ packages: react: optional: true dependencies: - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 server-only: 0.0.1 dev: false @@ -3279,7 +3274,7 @@ packages: ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) dev: false - /@vercel/speed-insights@1.0.10(next@14.1.1-canary.69)(react@18.2.0): + /@vercel/speed-insights@1.0.10(next@14.1.0)(react@18.2.0): resolution: {integrity: sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g==} requiresBuild: true peerDependencies: @@ -3303,7 +3298,7 @@ packages: vue-router: optional: true dependencies: - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false @@ -6194,7 +6189,7 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: false - /next-auth@5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0): + /next-auth@5.0.0-beta.9(next@14.1.0)(react@18.2.0): resolution: {integrity: sha512-BWFiwJ/wzfxWpHnGpAoFsXHSlVofWgFns6tjtIGeDrXfEf3D+afnBpmzCNyek2RNYDVgMHi8Q5uXzFoNBd2l5g==} peerDependencies: '@simplewebauthn/browser': ^9.0.1 @@ -6211,24 +6206,24 @@ packages: optional: true dependencies: '@auth/core': 0.26.3 - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false - /next-themes@0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-9R5upfn+uTNtLTT+OQqQyGPtethX+UV6Xn9mIxhB/h10aBV4DZGKEubJ6mBnyB96OCAA/20G3li1VmxQd7cFOQ==} + /next@14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -6242,8 +6237,8 @@ packages: sass: optional: true dependencies: - '@next/env': 14.1.1-canary.69 - '@swc/helpers': 0.5.5 + '@next/env': 14.1.0 + '@swc/helpers': 0.5.2 busboy: 1.6.0 caniuse-lite: 1.0.30001585 graceful-fs: 4.2.11 @@ -6252,15 +6247,15 @@ packages: react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.1-canary.69 - '@next/swc-darwin-x64': 14.1.1-canary.69 - '@next/swc-linux-arm64-gnu': 14.1.1-canary.69 - '@next/swc-linux-arm64-musl': 14.1.1-canary.69 - '@next/swc-linux-x64-gnu': 14.1.1-canary.69 - '@next/swc-linux-x64-musl': 14.1.1-canary.69 - '@next/swc-win32-arm64-msvc': 14.1.1-canary.69 - '@next/swc-win32-ia32-msvc': 14.1.1-canary.69 - '@next/swc-win32-x64-msvc': 14.1.1-canary.69 + '@next/swc-darwin-arm64': 14.1.0 + '@next/swc-darwin-x64': 14.1.0 + '@next/swc-linux-arm64-gnu': 14.1.0 + '@next/swc-linux-arm64-musl': 14.1.0 + '@next/swc-linux-x64-gnu': 14.1.0 + '@next/swc-linux-x64-musl': 14.1.0 + '@next/swc-win32-arm64-msvc': 14.1.0 + '@next/swc-win32-ia32-msvc': 14.1.0 + '@next/swc-win32-x64-msvc': 14.1.0 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros From 99a6974dd611955919b7e511979b3c709bba4697 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 19:15:55 -0600 Subject: [PATCH 13/24] Attempt to shrink [shot-on] edge function size --- package.json | 2 +- pnpm-lock.yaml | 103 +++++++++++++++++++++++--------------------- src/camera/index.ts | 2 +- 3 files changed, 56 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index 52d750a1..bb682c38 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.6", - "next": "14.1.0", + "next": "14.1.1-canary.69", "next-auth": "5.0.0-beta.9", "next-themes": "^0.2.1", "postcss": "8.4.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ce8f7a2..28c0ab60 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,7 @@ dependencies: version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.1.0)(react@18.2.0) + version: 1.2.2(next@14.1.1-canary.69)(react@18.2.0) '@vercel/blob': specifier: ^0.22.1 version: 0.22.1 @@ -55,7 +55,7 @@ dependencies: version: 0.7.2 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.1.0)(react@18.2.0) + version: 1.0.10(next@14.1.1-canary.69)(react@18.2.0) autoprefixer: specifier: 10.4.17 version: 10.4.17(postcss@8.4.35) @@ -93,14 +93,14 @@ dependencies: specifier: ^5.0.6 version: 5.0.6 next: - specifier: 14.1.0 - version: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.1.1-canary.69 + version: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 5.0.0-beta.9 - version: 5.0.0-beta.9(next@14.1.0)(react@18.2.0) + version: 5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0) next-themes: specifier: ^0.2.1 - version: 0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0) postcss: specifier: 8.4.35 version: 8.4.35 @@ -1563,8 +1563,8 @@ packages: - utf-8-validate dev: false - /@next/env@14.1.0: - resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==} + /@next/env@14.1.1-canary.69: + resolution: {integrity: sha512-R9JWNDWRKXxjt5DSOiTNOFXnp9TuDv3CaHvXLILiK5s/y0W2v7I2hsza7TKU36R1hWE1wv+hqq/IGMd/U5kM+g==} dev: false /@next/eslint-plugin-next@14.1.0: @@ -1573,8 +1573,8 @@ packages: glob: 10.3.10 dev: false - /@next/swc-darwin-arm64@14.1.0: - resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==} + /@next/swc-darwin-arm64@14.1.1-canary.69: + resolution: {integrity: sha512-YhNjK/rW+dLNBCQkCTQ/td+CuiC7Cjf7P72FZQLoWf552JxWBDWHCb/AoppeXNHhlCJAR8bEow8UU9WUzXNP0A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1582,8 +1582,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.1.0: - resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==} + /@next/swc-darwin-x64@14.1.1-canary.69: + resolution: {integrity: sha512-tOyHQqsKCYNXqxnQHdR+M13QaDx+/pOgz6//H0JhoVN1/wieWg65Z18ngJfqe1iq9XINjI3XsIPiWaNrPLiNoA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1591,8 +1591,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.1.0: - resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==} + /@next/swc-linux-arm64-gnu@14.1.1-canary.69: + resolution: {integrity: sha512-tXh5rctbRDBwpRdEwy/8MhVOT/V9YrOuDXjS2Aq38ze0MX11V3qDIfg8yDqHxwrOfpBxaa1n9J6t/WEADErCWw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1600,8 +1600,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.1.0: - resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==} + /@next/swc-linux-arm64-musl@14.1.1-canary.69: + resolution: {integrity: sha512-vbyyLskTM67Z/YXUtU8Qy7ly1zssvsbEeE2eyfu6zdvFoUeG7InVE1NsnRXU9W7w/ekK9CS44jtGGznsT/Qt9w==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1609,8 +1609,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.1.0: - resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==} + /@next/swc-linux-x64-gnu@14.1.1-canary.69: + resolution: {integrity: sha512-oiK5K6NY3OtxxJXJJykgPDWbuBcgd4HJI3YL8f+UaifiJQSnqqZTzDQvdVS4FY84uES3moH1JjXHJbg9AUN/Qw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1618,8 +1618,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.1.0: - resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==} + /@next/swc-linux-x64-musl@14.1.1-canary.69: + resolution: {integrity: sha512-nkm36Js4zh4tzVmRxc4jgDGaAYhGqd8DCaih17/hryD9ghxvK5gMWuHgLjCmFf/4K0mVL6CX0quRle0lP9zGZg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1627,8 +1627,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.1.0: - resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==} + /@next/swc-win32-arm64-msvc@14.1.1-canary.69: + resolution: {integrity: sha512-UymXQvAYAMqfmrcW/S5SGC0R3aq6m3kLi6R+z5KlYSFBOGa9Or2A4n7/JRbn4GWB86R+PS3NruquAgCtWZU/mQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1636,8 +1636,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.1.0: - resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==} + /@next/swc-win32-ia32-msvc@14.1.1-canary.69: + resolution: {integrity: sha512-mBO+yc2SqqHiEYinP7vQczgg4L9GPSIpwaKJ9xLPcEtAQ4VlGUIZCFFL+zSN44EZNnCjHMz5MaGuFidLc3j8/w==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1645,8 +1645,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.1.0: - resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==} + /@next/swc-win32-x64-msvc@14.1.1-canary.69: + resolution: {integrity: sha512-kv29K09RRG+OQC+svrWKVWGjTP8JeXnwesymXFI+b2BsTPIXRRv60V0FEINhzj61mTI+Dr7M4qL9lQJ8fkHtrQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2817,9 +2817,14 @@ packages: tslib: 2.6.2 dev: false - /@swc/helpers@0.5.2: - resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} + /@swc/counter@0.1.3: + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + dev: false + + /@swc/helpers@0.5.5: + resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} dependencies: + '@swc/counter': 0.1.3 tslib: 2.6.2 dev: false @@ -3238,7 +3243,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: false - /@vercel/analytics@1.2.2(next@14.1.0)(react@18.2.0): + /@vercel/analytics@1.2.2(next@14.1.1-canary.69)(react@18.2.0): resolution: {integrity: sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==} peerDependencies: next: '>= 13' @@ -3249,7 +3254,7 @@ packages: react: optional: true dependencies: - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 server-only: 0.0.1 dev: false @@ -3274,7 +3279,7 @@ packages: ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) dev: false - /@vercel/speed-insights@1.0.10(next@14.1.0)(react@18.2.0): + /@vercel/speed-insights@1.0.10(next@14.1.1-canary.69)(react@18.2.0): resolution: {integrity: sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g==} requiresBuild: true peerDependencies: @@ -3298,7 +3303,7 @@ packages: vue-router: optional: true dependencies: - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false @@ -6189,7 +6194,7 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: false - /next-auth@5.0.0-beta.9(next@14.1.0)(react@18.2.0): + /next-auth@5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0): resolution: {integrity: sha512-BWFiwJ/wzfxWpHnGpAoFsXHSlVofWgFns6tjtIGeDrXfEf3D+afnBpmzCNyek2RNYDVgMHi8Q5uXzFoNBd2l5g==} peerDependencies: '@simplewebauthn/browser': ^9.0.1 @@ -6206,24 +6211,24 @@ packages: optional: true dependencies: '@auth/core': 0.26.3 - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false - /next-themes@0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==} + /next@14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-9R5upfn+uTNtLTT+OQqQyGPtethX+UV6Xn9mIxhB/h10aBV4DZGKEubJ6mBnyB96OCAA/20G3li1VmxQd7cFOQ==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -6237,8 +6242,8 @@ packages: sass: optional: true dependencies: - '@next/env': 14.1.0 - '@swc/helpers': 0.5.2 + '@next/env': 14.1.1-canary.69 + '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001585 graceful-fs: 4.2.11 @@ -6247,15 +6252,15 @@ packages: react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.0 - '@next/swc-darwin-x64': 14.1.0 - '@next/swc-linux-arm64-gnu': 14.1.0 - '@next/swc-linux-arm64-musl': 14.1.0 - '@next/swc-linux-x64-gnu': 14.1.0 - '@next/swc-linux-x64-musl': 14.1.0 - '@next/swc-win32-arm64-msvc': 14.1.0 - '@next/swc-win32-ia32-msvc': 14.1.0 - '@next/swc-win32-x64-msvc': 14.1.0 + '@next/swc-darwin-arm64': 14.1.1-canary.69 + '@next/swc-darwin-x64': 14.1.1-canary.69 + '@next/swc-linux-arm64-gnu': 14.1.1-canary.69 + '@next/swc-linux-arm64-musl': 14.1.1-canary.69 + '@next/swc-linux-x64-gnu': 14.1.1-canary.69 + '@next/swc-linux-x64-musl': 14.1.1-canary.69 + '@next/swc-win32-arm64-msvc': 14.1.1-canary.69 + '@next/swc-win32-ia32-msvc': 14.1.1-canary.69 + '@next/swc-win32-x64-msvc': 14.1.1-canary.69 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros diff --git a/src/camera/index.ts b/src/camera/index.ts index 555f73b1..c89b4673 100644 --- a/src/camera/index.ts +++ b/src/camera/index.ts @@ -1,4 +1,4 @@ -import { Photo } from '@/photo'; +import type { Photo } from '@/photo'; import { parameterize } from '@/utility/string'; const CAMERA_PLACEHOLDER: Camera = { make: 'Camera', model: 'Model' }; From 77037a1d80f0a2d210965157cb9c517f109f4730 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 19:22:23 -0600 Subject: [PATCH 14/24] Optimize [tag]/image edge function size --- src/image-response/TagImageResponse.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/image-response/TagImageResponse.tsx b/src/image-response/TagImageResponse.tsx index bae151e2..d7a7f0e5 100644 --- a/src/image-response/TagImageResponse.tsx +++ b/src/image-response/TagImageResponse.tsx @@ -1,9 +1,9 @@ -import { Photo } from '../photo'; +import type { Photo } from '../photo'; import { FaStar, FaTag } from 'react-icons/fa'; import ImageCaption from './components/ImageCaption'; import ImagePhotoGrid from './components/ImagePhotoGrid'; import ImageContainer from './components/ImageContainer'; -import { NextImageSize } from '@/services/next-image'; +import type { NextImageSize } from '@/services/next-image'; import { isTagFavs } from '@/tag'; export default function TagImageResponse({ From 178888384d6d033f80cc6f854ec49d0685101a6b Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 19:37:46 -0600 Subject: [PATCH 15/24] Remove edge runtime from [shot-on] endpoint --- src/app/shot-on/[camera]/image/route.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/shot-on/[camera]/image/route.tsx b/src/app/shot-on/[camera]/image/route.tsx index 209454e0..cc40ed2a 100644 --- a/src/app/shot-on/[camera]/image/route.tsx +++ b/src/app/shot-on/[camera]/image/route.tsx @@ -9,8 +9,6 @@ import { getIBMPlexMonoMedium } from '@/site/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; -export const runtime = 'edge'; - export async function GET( _: Request, context: { params: { camera: string } }, From 293a612d96e631fe20fdf79e8ef513a1dca8226c Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 19:50:53 -0600 Subject: [PATCH 16/24] Move [shot-on] image back to edge runtime --- src/app/shot-on/[camera]/image/route.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/shot-on/[camera]/image/route.tsx b/src/app/shot-on/[camera]/image/route.tsx index cc40ed2a..209454e0 100644 --- a/src/app/shot-on/[camera]/image/route.tsx +++ b/src/app/shot-on/[camera]/image/route.tsx @@ -9,6 +9,8 @@ import { getIBMPlexMonoMedium } from '@/site/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; +export const runtime = 'edge'; + export async function GET( _: Request, context: { params: { camera: string } }, From e054019cd0d20eb7bbf25840f4f24bed3973730a Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 19:51:24 -0600 Subject: [PATCH 17/24] Revert back to Next.js 14.1.0 --- package.json | 2 +- pnpm-lock.yaml | 103 +++++++++++++++++++++++-------------------------- 2 files changed, 50 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index bb682c38..52d750a1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.6", - "next": "14.1.1-canary.69", + "next": "14.1.0", "next-auth": "5.0.0-beta.9", "next-themes": "^0.2.1", "postcss": "8.4.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28c0ab60..1ce8f7a2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,7 @@ dependencies: version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.1.1-canary.69)(react@18.2.0) + version: 1.2.2(next@14.1.0)(react@18.2.0) '@vercel/blob': specifier: ^0.22.1 version: 0.22.1 @@ -55,7 +55,7 @@ dependencies: version: 0.7.2 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.1.1-canary.69)(react@18.2.0) + version: 1.0.10(next@14.1.0)(react@18.2.0) autoprefixer: specifier: 10.4.17 version: 10.4.17(postcss@8.4.35) @@ -93,14 +93,14 @@ dependencies: specifier: ^5.0.6 version: 5.0.6 next: - specifier: 14.1.1-canary.69 - version: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + specifier: 14.1.0 + version: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 5.0.0-beta.9 - version: 5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0) + version: 5.0.0-beta.9(next@14.1.0)(react@18.2.0) next-themes: specifier: ^0.2.1 - version: 0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0) postcss: specifier: 8.4.35 version: 8.4.35 @@ -1563,8 +1563,8 @@ packages: - utf-8-validate dev: false - /@next/env@14.1.1-canary.69: - resolution: {integrity: sha512-R9JWNDWRKXxjt5DSOiTNOFXnp9TuDv3CaHvXLILiK5s/y0W2v7I2hsza7TKU36R1hWE1wv+hqq/IGMd/U5kM+g==} + /@next/env@14.1.0: + resolution: {integrity: sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==} dev: false /@next/eslint-plugin-next@14.1.0: @@ -1573,8 +1573,8 @@ packages: glob: 10.3.10 dev: false - /@next/swc-darwin-arm64@14.1.1-canary.69: - resolution: {integrity: sha512-YhNjK/rW+dLNBCQkCTQ/td+CuiC7Cjf7P72FZQLoWf552JxWBDWHCb/AoppeXNHhlCJAR8bEow8UU9WUzXNP0A==} + /@next/swc-darwin-arm64@14.1.0: + resolution: {integrity: sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1582,8 +1582,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@14.1.1-canary.69: - resolution: {integrity: sha512-tOyHQqsKCYNXqxnQHdR+M13QaDx+/pOgz6//H0JhoVN1/wieWg65Z18ngJfqe1iq9XINjI3XsIPiWaNrPLiNoA==} + /@next/swc-darwin-x64@14.1.0: + resolution: {integrity: sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1591,8 +1591,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@14.1.1-canary.69: - resolution: {integrity: sha512-tXh5rctbRDBwpRdEwy/8MhVOT/V9YrOuDXjS2Aq38ze0MX11V3qDIfg8yDqHxwrOfpBxaa1n9J6t/WEADErCWw==} + /@next/swc-linux-arm64-gnu@14.1.0: + resolution: {integrity: sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1600,8 +1600,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@14.1.1-canary.69: - resolution: {integrity: sha512-vbyyLskTM67Z/YXUtU8Qy7ly1zssvsbEeE2eyfu6zdvFoUeG7InVE1NsnRXU9W7w/ekK9CS44jtGGznsT/Qt9w==} + /@next/swc-linux-arm64-musl@14.1.0: + resolution: {integrity: sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1609,8 +1609,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@14.1.1-canary.69: - resolution: {integrity: sha512-oiK5K6NY3OtxxJXJJykgPDWbuBcgd4HJI3YL8f+UaifiJQSnqqZTzDQvdVS4FY84uES3moH1JjXHJbg9AUN/Qw==} + /@next/swc-linux-x64-gnu@14.1.0: + resolution: {integrity: sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1618,8 +1618,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@14.1.1-canary.69: - resolution: {integrity: sha512-nkm36Js4zh4tzVmRxc4jgDGaAYhGqd8DCaih17/hryD9ghxvK5gMWuHgLjCmFf/4K0mVL6CX0quRle0lP9zGZg==} + /@next/swc-linux-x64-musl@14.1.0: + resolution: {integrity: sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1627,8 +1627,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@14.1.1-canary.69: - resolution: {integrity: sha512-UymXQvAYAMqfmrcW/S5SGC0R3aq6m3kLi6R+z5KlYSFBOGa9Or2A4n7/JRbn4GWB86R+PS3NruquAgCtWZU/mQ==} + /@next/swc-win32-arm64-msvc@14.1.0: + resolution: {integrity: sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1636,8 +1636,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@14.1.1-canary.69: - resolution: {integrity: sha512-mBO+yc2SqqHiEYinP7vQczgg4L9GPSIpwaKJ9xLPcEtAQ4VlGUIZCFFL+zSN44EZNnCjHMz5MaGuFidLc3j8/w==} + /@next/swc-win32-ia32-msvc@14.1.0: + resolution: {integrity: sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1645,8 +1645,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@14.1.1-canary.69: - resolution: {integrity: sha512-kv29K09RRG+OQC+svrWKVWGjTP8JeXnwesymXFI+b2BsTPIXRRv60V0FEINhzj61mTI+Dr7M4qL9lQJ8fkHtrQ==} + /@next/swc-win32-x64-msvc@14.1.0: + resolution: {integrity: sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2817,14 +2817,9 @@ packages: tslib: 2.6.2 dev: false - /@swc/counter@0.1.3: - resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} - dev: false - - /@swc/helpers@0.5.5: - resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} + /@swc/helpers@0.5.2: + resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} dependencies: - '@swc/counter': 0.1.3 tslib: 2.6.2 dev: false @@ -3243,7 +3238,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: false - /@vercel/analytics@1.2.2(next@14.1.1-canary.69)(react@18.2.0): + /@vercel/analytics@1.2.2(next@14.1.0)(react@18.2.0): resolution: {integrity: sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==} peerDependencies: next: '>= 13' @@ -3254,7 +3249,7 @@ packages: react: optional: true dependencies: - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 server-only: 0.0.1 dev: false @@ -3279,7 +3274,7 @@ packages: ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) dev: false - /@vercel/speed-insights@1.0.10(next@14.1.1-canary.69)(react@18.2.0): + /@vercel/speed-insights@1.0.10(next@14.1.0)(react@18.2.0): resolution: {integrity: sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g==} requiresBuild: true peerDependencies: @@ -3303,7 +3298,7 @@ packages: vue-router: optional: true dependencies: - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false @@ -6194,7 +6189,7 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: false - /next-auth@5.0.0-beta.9(next@14.1.1-canary.69)(react@18.2.0): + /next-auth@5.0.0-beta.9(next@14.1.0)(react@18.2.0): resolution: {integrity: sha512-BWFiwJ/wzfxWpHnGpAoFsXHSlVofWgFns6tjtIGeDrXfEf3D+afnBpmzCNyek2RNYDVgMHi8Q5uXzFoNBd2l5g==} peerDependencies: '@simplewebauthn/browser': ^9.0.1 @@ -6211,24 +6206,24 @@ packages: optional: true dependencies: '@auth/core': 0.26.3 - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: false - /next-themes@0.2.1(next@14.1.1-canary.69)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@14.1.1-canary.69(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-9R5upfn+uTNtLTT+OQqQyGPtethX+UV6Xn9mIxhB/h10aBV4DZGKEubJ6mBnyB96OCAA/20G3li1VmxQd7cFOQ==} + /next@14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -6242,8 +6237,8 @@ packages: sass: optional: true dependencies: - '@next/env': 14.1.1-canary.69 - '@swc/helpers': 0.5.5 + '@next/env': 14.1.0 + '@swc/helpers': 0.5.2 busboy: 1.6.0 caniuse-lite: 1.0.30001585 graceful-fs: 4.2.11 @@ -6252,15 +6247,15 @@ packages: react-dom: 18.2.0(react@18.2.0) styled-jsx: 5.1.1(@babel/core@7.23.9)(react@18.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 14.1.1-canary.69 - '@next/swc-darwin-x64': 14.1.1-canary.69 - '@next/swc-linux-arm64-gnu': 14.1.1-canary.69 - '@next/swc-linux-arm64-musl': 14.1.1-canary.69 - '@next/swc-linux-x64-gnu': 14.1.1-canary.69 - '@next/swc-linux-x64-musl': 14.1.1-canary.69 - '@next/swc-win32-arm64-msvc': 14.1.1-canary.69 - '@next/swc-win32-ia32-msvc': 14.1.1-canary.69 - '@next/swc-win32-x64-msvc': 14.1.1-canary.69 + '@next/swc-darwin-arm64': 14.1.0 + '@next/swc-darwin-x64': 14.1.0 + '@next/swc-linux-arm64-gnu': 14.1.0 + '@next/swc-linux-arm64-musl': 14.1.0 + '@next/swc-linux-x64-gnu': 14.1.0 + '@next/swc-linux-x64-musl': 14.1.0 + '@next/swc-win32-arm64-msvc': 14.1.0 + '@next/swc-win32-ia32-msvc': 14.1.0 + '@next/swc-win32-x64-msvc': 14.1.0 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros From cfa152937cd5dd8ec6216501eabf55eafabb5aa2 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 20:08:13 -0600 Subject: [PATCH 18/24] Fix image grid crop on Safari --- src/photo/PhotoGrid.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/photo/PhotoGrid.tsx b/src/photo/PhotoGrid.tsx index 6e540bf8..fefb0b4e 100644 --- a/src/photo/PhotoGrid.tsx +++ b/src/photo/PhotoGrid.tsx @@ -60,7 +60,7 @@ export default function PhotoGrid({ 'aspect-square', 'overflow-hidden', '[&>*]:flex [&>*]:w-full [&>*]:h-full', - '[&>*>*]:object-cover', + '[&>*>*]:object-cover [&>*>*]:min-h-full', ) : undefined} style={{ From 551b4d4ec3c637cb87738b66b44e293e2d1253dc Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 20:44:00 -0600 Subject: [PATCH 19/24] Remove cmdk query parameterization --- src/components/CommandKClient.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index 6bee8164..bc57c87c 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -11,7 +11,6 @@ import { useTheme } from 'next-themes'; import { BiDesktop, BiMoon, BiSun } from 'react-icons/bi'; import { IoInvertModeSharp } from 'react-icons/io5'; import { useAppState } from '@/state'; -import { parameterize } from '@/utility/string'; const LISTENER_KEYDOWN = 'keydown'; const MINIMUM_QUERY_LENGTH = 2; @@ -53,9 +52,9 @@ export default function CommandKClient({ // Parameterized query values const queryLive = useMemo(() => - parameterize(queryLiveRaw), [queryLiveRaw]); + queryLiveRaw.trim().toLocaleLowerCase(), [queryLiveRaw]); const queryDebounced = useMemo(() => - parameterize(queryDebouncedRaw), [queryDebouncedRaw]); + queryDebouncedRaw.trim().toLocaleLowerCase(), [queryDebouncedRaw]); const [isLoading, setIsLoading] = useState(false); const [queriedSections, setQueriedSections] = useState([]); From 92d13d586c471151a77cfbcb60ed28b28a0df28b Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 21 Feb 2024 23:13:39 -0600 Subject: [PATCH 20/24] Prevent timestamps being overwritten when syncing EXIF --- src/photo/form/index.ts | 20 +++++++++++--------- src/photo/index.ts | 6 ++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/photo/form/index.ts b/src/photo/form/index.ts index d2ba6a85..c1404a4a 100644 --- a/src/photo/form/index.ts +++ b/src/photo/form/index.ts @@ -155,7 +155,10 @@ export const convertPhotoToFormData = ( export const convertExifToFormData = ( data: ExifData, filmSimulation?: FilmSimulation, -): Record => ({ +): Omit< + Record, + 'takenAt' | 'takenAtNaive' +> => ({ aspectRatio: getAspectRatioFromExif(data).toString(), make: data.tags?.Make, model: data.tags?.Model, @@ -170,15 +173,14 @@ export const convertExifToFormData = ( longitude: !GEO_PRIVACY_ENABLED ? data.tags?.GPSLongitude?.toString() : undefined, filmSimulation, - takenAt: data.tags?.DateTimeOriginal - ? convertTimestampWithOffsetToPostgresString( - data.tags?.DateTimeOriginal, + ...data.tags?.DateTimeOriginal && { + takenAt: convertTimestampWithOffsetToPostgresString( + data.tags.DateTimeOriginal, getOffsetFromExif(data), - ) - : undefined, - takenAtNaive: data.tags?.DateTimeOriginal - ? convertTimestampToNaivePostgresString(data.tags?.DateTimeOriginal) - : undefined, + ), + takenAtNaive: + convertTimestampToNaivePostgresString(data.tags.DateTimeOriginal), + }, }); // PREPARE FORM FOR DB INSERT diff --git a/src/photo/index.ts b/src/photo/index.ts index 108f6512..05608c81 100644 --- a/src/photo/index.ts +++ b/src/photo/index.ts @@ -36,8 +36,8 @@ export interface PhotoExif { latitude?: number longitude?: number filmSimulation?: FilmSimulation - takenAt: string - takenAtNaive: string + takenAt?: string + takenAtNaive?: string } // Raw db insert @@ -51,6 +51,8 @@ export interface PhotoDbInsert extends PhotoExif { locationName?: string priorityOrder?: number hidden?: boolean + takenAt: string + takenAtNaive: string } // Raw db response From 272c097c31436449c01cf5c081673aa4064d53a5 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 22 Feb 2024 09:12:39 -0600 Subject: [PATCH 21/24] Extract theme color logic to custom hook --- src/components/Modal.tsx | 17 +++-------------- src/site/useMetaThemeColor.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 src/site/useMetaThemeColor.ts diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index 6c35b83b..ac0f7526 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -1,6 +1,6 @@ 'use client'; -import { ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react'; +import { ReactNode, useEffect, useRef, useState } from 'react'; import { motion } from 'framer-motion'; import { clsx } from 'clsx/lite'; import useClickInsideOutside from '@/utility/useClickInsideOutside'; @@ -8,7 +8,7 @@ import { useRouter } from 'next/navigation'; import AnimateItems from './AnimateItems'; import { PATH_ROOT } from '@/site/paths'; import usePrefersReducedMotion from '@/utility/usePrefersReducedMotion'; -import { useTheme } from 'next-themes'; +import useMetaThemeColor from '@/site/useMetaThemeColor'; export default function Modal({ onClosePath, @@ -39,18 +39,7 @@ export default function Modal({ } }, []); - const { resolvedTheme } = useTheme(); - useLayoutEffect(() => { - if (resolvedTheme === 'light') { - // Temporarily create meta tag for overlays in light mode, - // which prevents stale headers on theme changes - const meta = document.createElement('meta'); - meta.name = 'theme-color'; - meta.content = '#333'; - document.getElementsByTagName('head')[0]?.appendChild(meta); - return () => meta.remove(); - } - }, [resolvedTheme]); + useMetaThemeColor({ colorLight: '#333' }); useClickInsideOutside({ htmlElements, diff --git a/src/site/useMetaThemeColor.ts b/src/site/useMetaThemeColor.ts new file mode 100644 index 00000000..c2e4b34a --- /dev/null +++ b/src/site/useMetaThemeColor.ts @@ -0,0 +1,28 @@ +import { useTheme } from 'next-themes'; +import { useEffect } from 'react'; + +export default function useMetaThemeColor({ + colorLight, + colorDark, +}: { + colorLight?: string + colorDark?: string +}) { + const { resolvedTheme } = useTheme(); + + const preferredThemeColor = resolvedTheme === 'light' + ? colorLight + : colorDark; + + useEffect(() => { + if (preferredThemeColor) { + // Temporarily create meta tag for overlays, + // which prevents stale headers on theme changes + const meta = document.createElement('meta'); + meta.name = 'theme-color'; + meta.content = preferredThemeColor; + document.getElementsByTagName('head')[0]?.appendChild(meta); + return () => meta.remove(); + } + }, [preferredThemeColor]); +} From ebbdff4a5a3e436c1b1e4d17258cc38f62f8b7c2 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 22 Feb 2024 09:29:49 -0600 Subject: [PATCH 22/24] Animate PREV/NEXT links --- src/photo/PhotoDetailPage.tsx | 37 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/photo/PhotoDetailPage.tsx b/src/photo/PhotoDetailPage.tsx index 6bde1144..ac4e4c3f 100644 --- a/src/photo/PhotoDetailPage.tsx +++ b/src/photo/PhotoDetailPage.tsx @@ -95,20 +95,29 @@ export default function PhotoDetailPage({ tag={tag} animateOnFirstLoadOnly />} - contentSide={
- -
} + contentSide={ + +
, + ]} + />} />
); From 68775381d150abd88b26ba00ba7d1573b5240c09 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 22 Feb 2024 19:13:00 -0600 Subject: [PATCH 23/24] Created dedicated Admin cmd-k section --- src/components/CommandKClient.tsx | 4 +-- src/site/CommandK.tsx | 57 ++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index bc57c87c..d84de599 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -209,8 +209,8 @@ export default function CommandKClient({ action, }) => null); - const showAdminPages = Boolean(session?.user?.email); + const isAdminLoggedIn = Boolean(session?.user?.email); const SECTION_TAGS: CommandKSection = { heading: 'Tags', @@ -75,7 +77,7 @@ export default async function CommandK() { const SECTION_FILM: CommandKSection = { heading: 'Film Simulations', accessory: - + , items: filmSimulations.map(({ simulation, count }) => ({ label: simulation, @@ -94,23 +96,37 @@ export default async function CommandK() { }, { label: 'Grid', path:'/grid', - }] as CommandKSection['items']).concat(showAdminPages ? [{ - label: 'Admin / Photos', - annotation: , - path: PATH_ADMIN_PHOTOS, - }, { - label: 'Admin / Uploads', - annotation: , - path: PATH_ADMIN_UPLOADS, - }, { - label: 'Admin / Tags', - annotation: , - path: PATH_ADMIN_TAGS, - }, { - label: 'Admin / Config', - annotation: , - path: PATH_ADMIN_CONFIGURATION, - }] : []), + }]), + }; + + const SECTION_ADMIN: CommandKSection = { + heading: 'Admin', + accessory: , + items: isAdminLoggedIn + ? [{ + label: 'Manage Photos', + annotation: , + path: PATH_ADMIN_PHOTOS, + }, { + label: 'Manage Uploads', + annotation: , + path: PATH_ADMIN_UPLOADS, + }, { + label: 'Manage Tags', + annotation: , + path: PATH_ADMIN_TAGS, + }, { + label: 'App Config', + annotation: , + path: PATH_ADMIN_CONFIGURATION, + }, { + label: 'Sign Out', + action: signOutAction, + }] + : [{ + label: 'Sign In', + path: PATH_SIGN_IN, + }], }; return { 'use server'; From 25cb686acebec205fcac3b0cdd17ed08512ef29c Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Thu, 22 Feb 2024 22:53:42 -0600 Subject: [PATCH 24/24] Prevent cmd-k key listener interference --- src/app/layout.tsx | 8 ++--- src/components/CommandKClient.tsx | 8 +++-- src/photo/PhotoEscapeHandler.tsx | 19 ++++++---- src/photo/PhotoLinks.tsx | 58 +++++++++++++++++-------------- src/state/AppStateProvider.tsx | 7 +++- src/state/index.ts | 4 ++- 6 files changed, 63 insertions(+), 41 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 95f0a523..a3ed5826 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -94,11 +94,11 @@ export default function RootLayout({
+ + + +
- - - - ); diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index d84de599..3a218901 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -40,6 +40,7 @@ export default function CommandKClient({ const { isCommandKOpen: isOpen, setIsCommandKOpen: setIsOpen, + setShouldRespondToKeyboardCommands, } = useAppState(); const isOpenRef = useRef(isOpen); @@ -103,12 +104,15 @@ export default function CommandKClient({ }, [queryLive]); useEffect(() => { - if (!isOpen) { + if (isOpen) { + setShouldRespondToKeyboardCommands?.(false); + } else if (!isOpen) { setQueryLive(''); setQueriedSections([]); setIsLoading(false); + setTimeout(() => setShouldRespondToKeyboardCommands?.(true), 500); } - }, [isOpen]); + }, [isOpen, setShouldRespondToKeyboardCommands]); const sectionTheme: CommandKSection = { heading: 'Theme', diff --git a/src/photo/PhotoEscapeHandler.tsx b/src/photo/PhotoEscapeHandler.tsx index 44aa4579..4ba55918 100644 --- a/src/photo/PhotoEscapeHandler.tsx +++ b/src/photo/PhotoEscapeHandler.tsx @@ -1,6 +1,7 @@ 'use client'; import { getEscapePath } from '@/site/paths'; +import { useAppState } from '@/state'; import { useRouter, usePathname } from 'next/navigation'; import { useEffect } from 'react'; @@ -11,17 +12,21 @@ export default function PhotoEscapeHandler() { const pathname = usePathname(); + const { shouldRespondToKeyboardCommands } = useAppState(); + const escapePath = getEscapePath(pathname); useEffect(() => { - const onKeyUp = (e: KeyboardEvent) => { - if (e.key.toUpperCase() === 'ESCAPE' && escapePath) { - router.push(escapePath, { scroll: false }); + if (shouldRespondToKeyboardCommands) { + const onKeyUp = (e: KeyboardEvent) => { + if (e.key.toUpperCase() === 'ESCAPE' && escapePath) { + router.push(escapePath, { scroll: false }); + }; }; - }; - window.addEventListener(LISTENER_KEYUP, onKeyUp); - return () => window.removeEventListener(LISTENER_KEYUP, onKeyUp); - }, [router, escapePath]); + window.addEventListener(LISTENER_KEYUP, onKeyUp); + return () => window.removeEventListener(LISTENER_KEYUP, onKeyUp); + } + }, [shouldRespondToKeyboardCommands, router, escapePath]); return null; } diff --git a/src/photo/PhotoLinks.tsx b/src/photo/PhotoLinks.tsx index ff5770ad..73c5b892 100644 --- a/src/photo/PhotoLinks.tsx +++ b/src/photo/PhotoLinks.tsx @@ -30,40 +30,46 @@ export default function PhotoLinks({ }) { const router = useRouter(); - const { setNextPhotoAnimation } = useAppState(); + const { + setNextPhotoAnimation, + shouldRespondToKeyboardCommands, + } = useAppState(); const previousPhoto = getPreviousPhoto(photo, photos); const nextPhoto = getNextPhoto(photo, photos); useEffect(() => { - const onKeyUp = (e: KeyboardEvent) => { - switch (e.key.toUpperCase()) { - case 'ARROWLEFT': - case 'J': - if (previousPhoto) { - setNextPhotoAnimation?.(ANIMATION_RIGHT); - router.push( - pathForPhoto(previousPhoto, tag, camera, simulation), - { scroll: false }, - ); - } - break; - case 'ARROWRIGHT': - case 'L': - if (nextPhoto) { - setNextPhotoAnimation?.(ANIMATION_LEFT); - router.push( - pathForPhoto(nextPhoto, tag, camera, simulation), - { scroll: false }, - ); - } - break; + if (shouldRespondToKeyboardCommands) { + const onKeyUp = (e: KeyboardEvent) => { + switch (e.key.toUpperCase()) { + case 'ARROWLEFT': + case 'J': + if (previousPhoto) { + setNextPhotoAnimation?.(ANIMATION_RIGHT); + router.push( + pathForPhoto(previousPhoto, tag, camera, simulation), + { scroll: false }, + ); + } + break; + case 'ARROWRIGHT': + case 'L': + if (nextPhoto) { + setNextPhotoAnimation?.(ANIMATION_LEFT); + router.push( + pathForPhoto(nextPhoto, tag, camera, simulation), + { scroll: false }, + ); + } + break; + }; }; - }; - window.addEventListener(LISTENER_KEYUP, onKeyUp); - return () => window.removeEventListener(LISTENER_KEYUP, onKeyUp); + window.addEventListener(LISTENER_KEYUP, onKeyUp); + return () => window.removeEventListener(LISTENER_KEYUP, onKeyUp); + } }, [ router, + shouldRespondToKeyboardCommands, setNextPhotoAnimation, previousPhoto, nextPhoto, diff --git a/src/state/AppStateProvider.tsx b/src/state/AppStateProvider.tsx index 7001d824..a0d86a92 100644 --- a/src/state/AppStateProvider.tsx +++ b/src/state/AppStateProvider.tsx @@ -17,6 +17,9 @@ export default function AppStateProvider({ const [nextPhotoAnimation, setNextPhotoAnimation] = useState(); + const [shouldRespondToKeyboardCommands, setShouldRespondToKeyboardCommands] = + useState(true); + const [isCommandKOpen, setIsCommandKOpen] = useState(false); useEffect(() => { @@ -30,9 +33,11 @@ export default function AppStateProvider({ hasLoaded, setHasLoaded, nextPhotoAnimation, + setNextPhotoAnimation, + shouldRespondToKeyboardCommands, + setShouldRespondToKeyboardCommands, isCommandKOpen, setIsCommandKOpen, - setNextPhotoAnimation, clearNextPhotoAnimation: () => setNextPhotoAnimation?.(undefined), }} > diff --git a/src/state/index.ts b/src/state/index.ts index b91f43af..8c303280 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -6,9 +6,11 @@ export interface AppStateContext { hasLoaded?: boolean setHasLoaded?: Dispatch> nextPhotoAnimation?: AnimationConfig + setNextPhotoAnimation?: Dispatch> + shouldRespondToKeyboardCommands?: boolean + setShouldRespondToKeyboardCommands?: Dispatch> isCommandKOpen?: boolean setIsCommandKOpen?: Dispatch> - setNextPhotoAnimation?: (animation?: AnimationConfig) => void clearNextPhotoAnimation?: () => void }