atmosphere explorer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add create/edit record shortcuts

Juliet ded40009 fe4c5de3

+31 -2
+31 -2
src/components/create.tsx
··· 4 4 import { getSession, OAuthUserAgent } from "@atcute/oauth-browser-client"; 5 5 import { remove } from "@mary/exif-rm"; 6 6 import { useNavigate, useParams } from "@solidjs/router"; 7 - import { createEffect, createSignal, For, lazy, onCleanup, Show, Suspense } from "solid-js"; 7 + import { 8 + createEffect, 9 + createSignal, 10 + For, 11 + lazy, 12 + onCleanup, 13 + onMount, 14 + Show, 15 + Suspense, 16 + } from "solid-js"; 8 17 import { hasUserScope } from "../auth/scope-utils"; 9 18 import { agent, sessions } from "../auth/state"; 10 19 import { Button } from "./button.jsx"; ··· 44 53 document.addEventListener("mousedown", handleClickOutside); 45 54 onCleanup(() => document.removeEventListener("mousedown", handleClickOutside)); 46 55 } 56 + }); 57 + 58 + onMount(() => { 59 + const keyEvent = (ev: KeyboardEvent) => { 60 + if (ev.target instanceof HTMLInputElement || ev.target instanceof HTMLTextAreaElement) return; 61 + 62 + const key = props.create ? "n" : "e"; 63 + if (ev.key === key) { 64 + ev.preventDefault(); 65 + 66 + if (openDialog() && isMinimized()) { 67 + setIsMinimized(false); 68 + } else if (!openDialog() && !document.querySelector("[data-modal]")) { 69 + setOpenDialog(true); 70 + } 71 + } 72 + }; 73 + 74 + window.addEventListener("keydown", keyEvent); 75 + onCleanup(() => window.removeEventListener("keydown", keyEvent)); 47 76 }); 48 77 49 78 const defaultPlaceholder = () => { ··· 517 546 <span class="text-sm font-medium">{props.create ? "Creating" : "Editing"} record</span> 518 547 </button> 519 548 </Show> 520 - <Tooltip text={`${props.create ? "Create" : "Edit"} record`}> 549 + <Tooltip text={props.create ? "Create record (n)" : "Edit record (e)"}> 521 550 <button 522 551 class={`flex items-center p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600 ${props.create ? "rounded-lg" : "rounded-sm"}`} 523 552 onclick={() => {