Third audit, UI half; side nav on top; request button colors
- Event cards: lazy -640 photo, only nearby slides drawn, a counter past 12 events, past grid paged with Show more - Community map: search over list and grid, 12 per region then Show all, list no longer redrawn on hover - People tiles: one clip check for the list, Show all past 30 - Person pages: 6 events and posts then Show all; excerpts load only the first paragraph - Admin: filter box on long pickers and the QR select, options sent per form, Media thumbnails from the small copy, debounced searches that drop stale answers - Pages show their last data while refreshing after the cache TTL - Side nav stacks above page content (the carousel arrows) - No event request button on National Retreats; request buttons take their section's accent - Version v1.11.1-audit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
11a4555683
commit
222c9e69a2
22 changed files with 686 additions and 259 deletions
|
|
@ -35,6 +35,10 @@
|
|||
* · no `fallback`. Rendering plausible-looking content with no
|
||||
* sign the server is down is worse than a visible error.
|
||||
*
|
||||
* · a path asked for before starts from its last answer (api.ts,
|
||||
* peek) and isn't `loading` while it refreshes, so a page opened
|
||||
* again after the TTL doesn't flash its skeleton.
|
||||
*
|
||||
* `notFound` is separated from `error` because they are different
|
||||
* pages: a 404 is a slug that doesn't exist and retrying won't help,
|
||||
* anything else is worth a Try again button.
|
||||
|
|
@ -46,7 +50,7 @@
|
|||
*/
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { get, invalidate, ApiError } from './api.ts'
|
||||
import { get, invalidate, peek, ApiError } from './api.ts'
|
||||
|
||||
export type Resource<T> = {
|
||||
data: T | null
|
||||
|
|
@ -57,8 +61,9 @@ export type Resource<T> = {
|
|||
}
|
||||
|
||||
export function useRecord<T>(path: string | null, key: string): Resource<T> {
|
||||
const [data, setData] = useState<T | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const stale = path ? peek(path)?.[key] : undefined
|
||||
const [data, setData] = useState<T | null>(stale ?? null)
|
||||
const [loading, setLoading] = useState(stale === undefined)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [notFound, setNotFound] = useState(false)
|
||||
const [attempt, setAttempt] = useState(0)
|
||||
|
|
@ -84,7 +89,12 @@ export function useRecord<T>(path: string | null, key: string): Resource<T> {
|
|||
let live = true
|
||||
|
||||
async function load() {
|
||||
setLoading(true)
|
||||
const last = peek(path as string)?.[key]
|
||||
if (last === undefined) setLoading(true)
|
||||
else {
|
||||
setData(last as T)
|
||||
setLoading(false)
|
||||
}
|
||||
setError(null)
|
||||
setNotFound(false)
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue