diff --git a/src/components/permission-button.tsx b/src/components/permission-button.tsx
index 1bd281c..24db7f7 100644
--- a/src/components/permission-button.tsx
+++ b/src/components/permission-button.tsx
@@ -5,7 +5,7 @@ import Tooltip from "./tooltip";
export interface PermissionButtonProps {
scope: "create" | "update" | "delete" | "blob";
- tooltip: string;
+ tooltip?: string;
class?: string;
disabledClass?: string;
onClick: () => void;
@@ -28,11 +28,16 @@ export const PermissionButton = (props: PermissionButtonProps) => {
"flex items-center rounded-sm p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600";
const disabledClass = props.disabledClass || "flex items-center rounded-sm p-1.5 opacity-40";
- return (
-
{blobs()?.length} blob{(blobs()?.length ?? 0 > 1) ? "s" : ""}
diff --git a/src/views/collection.tsx b/src/views/collection.tsx index d247da0..3fedba4 100644 --- a/src/views/collection.tsx +++ b/src/views/collection.tsx @@ -4,7 +4,7 @@ import { $type, ActorIdentifier, InferXRPCBodyOutput } from "@atcute/lexicons"; import * as TID from "@atcute/tid"; import { Title } from "@solidjs/meta"; import { A, useBeforeLeave, useParams, useSearchParams } from "@solidjs/router"; -import { createMemo, createResource, createSignal, For, onMount, Show } from "solid-js"; +import { createMemo, createResource, createSignal, For, onCleanup, onMount, Show } from "solid-js"; import { createStore } from "solid-js/store"; import { agent } from "../auth/state"; import { Button } from "../components/button.jsx"; @@ -13,9 +13,8 @@ import { JSONType, JSONValue } from "../components/json.jsx"; import { Modal } from "../components/modal.jsx"; import { addNotification, removeNotification } from "../components/notification.jsx"; import { PermissionButton } from "../components/permission-button.jsx"; -import { StickyOverlay } from "../components/sticky.jsx"; -import { TextInput } from "../components/text-input.jsx"; import Tooltip from "../components/tooltip.jsx"; +import { canHover } from "../layout.jsx"; import { resolvePDS } from "../utils/api.js"; import { localDateFromTimestamp } from "../utils/date.js"; import { @@ -85,6 +84,7 @@ const CollectionView = () => { const did = params.repo; let pds: string; let rpc: Client; + let filterInputRef: HTMLInputElement | undefined; const cacheKey = () => `${params.pds}/${params.repo}/${params.collection}`; @@ -103,6 +103,19 @@ const CollectionView = () => { window.scrollTo(0, cached.scrollY); }); } + + const handleKeyDown = (e: KeyboardEvent) => { + if ( + e.key === "/" && + !["INPUT", "TEXTAREA"].includes((e.target as HTMLElement)?.tagName) && + !document.querySelector("[data-modal]") + ) { + e.preventDefault(); + filterInputRef?.focus(); + } + }; + document.addEventListener("keydown", handleKeyDown); + onCleanup(() => document.removeEventListener("keydown", handleKeyDown)); }); useBeforeLeave((e) => { @@ -241,190 +254,231 @@ const CollectionView = () => { <>
{repos()?.length} loaded