birdclaw 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +10 -8
- package/bin/birdclaw.mjs +4 -66
- package/dist/cli/birdclaw.js +28165 -0
- package/dist/client/assets/AvatarChip-DLoqM5xD.js +1 -0
- package/dist/client/assets/ProfilePreview-BejAuYsJ.js +1 -0
- package/dist/client/assets/SavedTimelineView-BIS7HKpp.js +1 -0
- package/dist/client/assets/SmartTimestamp-BR0-9se2.js +1 -0
- package/dist/client/assets/TimelineRouteFrame-CyGPj0eM.js +1 -0
- package/dist/client/assets/blocks-7UDKQp8H.js +1 -0
- package/dist/client/assets/bookmarks-CbBkMvXk.js +1 -0
- package/dist/client/assets/chunk-C0phanGV.js +1 -0
- package/dist/client/assets/circle-check-C_Vq3ElD.js +1 -0
- package/dist/client/assets/client-stream-contracts-ys3XhWG4.js +5 -0
- package/dist/client/assets/createLucideIcon-JV8isFFR.js +1 -0
- package/dist/client/assets/data-sources-Cm2bpNvg.js +1 -0
- package/dist/client/assets/discuss-DTjaOugw.js +1 -0
- package/dist/client/assets/dms-CGd6Eogq.js +1 -0
- package/dist/client/assets/inbox-BHlGuOy2.js +1 -0
- package/dist/client/assets/index-CEIG7S6s.js +31 -0
- package/dist/client/assets/index-bpFrQ5yG.css +1 -0
- package/dist/client/assets/likes-cLrcAQem.js +1 -0
- package/dist/client/assets/links-CM9QO1LC.js +1 -0
- package/dist/client/assets/mapbox-BxTlqXt9.js +2 -0
- package/dist/client/assets/mapbox-gl-dgf_hX3a.js +3215 -0
- package/dist/client/assets/mentions-CxKCgzIf.js +1 -0
- package/dist/client/assets/network-map-B5a3whqj.js +2 -0
- package/dist/client/assets/profile-analyze-CRtNEwlb.js +1 -0
- package/dist/client/assets/profile-hydration-client-YEtJsNTv.js +1 -0
- package/dist/client/assets/profiles._handle-C82_HoKX.js +1 -0
- package/dist/client/assets/query-client-fYu2rzRC.js +17 -0
- package/dist/client/assets/rate-limits-ScaEwdVK.js +1 -0
- package/dist/client/assets/react-dom-DHl6Ug7F.js +1 -0
- package/dist/client/assets/react-nBylq1U5.js +1 -0
- package/dist/client/assets/repeat-2-xCwHM9hD.js +1 -0
- package/dist/client/assets/routes-q7ZaW4En.js +1 -0
- package/dist/client/assets/schemas-I9r6F6ya.js +64 -0
- package/dist/client/assets/search-Dq5kYsxA.js +1 -0
- package/dist/client/assets/sparkles-CQVlvHsZ.js +1 -0
- package/dist/client/assets/styles-B8s3tt3r.css +2 -0
- package/dist/client/assets/today-CeG1O7Py.js +1 -0
- package/dist/client/assets/triangle-alert-CBL7s2pf.js +1 -0
- package/dist/client/assets/useTimelineRouteData-1HsqgvUi.js +1 -0
- package/dist/client/assets/users-CHbKlqUr.js +1 -0
- package/dist/server/assets/AvatarChip-zUDAEmjL.js +105 -0
- package/dist/server/assets/FeedState-ntW0Q2GB.js +214 -0
- package/dist/server/assets/ProfileAnalysisStream-BFvhVdhn.js +198 -0
- package/dist/server/assets/ProfilePreview-C6gAor_j.js +752 -0
- package/dist/server/assets/SavedTimelineView-BG1jnBp1.js +64 -0
- package/dist/server/assets/SmartTimestamp-DfwE1NGf.js +45 -0
- package/dist/server/assets/SyncNowButton-BOn_IBXS.js +76 -0
- package/dist/server/assets/TimelineRouteFrame-CU7ilM7U.js +85 -0
- package/dist/server/assets/TweetRichText-DhCVv1-6.js +74 -0
- package/dist/server/assets/_tanstack-start-manifest_v-C-ZRnG_n.js +148 -0
- package/dist/server/assets/account-selection-CTdFGWRk.js +44 -0
- package/dist/server/assets/blocks-C1mgGTB3.js +299 -0
- package/dist/server/assets/blocks-DSgQghqP.js +17 -0
- package/dist/server/assets/bookmarks-BJN8tykY.js +14 -0
- package/dist/server/assets/client-stream-contracts-C2xbWVjm.js +769 -0
- package/dist/server/assets/data-sources-BnA1Q94p.js +180 -0
- package/dist/server/assets/discuss-CJ1dau1j.js +15 -0
- package/dist/server/assets/discuss-QTo08NCN.js +338 -0
- package/dist/server/assets/dms-BuLj4bp8.js +368 -0
- package/dist/server/assets/dms-DAyQrVM2.js +240 -0
- package/dist/server/assets/empty-plugin-adapters-DzrEkdBF.js +5 -0
- package/dist/server/assets/inbox-CkGOaW1q.js +214 -0
- package/dist/server/assets/inbox-DpWd1EzC.js +146 -0
- package/dist/server/assets/likes-DBOAtsJU.js +14 -0
- package/dist/server/assets/links-DAhSjynu.js +240 -0
- package/dist/server/assets/links-DmH5lxHO.js +468 -0
- package/dist/server/assets/mentions-BH2MzKtB.js +26 -0
- package/dist/server/assets/network-map-D3CzRcC4.js +224 -0
- package/dist/server/assets/network-map-D5DoLOwR.js +582 -0
- package/dist/server/assets/profile-analyze-BP65PED0.js +90 -0
- package/dist/server/assets/profile-analyze-C1NoM0tV.js +9 -0
- package/dist/server/assets/profile-hydration-client-GJ4kwJS8.js +133 -0
- package/dist/server/assets/profiles._handle-DjwlN_ac.js +184 -0
- package/dist/server/assets/profiles._handle-DsLNj2Ca.js +12 -0
- package/dist/server/assets/query-client-BdauHBgd.js +923 -0
- package/dist/server/assets/rate-limits-VAr2qzYD.js +262 -0
- package/dist/server/assets/route-search-BUlQ5lGM.js +117 -0
- package/dist/server/assets/router-DqkwSPiM.js +17026 -0
- package/dist/server/assets/routes-A9c9ZhwN.js +26 -0
- package/dist/server/assets/start-FaDOTmto.js +4 -0
- package/dist/server/assets/today-B5hVM57Z.js +17 -0
- package/dist/server/assets/today-fvGiZ7ud.js +303 -0
- package/dist/server/assets/ui-qbmcMSSX.js +137 -0
- package/{src/components/useDebouncedValue.ts → dist/server/assets/useDebouncedValue-DOnA6Xcy.js} +4 -4
- package/dist/server/assets/useTimelineRouteData-27cxynxa.js +1101 -0
- package/dist/server/server.js +5520 -0
- package/package.json +27 -34
- package/playwright.config.ts +0 -35
- package/scripts/browser-perf.mjs +0 -427
- package/scripts/build-docs-site.mjs +0 -967
- package/scripts/docs-site-assets.mjs +0 -311
- package/scripts/run-vitest.mjs +0 -21
- package/scripts/sanitize-node-options.mjs +0 -23
- package/scripts/start-test-server.mjs +0 -42
- package/src/cli-moderation.ts +0 -210
- package/src/cli.ts +0 -2336
- package/src/components/AccountSwitcher.tsx +0 -186
- package/src/components/AppNav.tsx +0 -118
- package/src/components/AvatarChip.tsx +0 -58
- package/src/components/BrandMark.tsx +0 -67
- package/src/components/ConversationThread.tsx +0 -131
- package/src/components/DmWorkspace.tsx +0 -286
- package/src/components/EmbeddedTweetCard.tsx +0 -55
- package/src/components/FeedState.tsx +0 -147
- package/src/components/FloatingPreview.tsx +0 -382
- package/src/components/InboxCard.tsx +0 -152
- package/src/components/LinkPreviewCard.tsx +0 -292
- package/src/components/MarkdownViewer.tsx +0 -777
- package/src/components/ProfileAnalysisStream.tsx +0 -428
- package/src/components/ProfilePreview.tsx +0 -129
- package/src/components/SavedTimelineView.tsx +0 -155
- package/src/components/SmartTimestamp.tsx +0 -72
- package/src/components/SyncNowButton.tsx +0 -140
- package/src/components/ThemeSlider.tsx +0 -80
- package/src/components/TimelineCard.tsx +0 -533
- package/src/components/TimelineRouteFrame.tsx +0 -186
- package/src/components/TweetArticleCard.tsx +0 -66
- package/src/components/TweetMediaGrid.tsx +0 -185
- package/src/components/TweetRichText.tsx +0 -159
- package/src/components/account-selection.ts +0 -64
- package/src/components/useTimelineRouteData.ts +0 -323
- package/src/lib/account-sync-job.ts +0 -666
- package/src/lib/actions-transport.ts +0 -300
- package/src/lib/api-client.ts +0 -419
- package/src/lib/archive-finder.ts +0 -185
- package/src/lib/archive-import.ts +0 -2764
- package/src/lib/authored-live.ts +0 -1072
- package/src/lib/avatar-cache.ts +0 -349
- package/src/lib/backup.ts +0 -2741
- package/src/lib/bird-actions.ts +0 -294
- package/src/lib/bird-command.ts +0 -130
- package/src/lib/bird.ts +0 -1140
- package/src/lib/blocklist.ts +0 -136
- package/src/lib/blocks-write.ts +0 -167
- package/src/lib/blocks.ts +0 -389
- package/src/lib/bookmark-sync-job.ts +0 -536
- package/src/lib/client-cache.ts +0 -109
- package/src/lib/config.ts +0 -224
- package/src/lib/conversation-surface.ts +0 -205
- package/src/lib/data-sources.ts +0 -219
- package/src/lib/db.ts +0 -1135
- package/src/lib/dms-live.ts +0 -933
- package/src/lib/effect-runtime.ts +0 -45
- package/src/lib/follow-graph.ts +0 -1097
- package/src/lib/geocoding.ts +0 -296
- package/src/lib/http-effect.ts +0 -222
- package/src/lib/identity-search-index.ts +0 -369
- package/src/lib/inbox.ts +0 -241
- package/src/lib/link-index.ts +0 -641
- package/src/lib/link-insights.ts +0 -860
- package/src/lib/link-preview-metadata.ts +0 -754
- package/src/lib/location.ts +0 -137
- package/src/lib/media-fetch.ts +0 -860
- package/src/lib/media-includes.ts +0 -165
- package/src/lib/mention-threads-live.ts +0 -917
- package/src/lib/mentions-export.ts +0 -147
- package/src/lib/mentions-live.ts +0 -1238
- package/src/lib/moderation-target.ts +0 -216
- package/src/lib/moderation-write.ts +0 -131
- package/src/lib/mutes-write.ts +0 -167
- package/src/lib/mutes.ts +0 -84
- package/src/lib/ndjson-stream.ts +0 -106
- package/src/lib/network-map.ts +0 -382
- package/src/lib/openai.ts +0 -117
- package/src/lib/period-digest.ts +0 -1552
- package/src/lib/present.ts +0 -118
- package/src/lib/profile-affiliation-hydration.ts +0 -228
- package/src/lib/profile-affiliations.ts +0 -262
- package/src/lib/profile-analysis.ts +0 -1272
- package/src/lib/profile-bio-entities.ts +0 -318
- package/src/lib/profile-history.ts +0 -164
- package/src/lib/profile-hydration.ts +0 -180
- package/src/lib/profile-replies.ts +0 -77
- package/src/lib/profile-resolver.ts +0 -650
- package/src/lib/queries.ts +0 -2381
- package/src/lib/research.ts +0 -652
- package/src/lib/search-discussion.ts +0 -1016
- package/src/lib/seed.ts +0 -613
- package/src/lib/sqlite.ts +0 -147
- package/src/lib/sync-cache.ts +0 -65
- package/src/lib/theme-transition.ts +0 -113
- package/src/lib/theme.tsx +0 -165
- package/src/lib/timeline-collections-live.ts +0 -581
- package/src/lib/timeline-live.ts +0 -452
- package/src/lib/tweet-account-edges.ts +0 -48
- package/src/lib/tweet-lookup.ts +0 -46
- package/src/lib/tweet-render.ts +0 -430
- package/src/lib/tweet-search-live.ts +0 -566
- package/src/lib/types.ts +0 -723
- package/src/lib/ui.ts +0 -529
- package/src/lib/url-expansion-store.ts +0 -110
- package/src/lib/url-expansion.ts +0 -343
- package/src/lib/url-safety.ts +0 -220
- package/src/lib/web-sync.ts +0 -516
- package/src/lib/whois.ts +0 -1079
- package/src/lib/x-profile.ts +0 -365
- package/src/lib/x-web.ts +0 -199
- package/src/lib/xurl-rate-limits.ts +0 -267
- package/src/lib/xurl.ts +0 -1677
- package/src/routeTree.gen.ts +0 -723
- package/src/router.tsx +0 -20
- package/src/routes/__root.tsx +0 -79
- package/src/routes/api/action.tsx +0 -147
- package/src/routes/api/avatar.tsx +0 -50
- package/src/routes/api/blocks.tsx +0 -35
- package/src/routes/api/conversation.tsx +0 -45
- package/src/routes/api/data-sources.tsx +0 -24
- package/src/routes/api/inbox.tsx +0 -43
- package/src/routes/api/link-insights.tsx +0 -85
- package/src/routes/api/link-preview.tsx +0 -47
- package/src/routes/api/network-map.tsx +0 -55
- package/src/routes/api/period-digest.tsx +0 -101
- package/src/routes/api/profile-analysis.tsx +0 -97
- package/src/routes/api/profile-hydrate.tsx +0 -54
- package/src/routes/api/query.tsx +0 -115
- package/src/routes/api/search-discussion.tsx +0 -113
- package/src/routes/api/status.tsx +0 -28
- package/src/routes/api/sync.tsx +0 -105
- package/src/routes/api/xurl-rate-limits.tsx +0 -24
- package/src/routes/blocks.tsx +0 -377
- package/src/routes/bookmarks.tsx +0 -18
- package/src/routes/data-sources.tsx +0 -257
- package/src/routes/discuss.tsx +0 -419
- package/src/routes/dms.tsx +0 -432
- package/src/routes/inbox.tsx +0 -226
- package/src/routes/index.tsx +0 -32
- package/src/routes/likes.tsx +0 -18
- package/src/routes/links.tsx +0 -994
- package/src/routes/mentions.tsx +0 -32
- package/src/routes/network-map.tsx +0 -1035
- package/src/routes/profile-analyze.tsx +0 -112
- package/src/routes/profiles.$handle.tsx +0 -228
- package/src/routes/rate-limits.tsx +0 -309
- package/src/routes/today.tsx +0 -511
- package/src/styles.css +0 -257
- package/tsconfig.json +0 -29
- package/vite.config.ts +0 -29
- /package/{public → dist/client}/birdclaw-mark.png +0 -0
- /package/{public → dist/client}/favicon.ico +0 -0
- /package/{public → dist/client}/logo192.png +0 -0
- /package/{public → dist/client}/logo512.png +0 -0
- /package/{public → dist/client}/manifest.json +0 -0
- /package/{public → dist/client}/robots.txt +0 -0
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
import { Dt as pageSubtitleClass, Et as pageHeaderRowClass, Ht as searchFieldInputClass, Kt as segmentClass, Ot as pageTitleClass, Tt as pageHeaderClass, Ut as searchFieldShellClass, Vt as searchFieldIconClass, Wt as secondaryButtonClass, m as cx, on as statusCopyClass, q as errorCopyClass, qt as segmentedClass, wt as pageHeaderActionsClass } from "./ui-qbmcMSSX.js";
|
|
2
|
+
import { o as validateNetworkMapSearch } from "./route-search-BUlQ5lGM.js";
|
|
3
|
+
import { a as avatarPath, c as compareClusterFeatures, d as getClusterDisplayAnchor, f as isCluster, i as avatarInitial, l as formatNumber, m as relationshipColor, n as useNetworkMapController, o as buildClusterIndex, p as readViewport, r as WORLD_VIEWPORT, s as clusterGradient, t as Route$1, u as formatRelationship } from "./network-map-D3CzRcC4.js";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Globe2, MapPin, RefreshCw, Search, Users, WifiOff } from "lucide-react";
|
|
7
|
+
//#region src/routes/network-map.tsx?tsr-split=component
|
|
8
|
+
function StatTile({ icon: Icon, label, value }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "flex min-w-0 flex-col gap-2 border-b border-[var(--line)] px-4 py-3 sm:border-r",
|
|
11
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
12
|
+
className: "flex items-center gap-2 text-[13px] font-medium text-[var(--ink-soft)]",
|
|
13
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
14
|
+
className: "size-4",
|
|
15
|
+
strokeWidth: 1.8
|
|
16
|
+
}), /* @__PURE__ */ jsx("span", { children: label })]
|
|
17
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: "truncate text-[24px] font-bold tracking-tight text-[var(--ink)]",
|
|
19
|
+
children: formatNumber(value)
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function useMapboxModule() {
|
|
24
|
+
const [module, setModule] = useState(null);
|
|
25
|
+
const [error, setError] = useState(null);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
let cancelled = false;
|
|
28
|
+
import("react-map-gl/mapbox").then((loaded) => {
|
|
29
|
+
if (!cancelled) setModule(loaded);
|
|
30
|
+
}).catch((cause) => {
|
|
31
|
+
if (!cancelled) setError(cause instanceof Error ? cause.message : "Map failed");
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
cancelled = true;
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
return {
|
|
38
|
+
module,
|
|
39
|
+
error
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function Avatar({ feature, size = 36, className, style }) {
|
|
43
|
+
const src = avatarPath(feature);
|
|
44
|
+
const [failedSrc, setFailedSrc] = useState(null);
|
|
45
|
+
const showImage = src && failedSrc !== src;
|
|
46
|
+
return /* @__PURE__ */ jsx("div", {
|
|
47
|
+
className: cx("relative grid shrink-0 place-items-center overflow-hidden rounded-full bg-[var(--accent-soft)] text-[12px] font-bold text-[var(--accent)] ring-2 ring-white", className),
|
|
48
|
+
style: {
|
|
49
|
+
width: size,
|
|
50
|
+
height: size,
|
|
51
|
+
...style
|
|
52
|
+
},
|
|
53
|
+
children: showImage ? /* @__PURE__ */ jsx("img", {
|
|
54
|
+
src,
|
|
55
|
+
alt: "",
|
|
56
|
+
className: "h-full w-full object-cover",
|
|
57
|
+
loading: "lazy",
|
|
58
|
+
onError: () => setFailedSrc(src)
|
|
59
|
+
}) : /* @__PURE__ */ jsx("span", { children: avatarInitial(feature) })
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function ProfileMarker({ feature }) {
|
|
63
|
+
const color = relationshipColor(feature.properties.relationship);
|
|
64
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
65
|
+
type: "button",
|
|
66
|
+
className: "group relative grid size-11 place-items-center rounded-full border-0 bg-transparent p-0 transition-transform hover:z-10 hover:scale-110",
|
|
67
|
+
"aria-label": `Open @${feature.properties.handle}`,
|
|
68
|
+
title: `@${feature.properties.handle}`,
|
|
69
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: "absolute inset-0 rounded-full opacity-90 shadow-[0_10px_28px_rgba(15,20,25,0.28)]",
|
|
71
|
+
style: { backgroundColor: color }
|
|
72
|
+
}), /* @__PURE__ */ jsx(Avatar, {
|
|
73
|
+
feature,
|
|
74
|
+
size: 34,
|
|
75
|
+
className: "relative ring-[3px]"
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function ClusterMarker({ count, features, stats }) {
|
|
80
|
+
const size = Math.min(82, Math.max(52, 44 + Math.log2(count) * 7));
|
|
81
|
+
const avatarSize = size >= 72 ? 30 : 25;
|
|
82
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
83
|
+
type: "button",
|
|
84
|
+
className: "group relative rounded-full border-0 bg-transparent p-0 transition-transform hover:z-10 hover:scale-105",
|
|
85
|
+
"aria-label": `${formatNumber(count)} located profiles`,
|
|
86
|
+
title: `${formatNumber(count)} profiles`,
|
|
87
|
+
style: {
|
|
88
|
+
width: size,
|
|
89
|
+
height: size
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx("span", {
|
|
93
|
+
className: "absolute inset-0 rounded-full opacity-95 shadow-[0_18px_42px_rgba(15,20,25,0.32)]",
|
|
94
|
+
style: { background: clusterGradient(stats) }
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-[4px] rounded-full bg-white/88 backdrop-blur-sm" }),
|
|
97
|
+
/* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
99
|
+
children: features.slice(0, 4).map((feature, index) => /* @__PURE__ */ jsx(Avatar, {
|
|
100
|
+
feature,
|
|
101
|
+
size: avatarSize,
|
|
102
|
+
className: "absolute",
|
|
103
|
+
style: { transform: `translate(${[
|
|
104
|
+
-10,
|
|
105
|
+
10,
|
|
106
|
+
-7,
|
|
107
|
+
8
|
|
108
|
+
][index] ?? 0}px, ${[
|
|
109
|
+
-9,
|
|
110
|
+
-8,
|
|
111
|
+
11,
|
|
112
|
+
10
|
|
113
|
+
][index] ?? 0}px)` }
|
|
114
|
+
}, feature.properties.profileId))
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ jsx("span", {
|
|
117
|
+
className: "absolute -right-1 -top-1 min-w-7 rounded-full bg-[#0f1419] px-1.5 py-0.5 text-center text-[11px] font-bold leading-5 text-white ring-2 ring-white",
|
|
118
|
+
children: count > 99 ? "99+" : formatNumber(count)
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function MapboxPanel({ data, onViewportChange }) {
|
|
124
|
+
const { module, error } = useMapboxModule();
|
|
125
|
+
const mapRef = useRef(null);
|
|
126
|
+
const [viewport, setViewport] = useState(WORLD_VIEWPORT);
|
|
127
|
+
const [selected, setSelected] = useState(null);
|
|
128
|
+
const clusterIndex = useMemo(() => buildClusterIndex(data.features), [data]);
|
|
129
|
+
const visibleClusters = useMemo(() => clusterIndex.getClusters(viewport.bounds, Math.max(0, Math.floor(viewport.zoom))), [clusterIndex, viewport]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
setSelected(null);
|
|
132
|
+
}, [data]);
|
|
133
|
+
const updateViewport = useCallback((event) => {
|
|
134
|
+
const next = readViewport(event.target);
|
|
135
|
+
if (!next) return;
|
|
136
|
+
setViewport(next);
|
|
137
|
+
onViewportChange(next);
|
|
138
|
+
}, [onViewportChange]);
|
|
139
|
+
if (!data.config.mapboxToken) return /* @__PURE__ */ jsx(SvgMapFallback, { data });
|
|
140
|
+
if (error) return /* @__PURE__ */ jsxs("div", {
|
|
141
|
+
className: statusCopyClass,
|
|
142
|
+
children: [/* @__PURE__ */ jsx(WifiOff, {
|
|
143
|
+
className: "mr-2 inline size-4",
|
|
144
|
+
strokeWidth: 1.8
|
|
145
|
+
}), error]
|
|
146
|
+
});
|
|
147
|
+
if (!module) return /* @__PURE__ */ jsx("div", {
|
|
148
|
+
className: statusCopyClass,
|
|
149
|
+
children: "Loading map..."
|
|
150
|
+
});
|
|
151
|
+
const { default: Map, Marker, NavigationControl, Popup } = module;
|
|
152
|
+
return /* @__PURE__ */ jsx("div", {
|
|
153
|
+
className: "min-h-[520px] flex-1 overflow-hidden bg-[var(--bg-active)] min-[1180px]:min-h-0",
|
|
154
|
+
children: /* @__PURE__ */ jsxs(Map, {
|
|
155
|
+
ref: mapRef,
|
|
156
|
+
initialViewState: {
|
|
157
|
+
longitude: 9,
|
|
158
|
+
latitude: 24,
|
|
159
|
+
zoom: 1.2
|
|
160
|
+
},
|
|
161
|
+
mapStyle: document.documentElement.dataset.theme === "dark" ? "mapbox://styles/mapbox/dark-v11" : "mapbox://styles/mapbox/light-v11",
|
|
162
|
+
mapboxAccessToken: data.config.mapboxToken,
|
|
163
|
+
onClick: () => setSelected(null),
|
|
164
|
+
onLoad: updateViewport,
|
|
165
|
+
onMoveEnd: updateViewport,
|
|
166
|
+
projection: "mercator",
|
|
167
|
+
style: {
|
|
168
|
+
width: "100%",
|
|
169
|
+
height: "100%"
|
|
170
|
+
},
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx(NavigationControl, {
|
|
173
|
+
position: "top-right",
|
|
174
|
+
showCompass: false
|
|
175
|
+
}),
|
|
176
|
+
visibleClusters.map((item) => {
|
|
177
|
+
const [longitude, latitude] = item.geometry.coordinates;
|
|
178
|
+
if (isCluster(item)) {
|
|
179
|
+
const fallbackCoordinates = item.geometry.coordinates;
|
|
180
|
+
const leaves = clusterIndex.getLeaves(item.properties.cluster_id, 48).map((leaf) => data.features[leaf.properties.featureIndex]).filter((feature) => Boolean(feature)).sort(compareClusterFeatures);
|
|
181
|
+
const [displayLongitude, displayLatitude] = getClusterDisplayAnchor(leaves, fallbackCoordinates);
|
|
182
|
+
return /* @__PURE__ */ jsx(Marker, {
|
|
183
|
+
longitude: displayLongitude,
|
|
184
|
+
latitude: displayLatitude,
|
|
185
|
+
anchor: "center",
|
|
186
|
+
onClick: (event) => {
|
|
187
|
+
event.originalEvent?.stopPropagation();
|
|
188
|
+
const expansionZoom = Math.min(clusterIndex.getClusterExpansionZoom(item.properties.cluster_id), 12);
|
|
189
|
+
mapRef.current?.flyTo?.({
|
|
190
|
+
center: [displayLongitude, displayLatitude],
|
|
191
|
+
zoom: Math.max(viewport.zoom + .85, expansionZoom - .6),
|
|
192
|
+
duration: 520
|
|
193
|
+
});
|
|
194
|
+
setSelected({
|
|
195
|
+
kind: "cluster",
|
|
196
|
+
coordinates: [displayLongitude, displayLatitude],
|
|
197
|
+
count: item.properties.point_count,
|
|
198
|
+
features: leaves,
|
|
199
|
+
stats: item.properties
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
children: /* @__PURE__ */ jsx(ClusterMarker, {
|
|
203
|
+
count: item.properties.point_count,
|
|
204
|
+
features: leaves,
|
|
205
|
+
stats: item.properties
|
|
206
|
+
})
|
|
207
|
+
}, `cluster-${String(item.properties.cluster_id)}`);
|
|
208
|
+
}
|
|
209
|
+
const feature = data.features[item.properties.featureIndex];
|
|
210
|
+
if (!feature) return null;
|
|
211
|
+
return /* @__PURE__ */ jsx(Marker, {
|
|
212
|
+
longitude,
|
|
213
|
+
latitude,
|
|
214
|
+
anchor: "center",
|
|
215
|
+
onClick: (event) => {
|
|
216
|
+
event.originalEvent?.stopPropagation();
|
|
217
|
+
setSelected({
|
|
218
|
+
kind: "profile",
|
|
219
|
+
feature
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
children: /* @__PURE__ */ jsx(ProfileMarker, { feature })
|
|
223
|
+
}, feature.properties.profileId);
|
|
224
|
+
}),
|
|
225
|
+
selected ? /* @__PURE__ */ jsx(Popup, {
|
|
226
|
+
longitude: selected.kind === "profile" ? selected.feature.geometry.coordinates[0] : selected.coordinates[0],
|
|
227
|
+
latitude: selected.kind === "profile" ? selected.feature.geometry.coordinates[1] : selected.coordinates[1],
|
|
228
|
+
closeButton: false,
|
|
229
|
+
offset: 12,
|
|
230
|
+
onClose: () => setSelected(null),
|
|
231
|
+
children: selected.kind === "profile" ? /* @__PURE__ */ jsx(ProfilePopup, { feature: selected.feature }) : /* @__PURE__ */ jsx(ClusterPopup, {
|
|
232
|
+
count: selected.count,
|
|
233
|
+
features: selected.features,
|
|
234
|
+
stats: selected.stats
|
|
235
|
+
})
|
|
236
|
+
}) : null
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function SvgMapFallback({ data }) {
|
|
242
|
+
const points = data.features.slice(0, 1500).map((feature) => {
|
|
243
|
+
const [lng, lat] = feature.geometry.coordinates;
|
|
244
|
+
return {
|
|
245
|
+
feature,
|
|
246
|
+
x: (lng + 180) / 360 * 1e3,
|
|
247
|
+
y: (90 - lat) / 180 * 500
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
return /* @__PURE__ */ jsx("div", {
|
|
251
|
+
className: "border-b border-[var(--line)] bg-[var(--bg-active)] px-4 py-4",
|
|
252
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
253
|
+
viewBox: "0 0 1000 500",
|
|
254
|
+
className: "h-auto w-full rounded-md border border-[var(--line)] bg-[var(--bg)]",
|
|
255
|
+
role: "img",
|
|
256
|
+
"aria-label": "Network map",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
|
|
259
|
+
id: "map-grid",
|
|
260
|
+
width: "100",
|
|
261
|
+
height: "100",
|
|
262
|
+
patternUnits: "userSpaceOnUse",
|
|
263
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
264
|
+
d: "M 100 0 L 0 0 0 100",
|
|
265
|
+
fill: "none",
|
|
266
|
+
stroke: "currentColor",
|
|
267
|
+
strokeOpacity: "0.08",
|
|
268
|
+
strokeWidth: "1"
|
|
269
|
+
})
|
|
270
|
+
}) }),
|
|
271
|
+
/* @__PURE__ */ jsx("rect", {
|
|
272
|
+
width: "1000",
|
|
273
|
+
height: "500",
|
|
274
|
+
fill: "url(#map-grid)"
|
|
275
|
+
}),
|
|
276
|
+
/* @__PURE__ */ jsx("path", {
|
|
277
|
+
d: "M60 205 C145 155 210 145 280 178 C352 212 424 186 495 194 C594 206 665 157 746 178 C836 201 907 227 952 282",
|
|
278
|
+
fill: "none",
|
|
279
|
+
stroke: "currentColor",
|
|
280
|
+
strokeOpacity: "0.18",
|
|
281
|
+
strokeWidth: "36",
|
|
282
|
+
strokeLinecap: "round"
|
|
283
|
+
}),
|
|
284
|
+
points.map(({ feature, x, y }) => /* @__PURE__ */ jsx("circle", {
|
|
285
|
+
cx: x,
|
|
286
|
+
cy: y,
|
|
287
|
+
r: feature.properties.relationship === "mutual" ? 4.5 : 3.5,
|
|
288
|
+
fill: feature.properties.relationship === "mutual" ? "#22c55e" : feature.properties.relationship === "following" ? "#f59e0b" : "#1d9bf0",
|
|
289
|
+
opacity: "0.86"
|
|
290
|
+
}, feature.properties.profileId))
|
|
291
|
+
]
|
|
292
|
+
})
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function ProfilePopup({ feature }) {
|
|
296
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
297
|
+
className: "flex max-w-[280px] gap-3 text-[13px] text-[#0f1419]",
|
|
298
|
+
children: [/* @__PURE__ */ jsx(Avatar, {
|
|
299
|
+
feature,
|
|
300
|
+
size: 48,
|
|
301
|
+
className: "ring-[#d9e2ea]"
|
|
302
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
303
|
+
className: "min-w-0",
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsx("div", {
|
|
306
|
+
className: "truncate font-bold",
|
|
307
|
+
children: feature.properties.name
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ jsxs("div", {
|
|
310
|
+
className: "truncate text-[#536471]",
|
|
311
|
+
children: ["@", feature.properties.handle]
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx("div", {
|
|
314
|
+
className: "mt-1 line-clamp-2",
|
|
315
|
+
children: feature.properties.location
|
|
316
|
+
}),
|
|
317
|
+
feature.properties.resolvedLocation ? /* @__PURE__ */ jsx("div", {
|
|
318
|
+
className: "truncate text-[#536471]",
|
|
319
|
+
children: feature.properties.resolvedLocation
|
|
320
|
+
}) : null
|
|
321
|
+
]
|
|
322
|
+
})]
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function ClusterPopup({ count, features, stats }) {
|
|
326
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
327
|
+
className: "w-[290px] text-[13px] text-[#0f1419]",
|
|
328
|
+
children: [
|
|
329
|
+
/* @__PURE__ */ jsxs("div", {
|
|
330
|
+
className: "flex items-center justify-between gap-3",
|
|
331
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
332
|
+
className: "font-bold",
|
|
333
|
+
children: [formatNumber(count), " profiles here"]
|
|
334
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
335
|
+
className: "text-[#536471]",
|
|
336
|
+
children: [
|
|
337
|
+
formatNumber(stats.mutual),
|
|
338
|
+
" mutual ·",
|
|
339
|
+
" ",
|
|
340
|
+
formatNumber(stats.following),
|
|
341
|
+
" following ·",
|
|
342
|
+
" ",
|
|
343
|
+
formatNumber(stats.followers),
|
|
344
|
+
" followers"
|
|
345
|
+
]
|
|
346
|
+
})] }), /* @__PURE__ */ jsx("div", {
|
|
347
|
+
className: "size-11 shrink-0 rounded-full ring-2 ring-[#d9e2ea]",
|
|
348
|
+
style: { background: clusterGradient(stats) }
|
|
349
|
+
})]
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ jsx("div", {
|
|
352
|
+
className: "mt-3 flex -space-x-2",
|
|
353
|
+
children: features.slice(0, 6).map((feature) => /* @__PURE__ */ jsx(Avatar, {
|
|
354
|
+
feature,
|
|
355
|
+
size: 36,
|
|
356
|
+
className: "ring-[#ffffff]"
|
|
357
|
+
}, feature.properties.profileId))
|
|
358
|
+
}),
|
|
359
|
+
/* @__PURE__ */ jsx("div", {
|
|
360
|
+
className: "mt-3 divide-y divide-[#eff3f4]",
|
|
361
|
+
children: features.slice(0, 5).map((feature) => /* @__PURE__ */ jsxs("div", {
|
|
362
|
+
className: "flex min-w-0 items-center gap-2 py-2",
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
365
|
+
feature,
|
|
366
|
+
size: 28,
|
|
367
|
+
className: "ring-[#ffffff]"
|
|
368
|
+
}),
|
|
369
|
+
/* @__PURE__ */ jsxs("div", {
|
|
370
|
+
className: "min-w-0 flex-1",
|
|
371
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
372
|
+
className: "truncate font-semibold",
|
|
373
|
+
children: feature.properties.name
|
|
374
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
375
|
+
className: "truncate text-[#536471]",
|
|
376
|
+
children: ["@", feature.properties.handle]
|
|
377
|
+
})]
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ jsx("div", {
|
|
380
|
+
className: "size-2 rounded-full",
|
|
381
|
+
style: { backgroundColor: relationshipColor(feature.properties.relationship) }
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
}, feature.properties.profileId))
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
function ProfileRow({ feature }) {
|
|
390
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
391
|
+
className: "flex min-w-0 gap-3 border-b border-[var(--line)] px-4 py-3 transition-colors hover:bg-[var(--bg-hover)]",
|
|
392
|
+
href: `/profiles/${encodeURIComponent(feature.properties.handle)}`,
|
|
393
|
+
children: [/* @__PURE__ */ jsx(Avatar, {
|
|
394
|
+
feature,
|
|
395
|
+
size: 40,
|
|
396
|
+
className: "ring-[var(--bg)]"
|
|
397
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
398
|
+
className: "min-w-0 flex-1",
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ jsxs("div", {
|
|
401
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
402
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
403
|
+
className: "truncate font-bold text-[var(--ink)]",
|
|
404
|
+
children: feature.properties.name
|
|
405
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
406
|
+
className: "truncate text-[var(--ink-soft)]",
|
|
407
|
+
children: ["@", feature.properties.handle]
|
|
408
|
+
})]
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ jsxs("div", {
|
|
411
|
+
className: "truncate text-[13px] text-[var(--ink-soft)]",
|
|
412
|
+
children: [feature.properties.location, feature.properties.resolvedLocation ? ` -> ${feature.properties.resolvedLocation}` : ""]
|
|
413
|
+
}),
|
|
414
|
+
/* @__PURE__ */ jsxs("div", {
|
|
415
|
+
className: "mt-1 flex flex-wrap gap-2 text-[12px] text-[var(--ink-soft)]",
|
|
416
|
+
children: [/* @__PURE__ */ jsx("span", { children: formatRelationship(feature.properties.relationship) }), /* @__PURE__ */ jsxs("span", { children: [formatNumber(feature.properties.followersCount), " followers"] })]
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
})]
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function VisibleProfilesPanel({ features, search, onSearchChange, totalVisible, zoom }) {
|
|
423
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
424
|
+
className: "flex min-h-[420px] min-w-0 flex-col border-t border-[var(--line)] bg-[var(--bg)] min-[1180px]:h-full min-[1180px]:border-t-0 min-[1180px]:border-l",
|
|
425
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
426
|
+
className: "sticky top-0 z-10 border-b border-[var(--line)] bg-[color:color-mix(in_srgb,var(--bg)_88%,transparent)] px-4 py-3 backdrop-blur",
|
|
427
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
428
|
+
className: "flex items-start justify-between gap-3",
|
|
429
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
430
|
+
className: "min-w-0",
|
|
431
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
432
|
+
className: "truncate text-[16px] font-bold text-[var(--ink)]",
|
|
433
|
+
children: "Who's In View"
|
|
434
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
435
|
+
className: "truncate text-[13px] text-[var(--ink-soft)]",
|
|
436
|
+
children: [
|
|
437
|
+
formatNumber(totalVisible),
|
|
438
|
+
" in this map view · zoom",
|
|
439
|
+
" ",
|
|
440
|
+
zoom.toFixed(1)
|
|
441
|
+
]
|
|
442
|
+
})]
|
|
443
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
444
|
+
className: "rounded-full border border-[var(--line)] px-2 py-1 text-[12px] font-semibold text-[var(--ink-soft)]",
|
|
445
|
+
children: formatNumber(features.length)
|
|
446
|
+
})]
|
|
447
|
+
}), /* @__PURE__ */ jsxs("label", {
|
|
448
|
+
className: cx(searchFieldShellClass, "mt-3 h-10"),
|
|
449
|
+
children: [/* @__PURE__ */ jsx(Search, {
|
|
450
|
+
className: searchFieldIconClass,
|
|
451
|
+
strokeWidth: 2
|
|
452
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
453
|
+
className: searchFieldInputClass,
|
|
454
|
+
onChange: (event) => onSearchChange(event.target.value),
|
|
455
|
+
placeholder: "Search visible people",
|
|
456
|
+
value: search
|
|
457
|
+
})]
|
|
458
|
+
})]
|
|
459
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
460
|
+
className: "min-h-0 flex-1 overflow-y-auto",
|
|
461
|
+
children: features.length > 0 ? features.map((feature) => /* @__PURE__ */ jsx(ProfileRow, { feature }, feature.properties.profileId)) : /* @__PURE__ */ jsx("div", {
|
|
462
|
+
className: statusCopyClass,
|
|
463
|
+
children: search.trim() ? "No visible profiles match that search." : "Pan or zoom the map to see profiles in this area."
|
|
464
|
+
})
|
|
465
|
+
})]
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
function NetworkMapRoute() {
|
|
469
|
+
const search = Route$1.useSearch();
|
|
470
|
+
const navigate = Route$1.useNavigate();
|
|
471
|
+
return /* @__PURE__ */ jsx(NetworkMapRouteView, {
|
|
472
|
+
searchState: search,
|
|
473
|
+
onSearchChange: (next, options) => void navigate({
|
|
474
|
+
search: next,
|
|
475
|
+
replace: options?.replace
|
|
476
|
+
})
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function NetworkMapRouteView({ searchState: controlledSearch, onSearchChange } = {}) {
|
|
480
|
+
const [localSearch, setLocalSearch] = useState(() => validateNetworkMapSearch({}));
|
|
481
|
+
const searchState = controlledSearch ?? localSearch;
|
|
482
|
+
const updateSearch = (next, options) => onSearchChange ? onSearchChange(next, options) : setLocalSearch(next);
|
|
483
|
+
const { type, setType, viewport, setViewport, visibleSearch, setVisibleSearch, data, loading, error, refresh, visibleFeatures, filteredVisibleFeatures, mapTypes } = useNetworkMapController(searchState, updateSearch);
|
|
484
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
485
|
+
className: "flex min-h-screen flex-col min-[1180px]:h-screen min-[1180px]:min-h-0 min-[1180px]:overflow-hidden",
|
|
486
|
+
children: [
|
|
487
|
+
/* @__PURE__ */ jsxs("header", {
|
|
488
|
+
className: pageHeaderClass,
|
|
489
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
490
|
+
className: pageHeaderRowClass,
|
|
491
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
492
|
+
className: pageTitleClass,
|
|
493
|
+
children: "Network Map"
|
|
494
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
495
|
+
className: pageSubtitleClass,
|
|
496
|
+
children: data ? `${formatNumber(data.meta.locatedProfiles)} located · ${formatNumber(data.meta.meaningfulProfiles)} with usable locations` : "Loading network geography..."
|
|
497
|
+
})] }), /* @__PURE__ */ jsx("div", {
|
|
498
|
+
className: pageHeaderActionsClass,
|
|
499
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
500
|
+
className: secondaryButtonClass,
|
|
501
|
+
type: "button",
|
|
502
|
+
onClick: () => refresh(),
|
|
503
|
+
disabled: loading,
|
|
504
|
+
children: [/* @__PURE__ */ jsx(RefreshCw, { className: cx("size-4", loading && "animate-spin") }), "Refresh"]
|
|
505
|
+
})
|
|
506
|
+
})]
|
|
507
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
508
|
+
className: "border-t border-[var(--line)] px-4 py-3",
|
|
509
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
510
|
+
className: segmentedClass,
|
|
511
|
+
children: mapTypes.map((item) => /* @__PURE__ */ jsx("button", {
|
|
512
|
+
type: "button",
|
|
513
|
+
className: cx(segmentClass, type === item.value && "bg-[var(--bg-active)] text-[var(--ink)]"),
|
|
514
|
+
onClick: () => setType(item.value),
|
|
515
|
+
children: item.label
|
|
516
|
+
}, item.value))
|
|
517
|
+
})
|
|
518
|
+
})]
|
|
519
|
+
}),
|
|
520
|
+
error ? /* @__PURE__ */ jsx("div", {
|
|
521
|
+
className: errorCopyClass,
|
|
522
|
+
children: error
|
|
523
|
+
}) : null,
|
|
524
|
+
data ? /* @__PURE__ */ jsxs("div", {
|
|
525
|
+
className: "grid min-h-[620px] flex-1 grid-cols-1 min-[1180px]:min-h-0 min-[1180px]:grid-cols-[minmax(0,1fr)_390px] min-[1180px]:overflow-hidden min-[1500px]:grid-cols-[minmax(0,1fr)_430px]",
|
|
526
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
527
|
+
className: "flex min-h-0 min-w-0 flex-col",
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ jsxs("div", {
|
|
530
|
+
className: "grid sm:grid-cols-4",
|
|
531
|
+
children: [
|
|
532
|
+
/* @__PURE__ */ jsx(StatTile, {
|
|
533
|
+
icon: Users,
|
|
534
|
+
label: "Profiles",
|
|
535
|
+
value: data.meta.totalProfiles
|
|
536
|
+
}),
|
|
537
|
+
/* @__PURE__ */ jsx(StatTile, {
|
|
538
|
+
icon: MapPin,
|
|
539
|
+
label: "Locations",
|
|
540
|
+
value: data.meta.meaningfulProfiles
|
|
541
|
+
}),
|
|
542
|
+
/* @__PURE__ */ jsx(StatTile, {
|
|
543
|
+
icon: Globe2,
|
|
544
|
+
label: "Located",
|
|
545
|
+
value: data.meta.locatedProfiles
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ jsx(StatTile, {
|
|
548
|
+
icon: RefreshCw,
|
|
549
|
+
label: "Geocoded",
|
|
550
|
+
value: data.meta.geocodedThisRun
|
|
551
|
+
})
|
|
552
|
+
]
|
|
553
|
+
}),
|
|
554
|
+
!data.meta.opencageConfigured && data.meta.missingGeocodes > 0 ? /* @__PURE__ */ jsx("div", {
|
|
555
|
+
className: statusCopyClass,
|
|
556
|
+
children: "OpenCage key missing; showing cached and coordinate locations only."
|
|
557
|
+
}) : null,
|
|
558
|
+
!data.meta.mapboxTokenConfigured ? /* @__PURE__ */ jsx("div", {
|
|
559
|
+
className: statusCopyClass,
|
|
560
|
+
children: "Mapbox token missing; showing the lightweight map."
|
|
561
|
+
}) : null,
|
|
562
|
+
/* @__PURE__ */ jsx(MapboxPanel, {
|
|
563
|
+
data,
|
|
564
|
+
onViewportChange: setViewport
|
|
565
|
+
})
|
|
566
|
+
]
|
|
567
|
+
}), /* @__PURE__ */ jsx(VisibleProfilesPanel, {
|
|
568
|
+
features: filteredVisibleFeatures,
|
|
569
|
+
onSearchChange: setVisibleSearch,
|
|
570
|
+
search: visibleSearch,
|
|
571
|
+
totalVisible: visibleFeatures.length,
|
|
572
|
+
zoom: viewport.zoom
|
|
573
|
+
})]
|
|
574
|
+
}) : loading ? /* @__PURE__ */ jsx("div", {
|
|
575
|
+
className: statusCopyClass,
|
|
576
|
+
children: "Loading map..."
|
|
577
|
+
}) : null
|
|
578
|
+
]
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
//#endregion
|
|
582
|
+
export { NetworkMapRouteView, NetworkMapRoute as component };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Dt as pageSubtitleClass, Et as pageHeaderRowClass, Ht as searchFieldInputClass, Mt as primaryButtonClass, Ot as pageTitleClass, Tt as pageHeaderClass, Ut as searchFieldShellClass, Vt as searchFieldIconClass, Wt as secondaryButtonClass, m as cx, wt as pageHeaderActionsClass } from "./ui-qbmcMSSX.js";
|
|
2
|
+
import { t as Route$1 } from "./profile-analyze-C1NoM0tV.js";
|
|
3
|
+
import { a as formatProfileAnalysisCounts, i as cleanProfileHandle, n as ProfileAnalysisStatusLine, r as useProfileAnalysisStream, t as ProfileAnalysisOutput } from "./ProfileAnalysisStream-BFvhVdhn.js";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Loader2, RefreshCw, Search, UserSearch } from "lucide-react";
|
|
7
|
+
//#region src/routes/profile-analyze.tsx?tsr-split=component
|
|
8
|
+
function ProfileAnalyzeRoute() {
|
|
9
|
+
const search = Route$1.useSearch();
|
|
10
|
+
const [handle, setHandle] = useState(cleanProfileHandle(search.handle));
|
|
11
|
+
const submittedHandle = useMemo(() => cleanProfileHandle(handle), [handle]);
|
|
12
|
+
const analysis = useProfileAnalysisStream(submittedHandle);
|
|
13
|
+
const autoRunHandleRef = useRef("");
|
|
14
|
+
const runAnalysisRef = useRef(analysis.run);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
runAnalysisRef.current = analysis.run;
|
|
17
|
+
}, [analysis.run]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const urlHandle = cleanProfileHandle(search.handle);
|
|
20
|
+
setHandle(urlHandle);
|
|
21
|
+
if (urlHandle && autoRunHandleRef.current !== urlHandle) {
|
|
22
|
+
autoRunHandleRef.current = urlHandle;
|
|
23
|
+
runAnalysisRef.current(false, urlHandle);
|
|
24
|
+
}
|
|
25
|
+
}, [search.handle]);
|
|
26
|
+
const submit = (event) => {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
analysis.run(false);
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
31
|
+
className: "flex min-h-screen flex-col gap-6 px-4 py-8",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxs("header", {
|
|
34
|
+
className: cx(pageHeaderClass, "border-b-0"),
|
|
35
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: pageHeaderRowClass,
|
|
37
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
38
|
+
className: pageTitleClass,
|
|
39
|
+
children: "Profile Analyse"
|
|
40
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
41
|
+
className: pageSubtitleClass,
|
|
42
|
+
children: formatProfileAnalysisCounts(analysis.context)
|
|
43
|
+
})] }), /* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: pageHeaderActionsClass,
|
|
45
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
46
|
+
className: secondaryButtonClass,
|
|
47
|
+
disabled: !submittedHandle || analysis.loading,
|
|
48
|
+
onClick: () => analysis.run(true),
|
|
49
|
+
type: "button",
|
|
50
|
+
children: [/* @__PURE__ */ jsx(RefreshCw, {
|
|
51
|
+
className: "size-4",
|
|
52
|
+
strokeWidth: 1.8
|
|
53
|
+
}), "Refresh"]
|
|
54
|
+
})
|
|
55
|
+
})]
|
|
56
|
+
}), /* @__PURE__ */ jsxs("form", {
|
|
57
|
+
className: "mt-5 flex flex-col gap-3 sm:flex-row",
|
|
58
|
+
onSubmit: submit,
|
|
59
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
60
|
+
className: cx(searchFieldShellClass, "min-w-0 flex-1"),
|
|
61
|
+
children: [/* @__PURE__ */ jsx(Search, {
|
|
62
|
+
className: searchFieldIconClass,
|
|
63
|
+
strokeWidth: 1.8
|
|
64
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
65
|
+
className: searchFieldInputClass,
|
|
66
|
+
onChange: (event) => setHandle(event.target.value),
|
|
67
|
+
placeholder: "handle",
|
|
68
|
+
value: handle
|
|
69
|
+
})]
|
|
70
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
71
|
+
className: primaryButtonClass,
|
|
72
|
+
disabled: !submittedHandle || analysis.loading,
|
|
73
|
+
type: "submit",
|
|
74
|
+
children: [analysis.loading ? /* @__PURE__ */ jsx(Loader2, {
|
|
75
|
+
className: "size-4 animate-spin",
|
|
76
|
+
strokeWidth: 1.8
|
|
77
|
+
}) : /* @__PURE__ */ jsx(UserSearch, {
|
|
78
|
+
className: "size-4",
|
|
79
|
+
strokeWidth: 1.8
|
|
80
|
+
}), "Analyse"]
|
|
81
|
+
})]
|
|
82
|
+
})]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx(ProfileAnalysisStatusLine, { analysis }),
|
|
85
|
+
/* @__PURE__ */ jsx(ProfileAnalysisOutput, { analysis })
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { ProfileAnalyzeRoute as component };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
|
|
2
|
+
//#region src/routes/profile-analyze.tsx
|
|
3
|
+
var $$splitComponentImporter = () => import("./profile-analyze-BP65PED0.js");
|
|
4
|
+
var Route = createFileRoute("/profile-analyze")({
|
|
5
|
+
component: lazyRouteComponent($$splitComponentImporter, "component"),
|
|
6
|
+
validateSearch: (search) => ({ handle: typeof search.handle === "string" ? search.handle : "" })
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Route as t };
|