···
import { ActorIdentifier, Did, Handle, Nsid } from "@atcute/lexicons";
import { A, useLocation, useNavigate, useParams } from "@solidjs/router";
···
const did = params.repo!;
61
+
// Handle scrolling to a collection group when hash is like #collections:app.bsky
62
+
createEffect(() => {
63
+
const hash = location.hash;
64
+
if (hash.startsWith("#collections:")) {
65
+
const authority = hash.slice(13);
66
+
requestAnimationFrame(() => {
67
+
const element = document.getElementById(`collection-${authority}`);
68
+
if (element) element.scrollIntoView({ behavior: "instant", block: "start" });
const RepoTab = (props: {
tab: "collections" | "backlinks" | "identity" | "blobs" | "logs";
64
-
<A class="flex items-center" href={`/at://${params.repo}#${props.tab}`}>
67
-
"flex items-center border-b-2": true,
68
-
"border-transparent hover:border-neutral-400 dark:hover:border-neutral-600":
69
-
(location.hash !== `#${props.tab}` && !!location.hash) ||
71
-
((!error() && props.tab !== "collections") ||
72
-
(!!error() && props.tab !== "identity"))),
77
+
const isActive = () => {
78
+
if (!location.hash) {
79
+
if (!error() && props.tab === "collections") return true;
80
+
if (!!error() && props.tab === "identity") return true;
83
+
if (props.tab === "collections")
84
+
return location.hash === "#collections" || location.hash.startsWith("#collections:");
85
+
return location.hash === `#${props.tab}`;
89
+
<A class="flex items-center" href={`/at://${params.repo}#${props.tab}`}>
92
+
"flex items-center border-b-2": true,
93
+
"border-transparent hover:border-neutral-400 dark:hover:border-neutral-600":
const getRotationKeys = async () => {
···
274
-
<Show when={!error() && (!location.hash || location.hash === "#collections")}>
297
+
<Show when={!error() && (!location.hash || location.hash.startsWith("#collections"))}>
<Tooltip text="Filter collections">
class="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"
···
373
-
<Show when={nsids() && (!location.hash || location.hash === "#collections")}>
396
+
<Show when={nsids() && (!location.hash || location.hash.startsWith("#collections"))}>
<Show when={showFilter()}>
···
386
-
class="flex flex-col overflow-hidden text-sm"
387
-
classList={{ "-mt-1": !showFilter() }}
408
+
<div class="flex flex-col text-sm wrap-anywhere" classList={{ "-mt-1": !showFilter() }}>
each={Object.keys(nsids() ?? {}).filter((authority) =>
···
const reversedDomain = authority.split(".").reverse().join(".");
const [faviconLoaded, setFaviconLoaded] = createSignal(false);
423
+
const isHighlighted = () => location.hash === `#collections:${authority}`;
404
-
<div class="dark:hover:bg-dark-200 flex items-start gap-2 rounded-lg p-1 hover:bg-neutral-200">
405
-
<div class="flex h-5 w-4 shrink-0 items-center justify-center">
427
+
id={`collection-${authority}`}
428
+
class="group flex items-start gap-2 rounded-lg p-1 transition-colors"
430
+
"dark:hover:bg-dark-200 hover:bg-neutral-200": !isHighlighted(),
431
+
"bg-blue-100 dark:bg-blue-500/25": isHighlighted(),
435
+
href={`#collections:${authority}`}
436
+
class="relative flex h-5 w-4 shrink-0 items-center justify-center hover:opacity-70"
438
+
<span class="iconify lucide--link absolute top-1/2 -left-5 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100" />
<Show when={!faviconLoaded()}>
<span class="iconify lucide--globe size-4 text-neutral-400 dark:text-neutral-500" />
···
onLoad={() => setFaviconLoaded(true)}
onError={() => setFaviconLoaded(false)}
<div class="flex flex-1 flex-col">
each={nsids()?.[authority].nsids.filter((nsid) =>