Open History to see the last commit
1import { Button } from "@base-ui/react/button";
2import { Collapsible } from "@base-ui/react/collapsible";
3import { Select } from "@base-ui/react/select";
4import { createRealtimeClient } from "@neon/realtime/client";
5import {
6 useEffect,
7 useLayoutEffect,
8 useRef,
9 useState,
10 type FormEvent,
11 type ReactNode,
12} from "react";
13import { useRemoteRows } from "./live.js";
14import type { JournalAPI } from "./session.js";
15
16type Stamp = string | Date;
17type Expedition = {
18 id: string;
19 device_id: string;
20 title: string;
21 status: string;
22 is_running: boolean;
23 is_finished: boolean;
24 created_at: Stamp;
25};
26type Device = {
27 id: string;
28 name: string;
29 last_seen: Stamp | null;
30 remote_enabled: boolean;
31};
32type Entry = {
33 id: string;
34 position: number;
35 kind: "request" | "response" | "activity";
36 text: string;
37 details: string;
38 photo: string | null;
39 photo_ready: boolean;
40 created_at: Stamp;
41};
42type Command = {
43 id: string;
44 kind: string;
45 prompt: string;
46 status: string;
47 result: string;
48 expedition_id: string | null;
49 created_at: Stamp;
50};
51const commandInProgress = (command: Command) =>
52 ["queued", "received", "started"].includes(command.status);
53const commandNeedsAttention = (command: Command) =>
54 ["failed", "expired", "uncertain"].includes(command.status);
55const id = (row: { id: string }) => row.id;
56const expeditionKey = (row: { device_id: string; id: string }) =>
57 row.device_id + "/" + row.id;
58const time = (stamp: Stamp) =>
59 new Date(stamp).toLocaleTimeString(undefined, {
60 hour: "2-digit",
61 minute: "2-digit",
62 });
63const pageDate = (stamp: Stamp) =>
64 new Date(stamp).toLocaleDateString(undefined, {
65 weekday: "long",
66 day: "numeric",
67 month: "long",
68 });
69const trailDate = (stamp: Stamp) =>
70 new Date(stamp).toLocaleDateString(undefined, {
71 day: "numeric",
72 month: "short",
73 }) +
74 " at " +
75 time(stamp);
76const newest = (a: { created_at: Stamp }, b: { created_at: Stamp }) =>
77 +new Date(b.created_at) - +new Date(a.created_at);
78const problem = (e: unknown) =>
79 e instanceof Error ? e.message : "Could not reach JOL.";
80
81export function Brand() {
82 return (
83 <>
84 <img className="jol-logo" src="/jol-logo.svg" alt="JOL" />
85 <span className="brand-name">Jerry On Line</span>
86 </>
87 );
88}
89function Icon({
90 name,
91}: {
92 name: "sidebar" | "new" | "finish" | "stop" | "send" | "chevron";
93}) {
94 const drawing: Record<typeof name, ReactNode> = {
95 sidebar: (
96 <>
97 <rect x="3" y="4" width="18" height="16" rx="3" />
98 <path d="M9 4v16M5.8 8h.6m-.6 4h.6" />
99 </>
100 ),
101 new: (
102 <>
103 <path d="M12 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-6" />
104 <path d="m10 14 1-4 7-7 3 3-7 7-4 1Z" />
105 </>
106 ),
107 finish: (
108 <>
109 <circle cx="12" cy="12" r="9" />
110 <path d="m8 12 3 3 5-6" />
111 </>
112 ),
113 stop: (
114 <>
115 <circle cx="12" cy="12" r="9" />
116 <rect x="9" y="9" width="6" height="6" rx="1" />
117 </>
118 ),
119 send: (
120 <>
121 <circle cx="12" cy="12" r="11" fill="currentColor" stroke="none" />
122 <path d="M12 17V7m-4 4 4-4 4 4" stroke="var(--paper)" />
123 </>
124 ),
125 chevron: <path d="m9 6 6 6-6 6" />,
126 };
127 return (
128 <svg
129 width="20"
130 height="20"
131 viewBox="0 0 24 24"
132 fill="none"
133 stroke="currentColor"
134 strokeWidth="1.7"
135 strokeLinecap="round"
136 strokeLinejoin="round"
137 aria-hidden="true"
138 >
139 {drawing[name]}
140 </svg>
141 );
142}
143
144export function Journal({
145 api,
146 realtimeURL,
147}: {
148 api: JournalAPI;
149 realtimeURL: string | null;
150}) {
151 const [client, setClient] =
152 useState<ReturnType<typeof createRealtimeClient>>();
153 useEffect(() => {
154 if (!realtimeURL) return;
155 const next = createRealtimeClient({ url: realtimeURL });
156 setClient(next);
157 return () => next.close();
158 }, [realtimeURL]);
159 if (realtimeURL && !client)
160 return <p className="connecting">Opening your journal…</p>;
161 return <JournalContents api={api} client={client} />;
162}
163
164function JournalContents({
165 api,
166 client,
167}: {
168 api: JournalAPI;
169 client?: ReturnType<typeof createRealtimeClient>;
170}) {
171 const [sidebarOpen, setSidebarOpen] = useState(() => window.innerWidth > 680);
172 const [selection, setSelection] = useState<Expedition | null>();
173 const [chosenDevice, setChosenDevice] = useState("");
174 const [older, setOlder] = useState<Expedition[]>([]);
175 const [pageEnd, setPageEnd] = useState(false);
176 const [loadingOlder, setLoadingOlder] = useState(false);
177 const [issue, setIssue] = useState("");
178 const [clock, setClock] = useState(Date.now);
179
180 useEffect(() => {
181 const timer = setInterval(() => setClock(Date.now()), 5000);
182 return () => clearInterval(timer);
183 }, []);
184
185 const macs = useRemoteRows<Device>(
186 api,
187 client,
188 { kind: "devices" },
189 "/devices",
190 id,
191 );
192 const recents = useRemoteRows<Expedition>(
193 api,
194 client,
195 { kind: "expeditions" },
196 "/expeditions",
197 expeditionKey,
198 );
199 const all = new Map<string, Expedition>();
200 for (const expedition of [...older, ...(recents.rows ?? [])])
201 all.set(expeditionKey(expedition), expedition);
202 const expeditions = [...all.values()].sort(
203 (a, b) => newest(a, b) || expeditionKey(b).localeCompare(expeditionKey(a)),
204 );
205 const base = selection === undefined ? expeditions[0] : selection;
206 const selected = base ? (all.get(expeditionKey(base)) ?? base) : undefined;
207 const devices = macs.rows ?? [];
208 const activeDevice =
209 devices.find(
210 (device) => device.id === (selected?.device_id || chosenDevice),
211 ) ?? devices[0];
212 const online =
213 activeDevice?.last_seen != null &&
214 clock - +new Date(activeDevice.last_seen) < 60_000;
215 const liveDelayed = !!client && (macs.fallback || recents.fallback);
216
217 function choose(expedition: Expedition | null) {
218 setSelection(expedition);
219 if (expedition) setChosenDevice(expedition.device_id);
220 if (window.innerWidth <= 680) setSidebarOpen(false);
221 }
222 async function loadOlder() {
223 const last = expeditions.at(-1);
224 if (!last || loadingOlder) return;
225 setLoadingOlder(true);
226 const query = new URLSearchParams({
227 before: new Date(last.created_at).toISOString(),
228 device: last.device_id,
229 expedition: last.id,
230 });
231 try {
232 const rows = await api.read<Expedition[]>("/expeditions?" + query);
233 setOlder((previous) => [...previous, ...rows]);
234 setPageEnd(rows.length < 100);
235 } catch (e) {
236 setIssue(problem(e));
237 } finally {
238 setLoadingOlder(false);
239 }
240 }
241
242 return (
243 <main className="shell">
244 <header className="masthead">
245 <Brand />
246 <span className="connection">
247 <span className={online ? "lamp" : "lamp offline"} />
248 {liveDelayed
249 ? "Reconnecting live updates"
250 : online
251 ? "Jerry is on line"
252 : activeDevice?.last_seen
253 ? "Last seen " + time(activeDevice.last_seen)
254 : "Waiting for Jerry"}
255 </span>
256 <Button
257 onClick={() => void api.signOut().catch((e) => setIssue(problem(e)))}
258 >
259 Sign out
260 </Button>
261 </header>
262 <section
263 className={`notebook workspace ${sidebarOpen ? "sidebar-open" : ""}`}
264 >
265 <aside className="sidebar" id="expeditions" inert={!sidebarOpen}>
266 <h2>Expeditions</h2>
267 <div className="expedition-list">
268 {!expeditions.length && (
269 <p className="sidebar-note">
270 {recents.ready ? "No expeditions yet" : "Opening your journal…"}
271 </p>
272 )}
273 {expeditions.map((expedition) => {
274 const key = expeditionKey(expedition);
275 const active = !!selected && expeditionKey(selected) === key;
276 return (
277 <Button
278 className={`expedition ${active ? "active" : ""}`}
279 key={key}
280 aria-current={active ? "page" : undefined}
281 title={expedition.title}
282 onClick={() => choose(expedition)}
283 >
284 <span className="expedition-name">{expedition.title}</span>
285 <small>
286 {expedition.is_running && (
287 <span
288 className="writing-dot"
289 aria-label="Jerry is writing"
290 />
291 )}
292 {trailDate(expedition.created_at)}
293 </small>
294 </Button>
295 );
296 })}
297 {!pageEnd && (recents.rows?.length ?? 0) >= 100 && (
298 <Button
299 className="quiet more-expeditions"
300 disabled={loadingOlder}
301 onClick={() => void loadOlder()}
302 >
303 Earlier expeditions
304 </Button>
305 )}
306 </div>
307 {devices.length > 0 && (
308 <Select.Root
309 value={activeDevice?.id ?? null}
310 onValueChange={(value) => {
311 if (value) {
312 setChosenDevice(value);
313 choose(null);
314 }
315 }}
316 >
317 <Select.Trigger className="device-picker" aria-label="Choose Mac">
318 <span>{activeDevice?.name}</span>
319 <Select.Icon>
320 <Icon name="chevron" />
321 </Select.Icon>
322 </Select.Trigger>
323 <Select.Portal>
324 <Select.Positioner side="top" sideOffset={5}>
325 <Select.Popup className="device-popup">
326 {devices.map((device) => (
327 <Select.Item value={device.id} key={device.id}>
328 <Select.ItemText>{device.name}</Select.ItemText>
329 <Select.ItemIndicator>✓</Select.ItemIndicator>
330 </Select.Item>
331 ))}
332 </Select.Popup>
333 </Select.Positioner>
334 </Select.Portal>
335 </Select.Root>
336 )}
337 </aside>
338 <section className="journal">
339 <ExpeditionPage
340 key={
341 selected ? expeditionKey(selected) : (activeDevice?.id ?? "new")
342 }
343 api={api}
344 client={client}
345 selected={selected}
346 device={activeDevice}
347 online={online}
348 issue={issue}
349 onNew={() => choose(null)}
350 sidebarOpen={sidebarOpen}
351 onToggleSidebar={() => setSidebarOpen(!sidebarOpen)}
352 />
353 </section>
354 </section>
355 </main>
356 );
357}
358
359type PageProps = {
360 api: JournalAPI;
361 client: ReturnType<typeof createRealtimeClient> | undefined;
362 selected: Expedition | undefined;
363 device: Device | undefined;
364 online: boolean;
365 issue: string;
366 onNew(): void;
367 sidebarOpen: boolean;
368 onToggleSidebar(): void;
369};
370function ExpeditionPage({
371 api,
372 client,
373 selected,
374 device,
375 online,
376 issue,
377 onNew,
378 sidebarOpen,
379 onToggleSidebar,
380}: PageProps) {
381 const path = selected
382 ? `/devices/${selected.device_id}/expeditions/${selected.id}`
383 : undefined;
384 const spec = selected && {
385 deviceID: selected.device_id,
386 expeditionID: selected.id,
387 };
388 const metadata = useRemoteRows<Expedition>(
389 api,
390 client,
391 spec && { ...spec, kind: "expedition" },
392 path,
393 expeditionKey,
394 );
395 const recent = useRemoteRows<Entry>(
396 api,
397 client,
398 spec && { ...spec, kind: "entries" },
399 path && path + "/entries",
400 id,
401 );
402 const deliveries = useRemoteRows<Command>(
403 api,
404 client,
405 device && { kind: "commands", deviceID: device.id },
406 device && `/devices/${device.id}/commands`,
407 id,
408 );
409 const [earlier, setEarlier] = useState<Entry[]>([]);
410 const [hasEarlier, setHasEarlier] = useState(true);
411 const [reading, setReading] = useState(false);
412 const [direction, setDirection] = useState("");
413 const [sending, setSending] = useState(false);
414 const [error, setError] = useState("");
415 const [watchedCommands, setWatchedCommands] = useState(() => new Set<string>());
416 const pages = useRef<HTMLDivElement>(null);
417 const input = useRef<HTMLTextAreaElement>(null);
418 const following = useRef(true);
419 const prepend = useRef<number | null>(null);
420 const submission = useRef<{ key: string; id: string } | null>(null);
421
422 const expedition = metadata.rows?.[0] ?? selected;
423 // Retain entries that scrolled out of the live window while reading.
424 const [seen, setSeen] = useState<Entry[]>([]);
425 useEffect(() => {
426 if (!recent.rows?.length) return;
427 const incoming = recent.rows;
428 setSeen((previous) => [
429 ...new Map(
430 [...previous, ...incoming].map((entry) => [entry.id, entry]),
431 ).values(),
432 ]);
433 }, [recent.rows]);
434 const entries = [
435 ...new Map(
436 [...earlier, ...seen, ...(recent.rows ?? [])].map((entry) => [
437 entry.id,
438 entry,
439 ]),
440 ).values(),
441 ].sort((a, b) => a.position - b.position);
442 // A failure is a notice for work seen in this view. A fresh load still
443 // shows outstanding work but doesn't replay failures from command history.
444 useEffect(() => {
445 const pending = deliveries.rows?.filter(commandInProgress);
446 if (!pending?.length) return;
447 setWatchedCommands((previous) =>
448 pending.every((command) => previous.has(command.id))
449 ? previous
450 : new Set([...previous, ...pending.map(id)]),
451 );
452 }, [deliveries.rows]);
453 const commands = [...(deliveries.rows ?? [])]
454 .sort(newest)
455 .filter(
456 (command) =>
457 (!selected ||
458 command.expedition_id === selected.id ||
459 command.expedition_id == null) &&
460 (commandInProgress(command) ||
461 (commandNeedsAttention(command) && watchedCommands.has(command.id))),
462 )
463 .slice(0, 8);
464 const delayed =
465 !!client && (metadata.fallback || recent.fallback || deliveries.fallback);
466 const canSend = !!device?.remote_enabled && !expedition?.is_finished;
467 const showOlder = hasEarlier && (recent.rows?.length ?? 0) >= 200;
468
469 useLayoutEffect(() => {
470 const box = pages.current;
471 if (!box) return;
472 if (prepend.current !== null) {
473 box.scrollTop += box.scrollHeight - prepend.current;
474 prepend.current = null;
475 } else if (following.current) {
476 box.scrollTop = box.scrollHeight;
477 }
478 }, [recent.rows, earlier, metadata.rows, deliveries.rows]);
479
480 async function moreEntries() {
481 if (!path || !entries.length || reading) return;
482 setReading(true);
483 try {
484 const rows = await api.read<Entry[]>(
485 path + "/entries?before=" + entries[0].position,
486 );
487 if (pages.current) prepend.current = pages.current.scrollHeight;
488 following.current = false;
489 setEarlier((old) => [...rows, ...old]);
490 setHasEarlier(rows.length === 200);
491 } catch (e) {
492 setError(problem(e));
493 } finally {
494 setReading(false);
495 }
496 }
497
498 async function send(
499 kind: "start" | "continue" | "finish" | "stop",
500 event?: FormEvent,
501 ) {
502 event?.preventDefault();
503 if (sending || !device) return;
504 const prompt =
505 kind === "start" || kind === "continue" ? direction.trim() : "";
506 if ((kind === "start" || kind === "continue") && (!canSend || !prompt))
507 return;
508 const key = JSON.stringify([device.id, selected?.id, kind, prompt]);
509 if (submission.current?.key !== key)
510 submission.current = { key, id: crypto.randomUUID() };
511 const commandID = submission.current.id;
512 // The Mac can report a failure before the first in-progress update.
513 setWatchedCommands((previous) => new Set(previous).add(commandID));
514 setSending(true);
515 setError("");
516 try {
517 await api.read("/commands", {
518 id: commandID,
519 deviceID: device.id,
520 expeditionID: selected?.id,
521 kind,
522 prompt,
523 });
524 submission.current = null;
525 if (prompt) setDirection("");
526 } catch (e) {
527 setError(problem(e));
528 } finally {
529 setSending(false);
530 }
531 }
532 return (
533 <>
534 <header className="toolbar">
535 <Button
536 className="tool-button sidebar-toggle"
537 aria-label="Toggle expeditions"
538 aria-controls="expeditions"
539 aria-expanded={sidebarOpen}
540 title="Toggle expeditions"
541 onClick={onToggleSidebar}
542 >
543 <Icon name="sidebar" />
544 </Button>
545 <h1>Expedition journal</h1>
546 <div className="tools">
547 <Button
548 className="tool-button"
549 aria-label="New expedition"
550 title="New expedition"
551 onClick={() => {
552 onNew();
553 input.current?.focus();
554 }}
555 >
556 <Icon name="new" />
557 </Button>
558 {expedition?.is_running && (
559 <Button
560 className="tool-button"
561 disabled={!device?.remote_enabled || sending}
562 aria-label="Stop expedition"
563 title="Stop expedition"
564 onClick={() => void send("stop")}
565 >
566 <Icon name="stop" />
567 </Button>
568 )}
569 <Button
570 className="tool-button"
571 disabled={
572 !device?.remote_enabled ||
573 !selected ||
574 !!expedition?.is_finished ||
575 sending
576 }
577 aria-label="Finish expedition"
578 title="Finish expedition"
579 onClick={() => void send("finish")}
580 >
581 <Icon name="finish" />
582 </Button>
583 </div>
584 </header>
585 <div
586 className="pages"
587 ref={pages}
588 tabIndex={0}
589 aria-label="Expedition journal"
590 onScroll={(event) => {
591 const box = event.currentTarget;
592 following.current =
593 box.scrollHeight - box.scrollTop - box.clientHeight < 80;
594 }}
595 >
596 <div className="page">
597 {expedition ? (
598 <>
599 <header className="page-heading">
600 <time dateTime={new Date(expedition.created_at).toISOString()}>
601 {pageDate(expedition.created_at)}
602 </time>
603 <h2>{expedition.title}</h2>
604 </header>
605 {showOlder && (
606 <Button
607 className="quiet load-older"
608 disabled={reading}
609 onClick={() => void moreEntries()}
610 >
611 Earlier entries
612 </Button>
613 )}
614 {!recent.ready && !entries.length && (
615 <p className="journal-status">Opening this expedition…</p>
616 )}
617 {entries.map((entry) => (
618 <JournalEntry
619 key={entry.id}
620 entry={entry}
621 path={path!}
622 api={api}
623 />
624 ))}
625 {expedition.is_running ? (
626 <p className="journal-status">Jerry is working…</p>
627 ) : (
628 expedition.status !== "Ready for your next direction" && (
629 <p className="journal-status">{expedition.status}</p>
630 )
631 )}
632 </>
633 ) : (
634 <header className="page-heading new-page">
635 <h2>A new expedition</h2>
636 <p>Where shall we go?</p>
637 </header>
638 )}
639 {!!commands.length && (
640 <div className="deliveries" aria-live="polite">
641 {commands.map((command) => (
642 <div className="delivery" key={command.id}>
643 <span>
644 {command.status === "queued"
645 ? "Waiting for Jerry"
646 : command.status === "received"
647 ? "Received by the Mac"
648 : command.status === "started"
649 ? "Jerry is working"
650 : command.status}
651 </span>
652 {command.result
653 ? ` · ${command.result}`
654 : command.prompt
655 ? ` · ${command.prompt}`
656 : ""}
657 {command.status === "queued" && (
658 <Button
659 className="quiet"
660 onClick={() => {
661 void api
662 .read(`/commands/${command.id}/cancel`, {})
663 .catch((e) => setError(problem(e)));
664 }}
665 >
666 Cancel
667 </Button>
668 )}
669 {commandNeedsAttention(command) && (
670 <Button
671 className="quiet"
672 onClick={() =>
673 setWatchedCommands((previous) => {
674 const next = new Set(previous);
675 next.delete(command.id);
676 return next;
677 })
678 }
679 >
680 Dismiss
681 </Button>
682 )}
683 </div>
684 ))}
685 </div>
686 )}
687 </div>
688 </div>
689 <form
690 className="composer"
691 onSubmit={(event) => void send(selected ? "continue" : "start", event)}
692 >
693 <div className="compose-field">
694 <textarea
695 ref={input}
696 value={direction}
697 maxLength={20000}
698 rows={1}
699 aria-label="Expedition direction"
700 placeholder={
701 selected ? "Add a direction…" : "Give Jerry a mission…"
702 }
703 onChange={(event) => setDirection(event.target.value)}
704 onKeyDown={(event) => {
705 if (
706 event.key === "Enter" &&
707 !event.shiftKey &&
708 !event.nativeEvent.isComposing
709 ) {
710 event.preventDefault();
711 event.currentTarget.form?.requestSubmit();
712 }
713 }}
714 />
715 <Button
716 className="send-button"
717 type="submit"
718 aria-label="Send to Jerry"
719 title="Send to Jerry"
720 disabled={!canSend || !direction.trim() || sending}
721 >
722 <Icon name="send" />
723 </Button>
724 </div>
725 <p
726 className={error || issue ? "compose-status error" : "compose-status"}
727 role={error || issue ? "alert" : undefined}
728 >
729 {error ||
730 issue ||
731 (delayed
732 ? "Live updates are reconnecting"
733 : !device
734 ? "Connect Jerry on your Mac"
735 : expedition?.is_finished
736 ? "Expedition finished"
737 : !device.remote_enabled
738 ? "Enable remote missions on this Mac"
739 : !online
740 ? "Mac offline · directions wait up to one hour"
741 : "")}
742 </p>
743 </form>
744 </>
745 );
746}
747
748function JournalEntry({
749 entry,
750 path,
751 api,
752}: {
753 entry: Entry;
754 path: string;
755 api: JournalAPI;
756}) {
757 const label = entry.photo
758 ? "A memento"
759 : entry.kind === "request"
760 ? "Your direction"
761 : entry.kind === "response"
762 ? "Jerry’s notes"
763 : "On the trail";
764 return (
765 <article className={`entry entry-${entry.kind}`}>
766 <div
767 className={
768 entry.kind === "request" ? "entry-paper scrap" : "entry-paper"
769 }
770 >
771 <header className="entry-label">
772 <span>{label}</span>
773 <time dateTime={new Date(entry.created_at).toISOString()}>
774 {time(entry.created_at)}
775 </time>
776 </header>
777 {entry.photo ? (
778 <Photograph
779 path={path + "/photos/" + encodeURIComponent(entry.photo)}
780 entry={entry}
781 api={api}
782 />
783 ) : (
784 <div
785 className={entry.kind === "request" ? "typewritten" : "handwriting"}
786 >
787 {entry.text}
788 </div>
789 )}
790 {entry.kind === "response" && !entry.photo && (
791 <span className="signature">— Jerry</span>
792 )}
793 </div>
794 {entry.details && (
795 <Collapsible.Root className="details">
796 <Collapsible.Trigger className="details-trigger">
797 <Icon name="chevron" />
798 Details
799 </Collapsible.Trigger>
800 <Collapsible.Panel>
801 <div className="receipt">{entry.details}</div>
802 </Collapsible.Panel>
803 </Collapsible.Root>
804 )}
805 </article>
806 );
807}
808
809function Photograph({
810 path,
811 entry,
812 api,
813}: {
814 path: string;
815 entry: Entry;
816 api: JournalAPI;
817}) {
818 const [src, setSrc] = useState("");
819 useEffect(() => {
820 if (!entry.photo_ready) return;
821 const abort = new AbortController();
822 let objectURL: string | undefined;
823 void api
824 .photo(path, abort.signal)
825 .then((image) => {
826 if (abort.signal.aborted) return;
827 objectURL = URL.createObjectURL(image);
828 setSrc(objectURL);
829 })
830 .catch(() => {});
831 return () => {
832 abort.abort();
833 if (objectURL) URL.revokeObjectURL(objectURL);
834 };
835 }, [api, path, entry.photo_ready]);
836 return (
837 <figure className="polaroid">
838 {src ? (
839 <img src={src} alt="Jerry’s expedition photograph" />
840 ) : (
841 <div className="photo-placeholder">Photograph arriving…</div>
842 )}
843 <figcaption>{entry.text}</figcaption>
844 </figure>
845 );
846}