1import { createEffect, createMemo, createSignal, lazy, onCleanup, onMount, Show, Suspense } from "solid-js";2import { App as CapacitorApp } from "@capacitor/app";3import { Capacitor, registerPlugin } from "@capacitor/core";4import { Keyboard } from "@capacitor/keyboard";5import { StatusBar, Style } from "@capacitor/status-bar";6import { storageGet, storageSet } from "../shared/storage";7import { sendMessage } from "../shared/bridge";8import { clearInMemoryVault, publishInMemoryVault } from "../shared/in-memory-vault";9import { ACCENT_COLORS } from "../shared/types";10import type { AccentColorName, PendingPasskeyRequest, ProFeature, VaultEntry } from "../shared/types";11import type { IncomingPairingRequest } from "../shared/sync-types";12import { isPasskeyOnly } from "../shared/types";13import { LockView } from "./views/Lock";14import { Onboarding } from "./views/Onboarding";15import { ProCelebration } from "./views/ProCelebration";16import { VaultView, type SortOrder } from "./views/Vault";17import { EntryView } from "./views/Entry";18import { AddView } from "./views/Add";19import { PeachWordmark } from "./components/PeachMark";20import { PasskeyApprovalView } from "./views/PasskeyApproval";21import { extractDomain } from "../shared/domain";22import { popupCopy } from "./copy";23import {24 DEFAULT_BINDINGS,25 formatKeybinding,26 getActiveBindings,27 matchKeybinding,28 SHORTCUT_DESCRIPTORS,29 type Keybinding,30 type ShortcutAction,31} from "../shared/shortcuts";32import { generateTOTP } from "../crypto/totp";3334export { sendMessage } from "../shared/bridge";3536const ImportView = lazy(() => import("./views/Import").then(m => ({ default: m.ImportView })));37const ExportView = lazy(() => import("./views/Export").then(m => ({ default: m.ExportView })));38const SettingsView = lazy(() => import("./views/Settings").then(m => ({ default: m.SettingsView })));39const HealthView = lazy(() => import("./views/Health").then(m => ({ default: m.HealthView })));40const TrashView = lazy(() => import("./views/TrashView").then(m => ({ default: m.TrashView })));41const PanicView = lazy(() => import("./views/Panic").then(m => ({ default: m.PanicView })));4243const Autofill = registerPlugin<{44 checkPendingSave(): Promise<{ pending: string | null }>;45 openAutofillSettings(): Promise<void>;46 isEnabledAsAutofillService(): Promise<{ enabled: boolean }>;47}>("Autofill");4849type View =50 | "lock"51 | "pro-celebration"52 | "entry"53 | "list"54 | "add"55 | "settings"56 | "import"57 | "export"58 | "health"59 | "trash"60 | "panic";61type BootState = "loading" | "ready";6263const canarySuppressMap = new Map<string, boolean>();64let shellRingAnimation: Animation | null = null;6566export function isCanarySuppressed(entryId: string): boolean {67 return canarySuppressMap.get(entryId) ?? false;68}6970export function setCanarySuppressed(entryId: string, suppressed: boolean): void {71 canarySuppressMap.set(entryId, suppressed);72}7374export function clearCanarySuppressions(): void {75 canarySuppressMap.clear();76}7778export function triggerRing() {79 const shell = document.getElementById("hd-shell");80 if (!shell) return;8182 shellRingAnimation?.cancel();83 shell.dataset.glowing = "true";84 const animation = shell.animate(85 [86 { offset: 0, boxShadow: "var(--copy-shadow)" },87 {88 offset: 0.3,89 boxShadow:90 "0 2px 8px rgba(0,0,0,0.5), 0 14px 48px rgba(0,0,0,0.6), 0 0 0 1.5px color-mix(in srgb, var(--peach-accent) 58%, transparent), 0 0 22px color-mix(in srgb, var(--peach-accent) 18%, transparent)",91 },92 { offset: 1, boxShadow: "var(--copy-shadow)" },93 ],94 {95 duration: 720,96 easing: "cubic-bezier(0.4, 0, 0.2, 1)",97 fill: "none",98 }99 );100 shellRingAnimation = animation;101 const clearGlow = () => {102 if (shellRingAnimation !== animation) return;103 shellRingAnimation = null;104 delete shell.dataset.glowing;105 };106 animation.onfinish = clearGlow;107 animation.oncancel = clearGlow;108}109110111export function triggerPipPulse() {112 const pip = document.querySelector(".peach-status-pip, .pip");113 if (pip) {114 pip.classList.remove("pulse");115 void (pip as HTMLElement).offsetWidth;116 pip.classList.add("pulse");117 }118}119120const ENTRY_TRANSITION_EXIT_MS = 95;121const ENTRY_TRANSITION_SETTLE_MS = 135;122123export default function App() {124 const [bootState, setBootState] = createSignal<BootState>("loading");125 const [view, setView] = createSignal<View>("lock");126 const [contentPhase, setContentPhase] = createSignal<"enter" | "exit" | "idle">(127 "enter"128 );129 const [contentTransitioning, setContentTransitioning] = createSignal(false);130 const [hasVault, setHasVault] = createSignal(false);131 const [onboarded, setOnboarded] = createSignal(true);132 const [entries, setEntries] = createSignal<VaultEntry[]>([]);133 const [selectedEntry, setSelectedEntry] = createSignal<VaultEntry | null>(null);134 const [editEntry, setEditEntry] = createSignal<VaultEntry | undefined>(undefined);135 const [accentColor, setAccentColor] = createSignal<AccentColorName>("peach");136 const [theme, setTheme] = createSignal<"dark" | "light">("dark");137 const [displayFont, setDisplayFont] = createSignal<"cormorant-italic" | "cormorant" | "inter" | "system">("cormorant-italic");138 const [textSize, setTextSize] = createSignal<"small" | "medium" | "large">("medium");139 const [reduceMotion, setReduceMotion] = createSignal<boolean>(false);140 const [lockOnClose, setLockOnClose] = createSignal(true);141 const [autoLockMinutes, setAutoLockMinutes] = createSignal(5);142 const [breachMonitoring, setBreachMonitoring] = createSignal(true);143 const [shortcutBindings, setShortcutBindings] = createSignal<Record<ShortcutAction, Keybinding>>(DEFAULT_BINDINGS);144 const [showShortcutsHelp, setShowShortcutsHelp] = createSignal(false);145 const [trashRetentionDays, setTrashRetentionDays] = createSignal(30);146 const [restoreView, setRestoreView] = createSignal<"file" | null>(null);147 const [pendingPasskey, setPendingPasskey] = createSignal<PendingPasskeyRequest | null>(null);148 const [currentTabDomain, setCurrentTabDomain] = createSignal<string>("");149 150 151 152 153 const [proStatus, setProStatus] = createSignal(false);154 const [settingsInitialSection, setSettingsInitialSection] = createSignal<string | null>(null);155 const [upgradeHighlight, setUpgradeHighlight] = createSignal<ProFeature | null>(null);156 const [sortOrder, setSortOrder] = createSignal<SortOrder>("url-first");157 const [listSearchSeed, setListSearchSeed] = createSignal("");158 const [listSearchSeedNonce, setListSearchSeedNonce] = createSignal(0);159 const [pendingCelebration, setPendingCelebration] = createSignal(false);160 const [pendingProNotice, setPendingProNotice] = createSignal<{ feature: string } | null>(null);161 const [pendingAutofillSave, setPendingAutofillSave] = createSignal<{162 domain: string;163 username: string;164 password: string;165 } | null>(null);166 const [backExitNotice, setBackExitNotice] = createSignal(false);167 const [incomingPair, setIncomingPair] = createSignal<IncomingPairingRequest | null>(null);168 const [incomingPairResponding, setIncomingPairResponding] = createSignal(false);169 const [incomingPairTick, setIncomingPairTick] = createSignal(0);170 const incomingPairSecondsLeft = () => {171 void incomingPairTick();172 const req = incomingPair();173 if (!req) return 0;174 return Math.max(0, Math.ceil((req.expiresAt - Date.now()) / 1000));175 };176 177 178 179 const [returnToPanic, setReturnToPanic] = createSignal(false);180181 let contentPhaseTimer: number | undefined;182 let lastBackExitAt = 0;183184 function applyAccent(name: AccentColorName) {185 const color = ACCENT_COLORS.find(c => c.name === name) ?? ACCENT_COLORS[0]!;186 const hex = color.hex;187 document.documentElement.style.setProperty("--peach-accent", hex);188 189 190 document.documentElement.style.setProperty("--peach-glow", hex + "2A");191 document.documentElement.style.setProperty("--peach-surface-tint", hex + "09");192 document.documentElement.style.setProperty("--peach-border-accent", hex + "24");193 }194195 createEffect(() => {196 applyAccent(accentColor());197 });198199 createEffect(() => {200 document.documentElement.classList.toggle("light", theme() === "light");201 document.body.classList.toggle("light", theme() === "light");202 if (Capacitor.isNativePlatform()) {203 void applyMobileStatusBar(theme());204 }205 });206207 createEffect(() => {208 document.documentElement.setAttribute("data-display-font", displayFont());209 });210211 createEffect(() => {212 document.documentElement.setAttribute("data-text-size", textSize());213 });214215 createEffect(() => {216 if (reduceMotion()) {217 document.documentElement.setAttribute("data-motion", "reduce");218 } else {219 document.documentElement.removeAttribute("data-motion");220 }221 });222223 const selectedIndex = createMemo(() => {224 const currentId = selectedEntry()?.id;225 if (!currentId) return entries().length > 0 ? 0 : -1;226 return entries().findIndex((entry) => entry.id === currentId);227 });228229 async function applyAccentColor(name: AccentColorName) {230 applyAccent(name);231 setAccentColor(name);232 await sendMessage({ type: "UPDATE_SETTINGS", payload: { accentColor: name } });233 }234235 async function applyTheme(t: "dark" | "light") {236 setTheme(t);237 await sendMessage({ type: "UPDATE_SETTINGS", payload: { theme: t } });238 }239240 async function applyDisplayFont(f: "cormorant-italic" | "cormorant" | "inter" | "system") {241 setDisplayFont(f);242 await sendMessage({ type: "UPDATE_SETTINGS", payload: { displayFont: f } });243 }244245 async function applyTextSize(size: "small" | "medium" | "large") {246 setTextSize(size);247 await sendMessage({ type: "UPDATE_SETTINGS", payload: { textSize: size } });248 }249250 async function applyReduceMotion(enabled: boolean) {251 setReduceMotion(enabled);252 await sendMessage({ type: "UPDATE_SETTINGS", payload: { reduceMotion: enabled } });253 }254255 256 257 258 async function applyShortcuts(active: Record<ShortcutAction, Keybinding>) {259 setShortcutBindings(active);260 const overrides: Record<string, Keybinding> = {};261 for (const action of Object.keys(active) as ShortcutAction[]) {262 const a = active[action];263 const d = DEFAULT_BINDINGS[action];264 const same = a.key === d.key265 && Boolean(a.ctrl) === Boolean(d.ctrl)266 && Boolean(a.meta) === Boolean(d.meta)267 && Boolean(a.shift) === Boolean(d.shift)268 && Boolean(a.alt) === Boolean(d.alt);269 if (!same) overrides[action] = a;270 }271 await sendMessage({ type: "UPDATE_SETTINGS", payload: { shortcuts: overrides } });272 }273274 async function applyLockOnClose(enabled: boolean) {275 setLockOnClose(enabled);276 await sendMessage({277 type: "UPDATE_SETTINGS",278 payload: { lockOnClose: enabled },279 });280 }281282 async function applyAutoLockMinutes(minutes: number) {283 setAutoLockMinutes(minutes);284 await sendMessage({285 type: "UPDATE_SETTINGS",286 payload: { autoLockMinutes: minutes },287 });288 }289290 async function applyBreachMonitoring(enabled: boolean) {291 setBreachMonitoring(enabled);292 await sendMessage({293 type: "UPDATE_SETTINGS",294 payload: { breachMonitoring: enabled },295 });296 }297298 async function applyMobileStatusBar(nextTheme: "dark" | "light") {299 try {300 await StatusBar.setStyle({ style: nextTheme === "light" ? Style.Light : Style.Dark });301 await StatusBar.setBackgroundColor({302 color: nextTheme === "light" ? "#EEE3CC" : "#0C0A06",303 });304 } catch {305 306 }307 }308309 function handleBackNavigation() {310 if (showShortcutsHelp()) {311 setShowShortcutsHelp(false);312 return;313 }314 if (restoreView() !== null) {315 setRestoreView(null);316 return;317 }318319 switch (view()) {320 case "list":321 setView("entry");322 return;323 case "settings":324 case "add":325 case "import":326 handleBack();327 return;328 case "export":329 if (returnToPanic()) {330 setReturnToPanic(false);331 setView("panic");332 } else {333 handleBack();334 }335 return;336 case "health":337 case "panic":338 setView("settings");339 return;340 case "trash":341 setView("list");342 return;343 case "entry": {344 const now = Date.now();345 if (now - lastBackExitAt < 1600) {346 void CapacitorApp.exitApp();347 return;348 }349 lastBackExitAt = now;350 setBackExitNotice(true);351 window.setTimeout(() => setBackExitNotice(false), 1400);352 return;353 }354 default:355 void CapacitorApp.exitApp();356 }357 }358359 onMount(async () => {360 if (Capacitor.isNativePlatform()) {361 document.body.classList.add("peach-mobile");362 document.documentElement.classList.add("peach-mobile-root");363 void applyMobileStatusBar(theme());364365 const keyboardShow = await Keyboard.addListener("keyboardWillShow", (info) => {366 document.body.style.paddingBottom = `${info.keyboardHeight}px`;367 });368 const keyboardHide = await Keyboard.addListener("keyboardWillHide", () => {369 document.body.style.paddingBottom = "0";370 });371 const backButton = await CapacitorApp.addListener("backButton", () => {372 handleBackNavigation();373 });374375 let touchStartX = 0;376 let touchStartY = 0;377 const handleTouchStart = (event: TouchEvent) => {378 const touch = event.touches[0];379 if (!touch) return;380 touchStartX = touch.clientX;381 touchStartY = touch.clientY;382 };383 const handleTouchEnd = (event: TouchEvent) => {384 const touch = event.changedTouches[0];385 if (!touch) return;386 const dx = touch.clientX - touchStartX;387 const dy = Math.abs(touch.clientY - touchStartY);388 if (touchStartX < 30 && dx > 60 && dy < 40) {389 handleBackNavigation();390 }391 };392 document.addEventListener("touchstart", handleTouchStart, { passive: true });393 document.addEventListener("touchend", handleTouchEnd, { passive: true });394395 onCleanup(() => {396 void keyboardShow.remove();397 void keyboardHide.remove();398 void backButton.remove();399 document.removeEventListener("touchstart", handleTouchStart);400 document.removeEventListener("touchend", handleTouchEnd);401 document.body.style.paddingBottom = "0";402 });403 }404405 406 407 408 409 410 const [unlockResponse, vaultResponse, , celebrationResponse] = await Promise.all([411 sendMessage({ type: "IS_UNLOCKED" }),412 sendMessage({ type: "HAS_VAULT" }),413 refreshCurrentTab(),414 sendMessage({ type: "SHOULD_PLAY_CELEBRATION" }),415 ]);416 const unlocked = Boolean(417 (unlockResponse as { ok: boolean; data?: boolean }).data418 );419 const vaultExists = Boolean(420 (vaultResponse as { ok: boolean; data?: boolean }).data421 );422 const shouldCelebrate = Boolean(423 (celebrationResponse as { ok: boolean; data?: boolean }).data424 );425 setHasVault(vaultExists);426 427 428 429 try {430 const onboarded = await storageGet("peach_onboarded");431 const seen = onboarded === "true";432 if (vaultExists && !seen) {433 await storageSet("peach_onboarded", "true");434 setOnboarded(true);435 } else {436 setOnboarded(seen);437 }438 } catch {439 440 setOnboarded(true);441 }442 await Promise.all([restoreSettings(), refreshProStatus()]);443444 445 if (shouldCelebrate) {446 await sendMessage({ type: "MARK_CELEBRATION_PLAYED" });447 }448449 if (unlocked && vaultExists) {450 await openVault(undefined, shouldCelebrate);451 if (shouldCelebrate) {452 setView("pro-celebration");453 window.setTimeout(() => setView("entry"), 2500);454 }455 } else if (shouldCelebrate) {456 setPendingCelebration(true);457 }458459 await refreshPendingPasskey();460 await refreshIncomingPairing();461462 463 if (!Capacitor.isNativePlatform()) {464 const handleTabActivated = () => { void refreshCurrentTab(); };465 const handleTabUpdated = (_tabId: number, changeInfo: { url?: string; status?: string }) => {466 if (changeInfo.url || changeInfo.status === "complete") void refreshCurrentTab();467 };468 try {469 chrome.tabs.onActivated.addListener(handleTabActivated);470 chrome.tabs.onUpdated.addListener(handleTabUpdated);471 onCleanup(() => {472 chrome.tabs.onActivated.removeListener(handleTabActivated);473 chrome.tabs.onUpdated.removeListener(handleTabUpdated);474 });475 } catch {476 477 }478 }479480 setBootState("ready");481 document.getElementById("pre-lock")?.setAttribute("hidden", "true");482483 484 if (!Capacitor.isNativePlatform() && chrome.storage.session) {485 const session = await chrome.storage.session.get(["pendingProGate", "pendingProNotice"]) as486 Record<string, { feature?: string } | undefined>;487 if (session.pendingProGate?.feature) {488 await chrome.storage.session.remove("pendingProGate");489 setUpgradeHighlight((session.pendingProGate.feature as ProFeature) ?? null);490 setSettingsInitialSection("license");491 setView("settings");492 } else if (session.pendingProNotice?.feature) {493 await chrome.storage.session.remove("pendingProNotice");494 setPendingProNotice({ feature: session.pendingProNotice.feature ?? "" });495 }496 }497498 if (Capacitor.getPlatform() === "android") {499 try {500 const { pending } = await Autofill.checkPendingSave();501 if (pending) {502 const parsed = JSON.parse(pending) as {503 domain?: string;504 username?: string;505 password?: string;506 };507 if (parsed.username && parsed.password) {508 setPendingAutofillSave({509 domain: parsed.domain ?? "",510 username: parsed.username,511 password: parsed.password,512 });513 }514 }515 } catch {516 517 }518 }519520 521 522 523 524 void Promise.all([525 import("./views/Settings").catch(() => {}),526 import("./views/Import").catch(() => {}),527 import("./views/Export").catch(() => {}),528 import("./views/Health").catch(() => {}),529 import("./views/TrashView").catch(() => {}),530 ]);531532 533 534 535 if (!Capacitor.isNativePlatform()) {536 let popupPort: chrome.runtime.Port | null = null;537 try {538 popupPort = chrome.runtime.connect({ name: "popup" });539 } catch { }540 onCleanup(() => { try { popupPort?.disconnect(); } catch {} });541542 543 544 const handleRuntimeMessage = (msg: { type?: string; payload?: { feature?: ProFeature } }) => {545 if (msg?.type === "VAULT_LOCKED" && view() !== "lock") handleLock();546 if (msg?.type === "PRO_GATE_TRIGGERED") {547 setUpgradeHighlight(msg.payload?.feature ?? null);548 setSettingsInitialSection("license");549 setView("settings");550 }551 if (msg?.type === "INCOMING_PAIRING_REQUEST") {552 void refreshIncomingPairing();553 }554 };555 chrome.runtime.onMessage.addListener(handleRuntimeMessage);556 onCleanup(() => chrome.runtime.onMessage.removeListener(handleRuntimeMessage));557 }558559 560 561 562 const SHORTCUT_HANDLERS: Partial<Record<ShortcutAction, () => void>> = {563 copy_password: () => {564 const entry = selectedEntry();565 if (entry?.password) void popupCopy(entry.password, "Password").then((ok) => { if (ok) triggerRing(); });566 },567 copy_username: () => {568 const entry = selectedEntry();569 if (entry?.username) void popupCopy(entry.username, "Username").then((ok) => { if (ok) triggerRing(); });570 },571 copy_totp: () => {572 const entry = selectedEntry();573 if (!entry?.totp) return;574 try {575 const { code } = generateTOTP(entry.totp);576 void popupCopy(code, "2FA").then((ok) => { if (ok) triggerRing(); });577 } catch { }578 },579 new_entry: () => handleAdd(),580 edit_entry: () => {581 const entry = selectedEntry();582 583 584 if (!entry || isPasskeyOnly(entry)) return;585 setEditEntry(entry);586 setView("add");587 },588 delete_entry: () => {589 if (selectedEntry()) void handleDelete();590 },591 lock_vault: () => { void handleHeaderLock(); },592 search: () => openList(),593 nav_prev: () => navigate(-1),594 nav_next: () => navigate(1),595 jump_vault: () => setView("entry"),596 jump_settings: () => setView("settings"),597 show_help: () => setShowShortcutsHelp(true),598 };599600 601 602 603 const ENTRY_SCOPED: ReadonlySet<ShortcutAction> = new Set([604 "copy_password", "copy_username", "copy_totp",605 "edit_entry", "delete_entry", "nav_prev", "nav_next",606 ]);607608 const handleGlobalKeydown = (e: KeyboardEvent) => {609 const v = view();610 const inInput = (e.target as HTMLElement)?.tagName === "INPUT"611 || (e.target as HTMLElement)?.tagName === "TEXTAREA"612 || (e.target as HTMLElement)?.isContentEditable;613 const isPrintableSearchKey =614 e.key.length === 1 &&615 !e.ctrlKey &&616 !e.metaKey &&617 !e.altKey;618619 620 if (v === "pro-celebration") return;621622 623 624 if (showShortcutsHelp()) {625 if (e.key === "Escape") { e.preventDefault(); setShowShortcutsHelp(false); }626 return;627 }628629 630 if (e.key === "Escape") {631 if (v === "list") { setView("entry"); return; }632 if (v === "settings" || v === "import" || v === "export" || v === "add" || v === "health") { handleBack(); return; }633 }634635 636 637 638 const bindings = shortcutBindings();639 for (const action of Object.keys(bindings) as ShortcutAction[]) {640 const binding = bindings[action];641 if (!matchKeybinding(e, binding)) continue;642 643 644 const hasMod = binding.ctrl || binding.meta || binding.alt || binding.shift;645 if (!hasMod && binding.key.length === 1 && inInput) return;646 if (ENTRY_SCOPED.has(action) && v !== "entry") return;647 e.preventDefault();648 SHORTCUT_HANDLERS[action]?.();649 return;650 }651652 653 654 655 656 if (v === "entry" && !inInput && isPrintableSearchKey) {657 e.preventDefault();658 primeListSearch(e.key);659 return;660 }661 };662 window.addEventListener("keydown", handleGlobalKeydown);663 onCleanup(() => window.removeEventListener("keydown", handleGlobalKeydown));664665 if (!Capacitor.isNativePlatform()) {666 const handleStorageChanged = (667 changes: Record<string, chrome.storage.StorageChange>,668 areaName: string669 ) => {670 if (areaName !== "session") return;671 if (!Object.keys(changes).some((key) => key.startsWith("passkey_pending_"))) {672 return;673 }674 void refreshPendingPasskey();675 };676 chrome.storage.onChanged.addListener(handleStorageChanged);677 onCleanup(() => chrome.storage.onChanged.removeListener(handleStorageChanged));678 }679 });680681 async function refreshCurrentTab() {682 if (Capacitor.isNativePlatform()) return;683 try {684 const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });685 const url = tab?.url ?? tab?.pendingUrl ?? "";686 setCurrentTabDomain(url ? (extractDomain(url) ?? "") : "");687 } catch {688 setCurrentTabDomain("");689 }690 }691692 async function refreshPendingPasskey() {693 const res = await sendMessage({ type: "GET_PENDING_PASSKEY" });694 setPendingPasskey((res as { ok: boolean; data?: PendingPasskeyRequest | null }).data ?? null);695 }696697 async function refreshIncomingPairing() {698 const res = await sendMessage({ type: "GET_INCOMING_PAIRING_REQUEST" });699 const data = (res as { ok: boolean; data?: IncomingPairingRequest | null }).data ?? null;700 setIncomingPair(data);701 }702703 async function respondIncomingPairing(accept: boolean) {704 if (incomingPairResponding()) return;705 setIncomingPairResponding(true);706 await sendMessage({ type: "RESPOND_INCOMING_PAIRING", payload: { accept } });707 setIncomingPair(null);708 setIncomingPairResponding(false);709 }710711 712 713 714 createEffect(() => {715 const req = incomingPair();716 if (!req) return;717 const handle = window.setInterval(() => {718 setIncomingPairTick((tick) => tick + 1);719 if (Date.now() >= req.expiresAt) {720 setIncomingPair(null);721 window.clearInterval(handle);722 }723 }, 1000);724 onCleanup(() => window.clearInterval(handle));725 });726727 async function refreshProStatus() {728 const res = await sendMessage({ type: "GET_LICENSE" });729 const data = (res as { ok: boolean; data?: { valid?: boolean; plan?: string } }).data;730 setProStatus(Boolean(data?.valid && data?.plan === "pro"));731 }732733 async function restoreSettings() {734 const res = await sendMessage({ type: "GET_SETTINGS" });735 const s = (res as { ok: boolean; data?: any }).data ?? {};736 if (s.accentColor && ACCENT_COLORS.some(c => c.name === s.accentColor)) {737 setAccentColor(s.accentColor as AccentColorName);738 }739 setTheme(s.theme === "light" ? "light" : "dark");740 if (s.displayFont === "cormorant" || s.displayFont === "inter" || s.displayFont === "system") {741 setDisplayFont(s.displayFont);742 } else {743 setDisplayFont("cormorant-italic");744 }745 if (s.textSize === "small" || s.textSize === "large") {746 setTextSize(s.textSize);747 } else {748 setTextSize("medium");749 }750 setReduceMotion(s.reduceMotion === true);751 setLockOnClose(s.lockOnClose !== false);752 setAutoLockMinutes(typeof s.autoLockMinutes === "number" ? s.autoLockMinutes : 5);753 setBreachMonitoring(s.breachMonitoring !== false);754 setTrashRetentionDays(typeof s.trashRetentionDays === "number" ? s.trashRetentionDays : 30);755 setShortcutBindings(getActiveBindings(s.shortcuts));756 }757758 async function applyTrashRetention(days: number) {759 setTrashRetentionDays(days);760 await sendMessage({ type: "UPDATE_SETTINGS", payload: { trashRetentionDays: days } });761 }762763 function primeListSearch(seed: string) {764 setListSearchSeed(seed);765 setListSearchSeedNonce((value) => value + 1);766 openList();767 }768769 770 771 772 async function loadEntries(): Promise<VaultEntry[] | null> {773 const response = await sendMessage({ type: "GET_ENTRIES" });774 const res = response as { ok: boolean; data?: VaultEntry[]; error?: string };775776 777 778 779 780 if (!res.ok) {781 if (782 res.error === "vault locked" ||783 res.error === "SERVICE_WORKER_UNAVAILABLE" ||784 (typeof res.error === "string" && res.error.includes("locked"))785 ) {786 handleLock();787 return null; 788 }789 return [];790 }791792 const loadedEntries = res.data ?? [];793 setEntries(loadedEntries);794 void publishInMemoryVault(loadedEntries);795796 const currentId = selectedEntry()?.id;797 if (currentId) {798 setSelectedEntry(799 loadedEntries.find((entry) => entry.id === currentId) ?? loadedEntries[0] ?? null800 );801 }802803 return loadedEntries;804 }805806 async function openVault(preferredEntryId?: string, skipViewSet = false) {807 808 const retDays = trashRetentionDays();809 if (retDays > 0) {810 void sendMessage({811 type: "PURGE_EXPIRED_TRASH",812 payload: { retentionMs: retDays * 86_400_000 },813 });814 }815816 const loadedEntries = await loadEntries();817818 819 820 if (loadedEntries === null) return;821822 823 let nextSelectedEntry: VaultEntry | null = null;824 if (preferredEntryId) {825 nextSelectedEntry = loadedEntries.find((e) => e.id === preferredEntryId) ?? null;826 }827 if (!nextSelectedEntry) {828 const tabDomain = currentTabDomain();829 if (tabDomain) {830 nextSelectedEntry = loadedEntries.find((e) => {831 if (e.type === "login") {832 if (e.url && (extractDomain(e.url) ?? "") === tabDomain) return true;833 for (const extra of e.additionalUrls ?? []) {834 if ((extractDomain(extra) ?? "") === tabDomain) return true;835 }836 return false;837 }838 if (e.passkey?.rpId) return e.passkey.rpId === tabDomain;839 return false;840 }) ?? null;841 }842 }843 nextSelectedEntry ??= loadedEntries[0] ?? null;844845 setSelectedEntry(nextSelectedEntry);846 setEditEntry(undefined);847 setContentTransitioning(false);848 setContentPhase("enter");849 queueContentIdle();850 if (!skipViewSet) setView("entry");851 }852853 async function handleUnlock() {854 setHasVault(true);855 triggerPipPulse();856 await restoreSettings();857 const celebrating = pendingCelebration();858 if (celebrating) {859 await sendMessage({ type: "MARK_CELEBRATION_PLAYED" });860 setPendingCelebration(false);861 }862 await openVault(undefined, celebrating);863 if (celebrating) {864 setView("pro-celebration");865 window.setTimeout(() => setView("entry"), 2500);866 }867 }868869 function handleSelectEntry(entry: VaultEntry) {870 setSelectedEntry(entry);871 setContentTransitioning(false);872 setContentPhase("enter");873 queueContentIdle();874 setView("entry");875 }876877 function handleAdd() {878 setEditEntry(undefined);879 setView("add");880 }881882 async function handleDelete() {883 const entry = selectedEntry();884 if (!entry) return;885 await sendMessage({ type: "DELETE_ENTRY", payload: { id: entry.id } });886 const loadedEntries = await loadEntries() ?? [];887 setSelectedEntry(loadedEntries[0] ?? null);888 setView("entry");889 }890891 async function handleDeleteMany(ids: string[]) {892 for (const id of ids) {893 await sendMessage({ type: "DELETE_ENTRY", payload: { id } });894 }895 const loadedEntries = await loadEntries() ?? [];896 897 const stillExists = loadedEntries.find(e => e.id === selectedEntry()?.id);898 if (!stillExists) setSelectedEntry(loadedEntries[0] ?? null);899 }900901 async function handleSave(savedEntry?: VaultEntry) {902 await openVault(savedEntry?.id);903 }904905 async function savePendingAutofill() {906 const pending = pendingAutofillSave();907 if (!pending) return;908 const domain = pending.domain.trim();909 const response = await sendMessage({910 type: "ADD_ENTRY",911 payload: {912 type: "login",913 title: domain || "Saved login",914 url: domain ? `https://${domain}` : "",915 username: pending.username,916 password: pending.password,917 },918 });919 if ((response as { ok: boolean }).ok) {920 setPendingAutofillSave(null);921 await openVault((response as { data?: VaultEntry }).data?.id);922 }923 }924925 function handleBack() {926 setEditEntry(undefined);927 setView("entry");928 }929930 function handleLock() {931 clearCanarySuppressions();932 setEntries([]);933 setSelectedEntry(null);934 setEditEntry(undefined);935 setContentPhase("idle");936 setView("lock");937 void clearInMemoryVault();938 }939940 function handleHeaderLock() {941 942 943 944 handleLock();945 void sendMessage({ type: "LOCK" });946 }947948 function navigate(dir: number) {949 const allEntries = entries();950 if (allEntries.length === 0) return;951 const currentIndex = selectedIndex();952 const baseIndex = currentIndex >= 0 ? currentIndex : 0;953 const nextIndex = (baseIndex + dir + allEntries.length) % allEntries.length;954 setSelectedEntry(allEntries[nextIndex]);955 setContentPhase("enter");956 queueContentIdle();957 }958959 function openList() {960 setView("list");961 }962963 function openHealth() {964 setEditEntry(undefined);965 setView("health");966 }967968 function handleOpenFileImport() {969 setRestoreView("file");970 }971972 const isShellOverlayOpen = () => view() !== "entry" || restoreView() !== null;973974 function handleFixEntry(entry: VaultEntry) {975 976 977 if (isPasskeyOnly(entry)) {978 setSelectedEntry(entry);979 setView("entry");980 return;981 }982 setEditEntry(entry);983 setView("add");984 }985986 const isLockedView = () => view() === "lock";987988 async function handleApprovePendingPasskey() {989 const pending = pendingPasskey();990 if (!pending) return;991 if (pending.browser === "firefox" && pending.type === "create") {992 993 994 995 996 const { createFirefoxPasskey } = await import("./firefox-passkey");997 const result = await createFirefoxPasskey(pending);998 if (!result.ok) {999 console.warn("Peach Firefox passkey create failed:", result.error);1000 }1001 await sendMessage({ type: "DENY_PASSKEY", payload: { requestId: pending.requestId } });1002 setPendingPasskey(null);1003 void loadEntries();1004 return;1005 }1006 await sendMessage({ type: "APPROVE_PASSKEY", payload: { requestId: pending.requestId } });1007 setPendingPasskey(null);1008 }10091010 async function handleDenyPendingPasskey() {1011 const pending = pendingPasskey();1012 if (!pending) return;1013 await sendMessage({ type: "DENY_PASSKEY", payload: { requestId: pending.requestId } });1014 setPendingPasskey(null);1015 }10161017 function queueContentIdle(after?: () => void) {1018 if (contentPhaseTimer) window.clearTimeout(contentPhaseTimer);1019 contentPhaseTimer = window.setTimeout(() => {1020 setContentPhase("idle");1021 after?.();1022 }, ENTRY_TRANSITION_SETTLE_MS);1023 }10241025 return (1026 <div class="popup-root peach-theme">1027 <Show when={bootState() === "ready"}>1028 <Show1029 when={!pendingPasskey()}1030 fallback={1031 <PasskeyApprovalView1032 type={pendingPasskey()!.type}1033 rpName={pendingPasskey()!.rpName}1034 rpId={pendingPasskey()!.rpId}1035 userName={pendingPasskey()!.userName}1036 userDisplayName={pendingPasskey()!.userDisplayName}1037 onApprove={handleApprovePendingPasskey}1038 onDeny={handleDenyPendingPasskey}1039 />1040 }1041 >1042 <Show1043 when={!isLockedView()}1044 fallback={1045 <Show1046 when={onboarded() || hasVault()}1047 fallback={1048 <Onboarding1049 onComplete={() => { setOnboarded(true); }}1050 />1051 }1052 >1053 <LockView1054 hasVault={hasVault()}1055 ready={bootState() === "ready"}1056 isPro={proStatus()}1057 onUnlock={handleUnlock}1058 onBackToOnboarding={1059 !hasVault()1060 ? () => setOnboarded(false)1061 : undefined1062 }1063 />1064 </Show>1065 }1066 >1067 <Show1068 when={view() !== "pro-celebration"}1069 fallback={<ProCelebration />}1070 >1071 <section1072 id="hd-shell"1073 class="peach-shell peach-theme"1074 data-surface="extension"1075 >1076 <header class="peach-chrome" classList={{ "is-hidden-for-overlay": isShellOverlayOpen() }}>1077 <PeachWordmark unlocked />1078 <div class="peach-chrome-actions">1079 <button1080 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1081 onClick={() => setView("settings")}1082 aria-label="Settings"1083 >1084 <svg width="14" height="14" viewBox="0 0 14 14" fill="none">1085 <path1086 d="M5.91 1.11C6.38-.02 7.62-.02 8.09 1.11L8.31 1.64C8.48 2.05 8.91 2.27 9.34 2.17L9.9 2.04C11.1 1.76 11.98 2.64 11.7 3.84L11.57 4.4C11.47 4.83 11.69 5.26 12.1 5.43L12.63 5.65C13.76 6.12 13.76 7.36 12.63 7.83L12.1 8.05C11.69 8.22 11.47 8.65 11.57 9.08L11.7 9.64C11.98 10.84 11.1 11.72 9.9 11.44L9.34 11.31C8.91 11.21 8.48 11.43 8.31 11.84L8.09 12.37C7.62 13.5 6.38 13.5 5.91 12.37L5.69 11.84C5.52 11.43 5.09 11.21 4.66 11.31L4.1 11.44C2.9 11.72 2.02 10.84 2.3 9.64L2.43 9.08C2.53 8.65 2.31 8.22 1.9 8.05L1.37 7.83C.24 7.36.24 6.12 1.37 5.65L1.9 5.43C2.31 5.26 2.53 4.83 2.43 4.4L2.3 3.84C2.02 2.64 2.9 1.76 4.1 2.04L4.66 2.17C5.09 2.27 5.52 2.05 5.69 1.64L5.91 1.11Z"1087 stroke="currentColor"1088 stroke-width="0.9"1089 />1090 <circle cx="7" cy="7" r="2.1" stroke="currentColor" stroke-width="0.9" />1091 </svg>1092 </button>1093 <button1094 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1095 onClick={handleAdd}1096 aria-label="New entry"1097 >1098 <svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round">1099 <path d="M5.5 1v9M1 5.5h9" />1100 </svg>1101 </button>1102 <button1103 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn peach-lock-btn"1104 onClick={() => void handleHeaderLock()}1105 aria-label="Lock vault"1106 >1107 <svg class="peach-lock-icon" width="14" height="16" viewBox="0 0 14 16" fill="none">1108 <path1109 d="M3.75 6V4.75C3.75 2.96 5.21 1.5 7 1.5C8.79 1.5 10.25 2.96 10.25 4.75V6"1110 stroke="currentColor"1111 stroke-width="1"1112 stroke-linecap="round"1113 />1114 <rect x="1.5" y="6" width="11" height="8.5" rx="2.2" stroke="currentColor" stroke-width="1" />1115 <circle cx="7" cy="10.25" r="1" fill="currentColor" />1116 </svg>1117 </button>1118 </div>1119 </header>11201121 <Show when={incomingPair() !== null}>1122 <div class="peach-pair-request-banner" role="dialog" aria-label="Pairing request">1123 <div class="peach-pair-request-header">1124 <span class="peach-pair-request-mark">🍑</span>1125 <span class="peach-pair-request-title">Pairing request</span>1126 <span class="peach-pair-request-countdown">{incomingPairSecondsLeft()}s</span>1127 </div>1128 <p class="peach-pair-request-body">1129 <strong>{incomingPair()!.deviceName}</strong> wants to sync with this Peach.1130 </p>1131 <div class="peach-pair-request-actions">1132 <button1133 class="peach-btn peach-btn--ghost peach-btn--sm"1134 onClick={() => void respondIncomingPairing(false)}1135 disabled={incomingPairResponding()}1136 >1137 Reject1138 </button>1139 <button1140 class="peach-btn peach-btn--accent peach-btn--sm"1141 onClick={() => void respondIncomingPairing(true)}1142 disabled={incomingPairResponding()}1143 >1144 Accept1145 </button>1146 </div>1147 </div>1148 </Show>11491150 <Show when={pendingProNotice() !== null}>1151 <div class="peach-pro-notice-banner">1152 <span>✦ {pendingProNotice()?.feature === "sync" ? "Sync" : "A Pro feature"} requires Peach Pro</span>1153 <button1154 class="peach-pro-notice-link"1155 onClick={() => {1156 setUpgradeHighlight((pendingProNotice()?.feature as ProFeature) ?? null);1157 setSettingsInitialSection("license");1158 setView("settings");1159 setPendingProNotice(null);1160 }}1161 >1162 Learn more →1163 </button>1164 <button class="peach-pro-notice-close" onClick={() => setPendingProNotice(null)} aria-label="Dismiss">✕</button>1165 </div>1166 </Show>11671168 <Show when={pendingAutofillSave() !== null && !isLockedView()}>1169 <div class="peach-pro-notice-banner peach-autofill-save-banner">1170 <span>1171 Save login{pendingAutofillSave()?.domain ? ` for ${pendingAutofillSave()!.domain}` : ""}?1172 </span>1173 <button1174 class="peach-pro-notice-link"1175 onClick={() => void savePendingAutofill()}1176 >1177 Save1178 </button>1179 <button1180 class="peach-pro-notice-close"1181 onClick={() => setPendingAutofillSave(null)}1182 aria-label="Dismiss"1183 >1184 x1185 </button>1186 </div>1187 </Show>11881189 <Show when={backExitNotice()}>1190 <div class="peach-pro-notice-banner peach-back-exit-banner">1191 <span>Tap back again to exit Peach</span>1192 </div>1193 </Show>11941195 <div class="peach-shell-body">1196 <div class="peach-shell-veil"></div>1197 <div class="peach-content-frame" data-content-phase={contentPhase()} classList={{ navigating: contentTransitioning() }}>1198 <EntryView1199 entry={selectedEntry()}1200 onDelete={handleDelete}1201 onFieldSaved={() => void loadEntries()}1202 onEscape={() => { setView("list"); }}1203 />1204 </div>12051206 <section class="peach-search-wrap" classList={{ "is-hidden-for-overlay": isShellOverlayOpen() }}>1207 <div class="peach-search-bar">1208 <span class="peach-search-icon">1209 <svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round">1210 <circle cx="5.5" cy="5.5" r="3.75" />1211 <path d="M8.75 8.75L11.5 11.5" />1212 </svg>1213 </span>1214 <input1215 class="peach-search-input"1216 placeholder="search vault..."1217 autocomplete="off"1218 aria-label="Search vault entries"1219 onClick={openList}1220 onFocus={openList}1221 readOnly1222 />1223 <div class="peach-search-meta">1224 <span class="peach-search-counter">1225 {entries().length > 01226 ? `${selectedIndex() + 1} / ${entries().length}`1227 : "0 entries"}1228 </span>1229 <span class="peach-divider"></span>1230 <button1231 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1232 onClick={() => navigate(-1)}1233 aria-label="Previous entry"1234 disabled={entries().length === 0}1235 >1236 <svg width="6" height="11" viewBox="0 0 6 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">1237 <path d="M5 1L1 5.5L5 10" />1238 </svg>1239 </button>1240 <button1241 class="peach-btn peach-btn--ghost peach-btn--sm peach-icon-btn"1242 onClick={() => navigate(1)}1243 aria-label="Next entry"1244 disabled={entries().length === 0}1245 >1246 <svg width="6" height="11" viewBox="0 0 6 11" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round">1247 <path d="M1 1L5 5.5L1 10" />1248 </svg>1249 </button>1250 </div>1251 </div>1252 </section>1253 </div>12541255 <Show when={view() === "list"}>1256 <VaultView1257 entries={entries()}1258 selectedEntryId={selectedEntry()?.id}1259 currentTabDomain={currentTabDomain()}1260 sortOrder={sortOrder()}1261 searchSeed={listSearchSeed()}1262 searchSeedNonce={listSearchSeedNonce()}1263 onSelectEntry={handleSelectEntry}1264 onSortOrderChange={setSortOrder}1265 onAdd={handleAdd}1266 onClose={() => setView("entry")}1267 onOpenTrash={() => setView("trash")}1268 onDeleteMany={handleDeleteMany}1269 />1270 </Show>1271 <Show when={view() === "settings"}>1272 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1273 <SettingsView1274 entriesCount={entries().length}1275 breachMonitoring={breachMonitoring()}1276 lockOnClose={lockOnClose()}1277 autoLockMinutes={autoLockMinutes()}1278 trashRetentionDays={trashRetentionDays()}1279 theme={theme()}1280 accentColor={accentColor()}1281 displayFont={displayFont()}1282 textSize={textSize()}1283 reduceMotion={reduceMotion()}1284 isPro={proStatus()}1285 initialSection={settingsInitialSection()}1286 upgradeHighlight={upgradeHighlight()}1287 onBreachMonitoringChange={applyBreachMonitoring}1288 onLockOnCloseChange={applyLockOnClose}1289 onAutoLockMinutesChange={applyAutoLockMinutes}1290 onTrashRetentionChange={applyTrashRetention}1291 onThemeChange={applyTheme}1292 onAccentChange={applyAccentColor}1293 onDisplayFontChange={applyDisplayFont}1294 onTextSizeChange={applyTextSize}1295 onReduceMotionChange={applyReduceMotion}1296 shortcuts={shortcutBindings()}1297 onShortcutsChange={applyShortcuts}1298 onLicenseChange={async () => {1299 1300 1301 1302 1303 1304 await refreshProStatus();1305 void loadEntries();1306 const should = await sendMessage({ type: "SHOULD_PLAY_CELEBRATION" });1307 if ((should as { ok: boolean; data?: boolean }).data === true) {1308 await sendMessage({ type: "MARK_CELEBRATION_PLAYED" });1309 setView("pro-celebration");1310 window.setTimeout(() => setView("settings"), 2500);1311 }1312 }}1313 onBack={() => { setSettingsInitialSection(null); setUpgradeHighlight(null); handleBack(); }}1314 onImport={() => setView("import")}1315 onExport={() => setView("export")}1316 onBreachCheckDone={loadEntries}1317 onOpenHealth={openHealth}1318 onOpenFileImport={handleOpenFileImport}1319 onOpenPanic={() => setView("panic")}1320 />1321 </Suspense>1322 </Show>1323 <Show when={view() === "add"}>1324 <AddView1325 entry={editEntry()}1326 entries={entries()}1327 onBack={handleBack}1328 onSave={handleSave}1329 />1330 </Show>1331 <Show when={view() === "import"}>1332 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1333 <ImportView onBack={handleBack} onImport={handleSave} />1334 </Suspense>1335 </Show>1336 <Show when={view() === "export"}>1337 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1338 <ExportView1339 onBack={() => {1340 if (returnToPanic()) {1341 setReturnToPanic(false);1342 setView("panic");1343 } else {1344 handleBack();1345 }1346 }}1347 />1348 </Suspense>1349 </Show>1350 <Show when={view() === "panic"}>1351 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1352 <PanicView1353 onCancel={() => setView("settings")}1354 onOpenExport={() => {1355 setReturnToPanic(true);1356 setView("export");1357 }}1358 onDestroyed={async () => {1359 clearCanarySuppressions();1360 setEntries([]);1361 setSelectedEntry(null);1362 setEditEntry(undefined);1363 setHasVault(false);1364 setOnboarded(false);1365 setProStatus(false);1366 setPendingPasskey(null);1367 setUpgradeHighlight(null);1368 setSettingsInitialSection(null);1369 setPendingProNotice(null);1370 setPendingCelebration(false);1371 setReturnToPanic(false);1372 setContentPhase("idle");1373 setView("lock");1374 void clearInMemoryVault();1375 }}1376 />1377 </Suspense>1378 </Show>1379 <Show when={view() === "health"}>1380 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1381 <HealthView1382 entries={entries()}1383 isPro={proStatus()}1384 onFixEntry={handleFixEntry}1385 onBack={() => setView("settings")}1386 onRefresh={loadEntries}1387 />1388 </Suspense>1389 </Show>1390 <Show when={view() === "trash"}>1391 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1392 <TrashView1393 onBack={() => setView("list")}1394 onRestored={() => void loadEntries()}1395 />1396 </Suspense>1397 </Show>1398 <Show when={restoreView() === "file"}>1399 <Suspense fallback={<div class="peach-loading"><PeachWordmark /></div>}>1400 <ImportView1401 mode="onboarding"1402 replacesExistingVault={true}1403 onBack={() => setRestoreView(null)}1404 onImport={async () => {1405 setRestoreView(null);1406 await handleUnlock();1407 }}1408 />1409 </Suspense>1410 </Show>1411 </section>1412 </Show>1413 </Show>1414 </Show>1415 </Show>1416 <Show when={showShortcutsHelp()}>1417 <ShortcutsHelpOverlay1418 bindings={shortcutBindings()}1419 onClose={() => setShowShortcutsHelp(false)}1420 />1421 </Show>1422 </div>1423 );1424}14251426function ShortcutsHelpOverlay(props: {1427 bindings: Record<ShortcutAction, Keybinding>;1428 onClose: () => void;1429}) {1430 return (1431 <div class="peach-shortcuts-help-backdrop" onClick={props.onClose}>1432 <div class="peach-shortcuts-help-card" onClick={(e) => e.stopPropagation()}>1433 <div class="peach-shortcuts-help-head">1434 <h3>Keyboard shortcuts</h3>1435 <button class="peach-shortcuts-help-close" onClick={props.onClose} aria-label="Close">✕</button>1436 </div>1437 <div class="peach-shortcuts-help-body">1438 <p class="peach-settings-sub-label">ENTRY VIEW</p>1439 <ul>1440 {SHORTCUT_DESCRIPTORS.filter((d) => d.scope === "entry").map((d) => (1441 <li>1442 <span>{d.label}</span>1443 <kbd>{formatKeybinding(props.bindings[d.action])}</kbd>1444 </li>1445 ))}1446 </ul>1447 <p class="peach-settings-sub-label">ANYWHERE</p>1448 <ul>1449 {SHORTCUT_DESCRIPTORS.filter((d) => d.scope === "global").map((d) => (1450 <li>1451 <span>{d.label}</span>1452 <kbd>{formatKeybinding(props.bindings[d.action])}</kbd>1453 </li>1454 ))}1455 </ul>1456 </div>1457 </div>1458 </div>1459 );1460}