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,214 @@
|
|
|
1
|
+
import { Dt as pageSubtitleClass, Et as pageHeaderRowClass, K as emptyStateClass, Mt as primaryButtonClass, Ot as pageTitleClass, Tt as pageHeaderClass, Wt as secondaryButtonClass, Z as feedClass, cn as tabButtonClass, dn as textFieldClass, fn as textFieldShortClass, ln as tabButtonIndicatorClass, m as cx, pn as timestampClass, un as tabStripClass } from "./ui-qbmcMSSX.js";
|
|
2
|
+
import { a as fetchQueryEnvelope, n as queryKeys, r as fetchJson, s as postAction, y as inboxResponseSchema } from "./query-client-BdauHBgd.js";
|
|
3
|
+
import { r as useSelectedAccountId } from "./account-selection-CTdFGWRk.js";
|
|
4
|
+
import { i as validateInboxSearch } from "./route-search-BUlQ5lGM.js";
|
|
5
|
+
import { n as InboxCard, t as Route$1 } from "./inbox-DpWd1EzC.js";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Sparkles } from "lucide-react";
|
|
9
|
+
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
10
|
+
//#region src/routes/inbox.tsx?tsr-split=component
|
|
11
|
+
var TABS = [
|
|
12
|
+
{
|
|
13
|
+
value: "mixed",
|
|
14
|
+
label: "Mixed"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "mentions",
|
|
18
|
+
label: "Mentions"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "dms",
|
|
22
|
+
label: "DMs"
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
function InboxRoute() {
|
|
26
|
+
const search = Route$1.useSearch();
|
|
27
|
+
const navigate = Route$1.useNavigate();
|
|
28
|
+
return /* @__PURE__ */ jsx(InboxRouteView, {
|
|
29
|
+
searchState: search,
|
|
30
|
+
onSearchChange: (next, options) => void navigate({
|
|
31
|
+
search: next,
|
|
32
|
+
replace: options?.replace
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function InboxRouteView({ searchState: controlledSearch, onSearchChange } = {}) {
|
|
37
|
+
const queryClient = useQueryClient();
|
|
38
|
+
const [localSearch, setLocalSearch] = useState(() => validateInboxSearch({}));
|
|
39
|
+
const searchState = controlledSearch ?? localSearch;
|
|
40
|
+
const updateSearch = (next, options) => onSearchChange ? onSearchChange(next, options) : setLocalSearch(next);
|
|
41
|
+
const { kind, minScore, hideLowSignal } = searchState;
|
|
42
|
+
const [activeReplyId, setActiveReplyId] = useState(null);
|
|
43
|
+
const [replyDraft, setReplyDraft] = useState("");
|
|
44
|
+
const [isSendingReply, setIsSendingReply] = useState(false);
|
|
45
|
+
const [replyError, setReplyError] = useState(null);
|
|
46
|
+
const meta = useQuery({
|
|
47
|
+
queryKey: queryKeys.status,
|
|
48
|
+
queryFn: ({ signal }) => fetchQueryEnvelope({ signal })
|
|
49
|
+
}).data ?? null;
|
|
50
|
+
const selectedAccountId = useSelectedAccountId(meta?.accounts);
|
|
51
|
+
const inboxQuery = useQuery({
|
|
52
|
+
queryKey: [...queryKeys.inbox, {
|
|
53
|
+
hideLowSignal,
|
|
54
|
+
kind,
|
|
55
|
+
minScore,
|
|
56
|
+
selectedAccountId: selectedAccountId ?? null
|
|
57
|
+
}],
|
|
58
|
+
queryFn: async ({ signal }) => {
|
|
59
|
+
const url = new URL("/api/inbox", window.location.origin);
|
|
60
|
+
url.searchParams.set("kind", kind);
|
|
61
|
+
url.searchParams.set("minScore", minScore);
|
|
62
|
+
if (selectedAccountId) url.searchParams.set("account", selectedAccountId);
|
|
63
|
+
if (hideLowSignal) url.searchParams.set("hideLowSignal", "1");
|
|
64
|
+
return fetchJson(url, { signal }, inboxResponseSchema, "Inbox request failed");
|
|
65
|
+
},
|
|
66
|
+
placeholderData: keepPreviousData,
|
|
67
|
+
staleTime: 5 * 6e4
|
|
68
|
+
});
|
|
69
|
+
const items = inboxQuery.data?.items ?? [];
|
|
70
|
+
const stats = inboxQuery.data?.stats ?? null;
|
|
71
|
+
const scoreMutation = useMutation({
|
|
72
|
+
mutationFn: () => postAction({
|
|
73
|
+
kind: "scoreInbox",
|
|
74
|
+
scoreKind: kind,
|
|
75
|
+
account: selectedAccountId,
|
|
76
|
+
limit: 8
|
|
77
|
+
}),
|
|
78
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: queryKeys.inbox })
|
|
79
|
+
});
|
|
80
|
+
const subtitle = useMemo(() => {
|
|
81
|
+
if (!meta || !stats) return "Ranking unreplied mentions and DMs...";
|
|
82
|
+
return `${String(stats.total)} in queue · ${String(stats.openai)} OpenAI scored · ${meta.transport.statusText}`;
|
|
83
|
+
}, [meta, stats]);
|
|
84
|
+
async function scoreNow() {
|
|
85
|
+
await scoreMutation.mutateAsync();
|
|
86
|
+
}
|
|
87
|
+
async function sendReply(item) {
|
|
88
|
+
if (!replyDraft.trim()) return;
|
|
89
|
+
setIsSendingReply(true);
|
|
90
|
+
setReplyError(null);
|
|
91
|
+
try {
|
|
92
|
+
await postAction(item.entityKind === "dm" ? {
|
|
93
|
+
kind: "replyDm",
|
|
94
|
+
conversationId: item.entityId,
|
|
95
|
+
text: replyDraft
|
|
96
|
+
} : {
|
|
97
|
+
kind: "replyTweet",
|
|
98
|
+
accountId: item.accountId,
|
|
99
|
+
tweetId: item.entityId,
|
|
100
|
+
text: replyDraft
|
|
101
|
+
});
|
|
102
|
+
setReplyDraft("");
|
|
103
|
+
setActiveReplyId(null);
|
|
104
|
+
await queryClient.invalidateQueries({ queryKey: queryKeys.inbox });
|
|
105
|
+
} catch (error) {
|
|
106
|
+
setReplyError(error instanceof Error ? error.message : "Reply failed");
|
|
107
|
+
} finally {
|
|
108
|
+
setIsSendingReply(false);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
112
|
+
/* @__PURE__ */ jsxs("header", {
|
|
113
|
+
className: pageHeaderClass,
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsxs("div", {
|
|
116
|
+
className: pageHeaderRowClass,
|
|
117
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
118
|
+
className: "flex min-w-0 flex-col",
|
|
119
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
120
|
+
className: pageTitleClass,
|
|
121
|
+
children: "Inbox"
|
|
122
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
123
|
+
className: pageSubtitleClass,
|
|
124
|
+
children: subtitle
|
|
125
|
+
})]
|
|
126
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
127
|
+
className: primaryButtonClass,
|
|
128
|
+
disabled: scoreMutation.isPending,
|
|
129
|
+
onClick: () => void scoreNow(),
|
|
130
|
+
type: "button",
|
|
131
|
+
children: [/* @__PURE__ */ jsx(Sparkles, {
|
|
132
|
+
className: "size-4",
|
|
133
|
+
strokeWidth: 2.2
|
|
134
|
+
}), scoreMutation.isPending ? "Scoring..." : "Score with OpenAI"]
|
|
135
|
+
})]
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsxs("div", {
|
|
138
|
+
className: "flex flex-wrap items-center gap-2 px-4 pb-3",
|
|
139
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
140
|
+
className: cx(textFieldClass, textFieldShortClass),
|
|
141
|
+
inputMode: "numeric",
|
|
142
|
+
onChange: (event) => updateSearch({
|
|
143
|
+
...searchState,
|
|
144
|
+
minScore: event.target.value
|
|
145
|
+
}, { replace: true }),
|
|
146
|
+
placeholder: "Min AI score",
|
|
147
|
+
value: minScore
|
|
148
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
149
|
+
className: secondaryButtonClass,
|
|
150
|
+
onClick: () => updateSearch({
|
|
151
|
+
...searchState,
|
|
152
|
+
hideLowSignal: !hideLowSignal
|
|
153
|
+
}),
|
|
154
|
+
type: "button",
|
|
155
|
+
"aria-pressed": hideLowSignal,
|
|
156
|
+
children: hideLowSignal ? "Hide low-signal" : "Show all"
|
|
157
|
+
})]
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ jsx("div", {
|
|
160
|
+
className: tabStripClass,
|
|
161
|
+
children: TABS.map((tab) => {
|
|
162
|
+
const active = kind === tab.value;
|
|
163
|
+
return /* @__PURE__ */ jsx("button", {
|
|
164
|
+
type: "button",
|
|
165
|
+
"aria-pressed": active,
|
|
166
|
+
className: cx(tabButtonClass, active && "text-[var(--ink)] font-bold"),
|
|
167
|
+
onClick: () => updateSearch({
|
|
168
|
+
...searchState,
|
|
169
|
+
kind: tab.value
|
|
170
|
+
}),
|
|
171
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
172
|
+
className: "relative inline-flex flex-col items-center justify-center py-1",
|
|
173
|
+
children: [tab.value, active ? /* @__PURE__ */ jsx("span", { className: tabButtonIndicatorClass }) : null]
|
|
174
|
+
})
|
|
175
|
+
}, tab.value);
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}),
|
|
180
|
+
replyError ? /* @__PURE__ */ jsx("p", {
|
|
181
|
+
className: cx(timestampClass, "px-4 py-2 text-red-500"),
|
|
182
|
+
children: replyError
|
|
183
|
+
}) : null,
|
|
184
|
+
/* @__PURE__ */ jsxs("section", {
|
|
185
|
+
className: feedClass,
|
|
186
|
+
children: [items.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
187
|
+
className: emptyStateClass,
|
|
188
|
+
children: "Inbox clear."
|
|
189
|
+
}) : null, items.map((item) => /* @__PURE__ */ jsx(InboxCard, {
|
|
190
|
+
isReplying: activeReplyId === item.id,
|
|
191
|
+
item,
|
|
192
|
+
onReplyChange: setReplyDraft,
|
|
193
|
+
onReplySend: () => void sendReply(item),
|
|
194
|
+
onReplyToggle: () => {
|
|
195
|
+
setReplyError(null);
|
|
196
|
+
if (activeReplyId === item.id) {
|
|
197
|
+
setActiveReplyId(null);
|
|
198
|
+
setReplyDraft("");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
setActiveReplyId(item.id);
|
|
202
|
+
setReplyDraft("");
|
|
203
|
+
},
|
|
204
|
+
replyDraft: activeReplyId === item.id ? replyDraft : ""
|
|
205
|
+
}, item.id))]
|
|
206
|
+
}),
|
|
207
|
+
isSendingReply ? /* @__PURE__ */ jsx("p", {
|
|
208
|
+
className: cx(timestampClass, "px-4 py-2"),
|
|
209
|
+
children: "Sending reply..."
|
|
210
|
+
}) : null
|
|
211
|
+
] });
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { InboxRouteView, InboxRoute as component };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { $ as feedRowBodyClass, At as pillClass, Mt as primaryButtonClass, Wt as secondaryButtonClass, _t as mutedDotClass, c as composerBarClass, ct as feedRowTextClass, et as feedRowClass, it as feedRowNameClass, jt as pillSoftClass, kt as pillAlertClass, l as composerInputClass, lt as feedRowTimestampClass, m as cx, nt as feedRowHandleClass, pn as timestampClass, rt as feedRowHeaderClass, tt as feedRowDotClass, u as composerShellClass, ut as inboxAnalysisClass } from "./ui-qbmcMSSX.js";
|
|
2
|
+
import "./query-client-BdauHBgd.js";
|
|
3
|
+
import { r as formatCompactNumber, t as AvatarChip } from "./AvatarChip-zUDAEmjL.js";
|
|
4
|
+
import "./account-selection-CTdFGWRk.js";
|
|
5
|
+
import { t as SmartTimestamp } from "./SmartTimestamp-DfwE1NGf.js";
|
|
6
|
+
import { i as validateInboxSearch } from "./route-search-BUlQ5lGM.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { Link, createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { CheckCircle2, Circle, ExternalLink, MessageCircle } from "lucide-react";
|
|
11
|
+
import "@tanstack/react-query";
|
|
12
|
+
//#region src/components/InboxCard.tsx
|
|
13
|
+
function InboxCard({ item, isReplying, replyDraft, onReplyChange, onReplyToggle, onReplySend }) {
|
|
14
|
+
return /* @__PURE__ */ jsxs("article", {
|
|
15
|
+
className: cx(feedRowClass, "items-start"),
|
|
16
|
+
children: [/* @__PURE__ */ jsx(AvatarChip, {
|
|
17
|
+
avatarUrl: item.participant.avatarUrl,
|
|
18
|
+
hue: item.participant.avatarHue,
|
|
19
|
+
name: item.participant.displayName,
|
|
20
|
+
profileId: item.participant.id
|
|
21
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: feedRowBodyClass,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("header", {
|
|
25
|
+
className: feedRowHeaderClass,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxs("span", {
|
|
28
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
29
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: feedRowNameClass,
|
|
31
|
+
children: item.participant.displayName
|
|
32
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
33
|
+
className: feedRowHandleClass,
|
|
34
|
+
children: ["@", item.participant.handle]
|
|
35
|
+
})]
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: feedRowDotClass,
|
|
39
|
+
children: "·"
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx(SmartTimestamp, {
|
|
42
|
+
className: feedRowTimestampClass,
|
|
43
|
+
value: item.createdAt
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsxs("span", {
|
|
46
|
+
className: "ml-auto flex items-center gap-1.5",
|
|
47
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: cx(pillClass, pillSoftClass),
|
|
49
|
+
children: item.entityKind
|
|
50
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
51
|
+
className: cx(pillClass, pillAlertClass),
|
|
52
|
+
children: ["score ", item.score]
|
|
53
|
+
})]
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("h3", {
|
|
58
|
+
className: "text-[15px] font-bold text-[var(--ink)]",
|
|
59
|
+
children: item.title
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ jsx("p", {
|
|
62
|
+
className: feedRowTextClass,
|
|
63
|
+
children: item.text
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: inboxAnalysisClass,
|
|
67
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
68
|
+
className: "text-[var(--ink)]",
|
|
69
|
+
children: item.summary
|
|
70
|
+
}), /* @__PURE__ */ jsx("p", { children: item.reasoning })]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "mt-2 flex items-center justify-between gap-3 text-[13px] text-[var(--ink-soft)]",
|
|
74
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: "flex flex-wrap items-center gap-2",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx("span", { children: item.source }),
|
|
78
|
+
/* @__PURE__ */ jsx("span", { className: mutedDotClass }),
|
|
79
|
+
/* @__PURE__ */ jsxs("span", { children: ["influence ", formatCompactNumber(item.influenceScore)] }),
|
|
80
|
+
/* @__PURE__ */ jsx("span", { className: mutedDotClass }),
|
|
81
|
+
/* @__PURE__ */ jsxs("span", {
|
|
82
|
+
className: "inline-flex items-center gap-1",
|
|
83
|
+
children: [item.needsReply ? /* @__PURE__ */ jsx(Circle, {
|
|
84
|
+
className: "size-3",
|
|
85
|
+
strokeWidth: 2.2
|
|
86
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
87
|
+
className: "size-3.5",
|
|
88
|
+
strokeWidth: 2
|
|
89
|
+
}), item.needsReply ? "open" : "replied"]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
93
|
+
className: "flex items-center gap-2",
|
|
94
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
95
|
+
className: secondaryButtonClass,
|
|
96
|
+
onClick: onReplyToggle,
|
|
97
|
+
type: "button",
|
|
98
|
+
children: [/* @__PURE__ */ jsx(MessageCircle, {
|
|
99
|
+
className: "size-4",
|
|
100
|
+
strokeWidth: 2
|
|
101
|
+
}), isReplying ? "Close reply" : "Reply"]
|
|
102
|
+
}), /* @__PURE__ */ jsxs(Link, {
|
|
103
|
+
className: cx(secondaryButtonClass, "gap-1.5"),
|
|
104
|
+
to: item.entityKind === "dm" ? "/dms" : "/mentions",
|
|
105
|
+
children: [/* @__PURE__ */ jsx(ExternalLink, {
|
|
106
|
+
className: "size-4",
|
|
107
|
+
strokeWidth: 2
|
|
108
|
+
}), "Open"]
|
|
109
|
+
})]
|
|
110
|
+
})]
|
|
111
|
+
}),
|
|
112
|
+
isReplying ? /* @__PURE__ */ jsxs("div", {
|
|
113
|
+
className: composerShellClass,
|
|
114
|
+
children: [/* @__PURE__ */ jsx("textarea", {
|
|
115
|
+
className: composerInputClass,
|
|
116
|
+
onChange: (event) => onReplyChange(event.target.value),
|
|
117
|
+
placeholder: item.entityKind === "dm" ? `Reply to @${item.participant.handle}` : `Reply to mention from @${item.participant.handle}`,
|
|
118
|
+
rows: 4,
|
|
119
|
+
value: replyDraft
|
|
120
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: composerBarClass,
|
|
122
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
123
|
+
className: timestampClass,
|
|
124
|
+
children: "Send from inbox"
|
|
125
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
126
|
+
className: primaryButtonClass,
|
|
127
|
+
disabled: !replyDraft.trim(),
|
|
128
|
+
onClick: onReplySend,
|
|
129
|
+
type: "button",
|
|
130
|
+
children: "Send"
|
|
131
|
+
})]
|
|
132
|
+
})]
|
|
133
|
+
}) : null
|
|
134
|
+
]
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/routes/inbox.tsx
|
|
140
|
+
var $$splitComponentImporter = () => import("./inbox-CkGOaW1q.js");
|
|
141
|
+
var Route$1 = createFileRoute("/inbox")({
|
|
142
|
+
component: lazyRouteComponent($$splitComponentImporter, "component"),
|
|
143
|
+
validateSearch: validateInboxSearch
|
|
144
|
+
});
|
|
145
|
+
//#endregion
|
|
146
|
+
export { InboxCard as n, Route$1 as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as SavedTimelineView } from "./SavedTimelineView-BG1jnBp1.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/routes/likes.tsx?tsr-split=component
|
|
4
|
+
function LikesRoute() {
|
|
5
|
+
return /* @__PURE__ */ jsx(SavedTimelineView, {
|
|
6
|
+
eyebrow: "liked posts",
|
|
7
|
+
filter: "liked",
|
|
8
|
+
loadingLabel: "Loading liked posts...",
|
|
9
|
+
searchPlaceholder: "Search likes",
|
|
10
|
+
title: "Things worth keeping in the orbit."
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { LikesRoute as component };
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import "./ui-qbmcMSSX.js";
|
|
2
|
+
import { b as linkInsightResponseSchema, n as queryKeys, r as fetchJson } from "./query-client-BdauHBgd.js";
|
|
3
|
+
import { r as formatCompactNumber } from "./AvatarChip-zUDAEmjL.js";
|
|
4
|
+
import "./FeedState-ntW0Q2GB.js";
|
|
5
|
+
import "./ProfilePreview-C6gAor_j.js";
|
|
6
|
+
import "./SmartTimestamp-DfwE1NGf.js";
|
|
7
|
+
import { t as hydrateProfileHandles } from "./profile-hydration-client-GJ4kwJS8.js";
|
|
8
|
+
import { a as validateLinksSearch } from "./route-search-BUlQ5lGM.js";
|
|
9
|
+
import { useEffect, useMemo } from "react";
|
|
10
|
+
import { createFileRoute, lazyRouteComponent } from "@tanstack/react-router";
|
|
11
|
+
import "react/jsx-runtime";
|
|
12
|
+
import "lucide-react";
|
|
13
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
14
|
+
var PROFILE_HYDRATION_DELAY_MS = 1200;
|
|
15
|
+
var LINK_INSIGHTS_CACHE_MAX_AGE_MS = 5 * 6e4;
|
|
16
|
+
var ranges = [
|
|
17
|
+
{
|
|
18
|
+
value: "today",
|
|
19
|
+
label: "Today"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "week",
|
|
23
|
+
label: "Week"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "month",
|
|
27
|
+
label: "Month"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "year",
|
|
31
|
+
label: "Year"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: "all",
|
|
35
|
+
label: "All"
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
function itemTitle(item) {
|
|
39
|
+
return item.title?.trim() || item.displayUrl;
|
|
40
|
+
}
|
|
41
|
+
function itemSubtitle(item) {
|
|
42
|
+
const description = item.description?.trim();
|
|
43
|
+
if (description) return description;
|
|
44
|
+
return item.displayUrl.split("?")[0] || item.displayUrl;
|
|
45
|
+
}
|
|
46
|
+
function linkInsightQueryKey(kind, range, sort, source) {
|
|
47
|
+
return [...queryKeys.linkInsights, {
|
|
48
|
+
kind,
|
|
49
|
+
range,
|
|
50
|
+
sort,
|
|
51
|
+
source
|
|
52
|
+
}];
|
|
53
|
+
}
|
|
54
|
+
function linkInsightsUrl(kind, range, sort, source) {
|
|
55
|
+
const url = new URL("/api/link-insights", window.location.origin);
|
|
56
|
+
url.searchParams.set("kind", kind);
|
|
57
|
+
url.searchParams.set("range", range);
|
|
58
|
+
url.searchParams.set("sort", sort);
|
|
59
|
+
url.searchParams.set("source", source);
|
|
60
|
+
url.searchParams.set("limit", String(30));
|
|
61
|
+
url.searchParams.set("commentsLimit", String(30));
|
|
62
|
+
return url;
|
|
63
|
+
}
|
|
64
|
+
async function fetchLinkInsights(kind, range, sort, source, signal) {
|
|
65
|
+
return fetchJson(linkInsightsUrl(kind, range, sort, source), { signal }, linkInsightResponseSchema, "Link insights unavailable");
|
|
66
|
+
}
|
|
67
|
+
function mentionHref(mention, item) {
|
|
68
|
+
return mention.sourceUrl || mention.contentTweetUrl || item.url;
|
|
69
|
+
}
|
|
70
|
+
function mentionCopy(mention) {
|
|
71
|
+
return mention.commentText || mention.sharedContentText || mention.rawText || "Shared without comment";
|
|
72
|
+
}
|
|
73
|
+
function isSameProfile(left, right) {
|
|
74
|
+
return Boolean(left && right && left.id === right.id);
|
|
75
|
+
}
|
|
76
|
+
function mediaImage(media) {
|
|
77
|
+
return media.find((item) => item.thumbnailUrl || item.url) ?? null;
|
|
78
|
+
}
|
|
79
|
+
function youtubeVideoId(rawUrl) {
|
|
80
|
+
try {
|
|
81
|
+
const url = new URL(rawUrl);
|
|
82
|
+
const host = url.hostname.toLowerCase().replace(/^www\./, "");
|
|
83
|
+
if (host === "youtu.be") return url.pathname.split("/").filter(Boolean)[0] ?? null;
|
|
84
|
+
if (!host.endsWith("youtube.com")) return null;
|
|
85
|
+
if (url.pathname === "/watch") return url.searchParams.get("v");
|
|
86
|
+
const parts = url.pathname.split("/").filter(Boolean);
|
|
87
|
+
if (parts[0] === "embed" || parts[0] === "shorts" || parts[0] === "live") return parts[1] ?? null;
|
|
88
|
+
return null;
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function youtubeThumbnailUrl(rawUrl) {
|
|
94
|
+
const id = youtubeVideoId(rawUrl);
|
|
95
|
+
if (!id || !/^[\w-]{6,}$/.test(id)) return null;
|
|
96
|
+
return `https://i.ytimg.com/vi/${encodeURIComponent(id)}/hqdefault.jpg`;
|
|
97
|
+
}
|
|
98
|
+
function commentCount(item) {
|
|
99
|
+
return item.commentCount ?? item.mentions.filter((mention) => mention.hasComment).length;
|
|
100
|
+
}
|
|
101
|
+
function pureShareCount(item) {
|
|
102
|
+
return item.pureShareCount ?? item.mentions.filter((mention) => mention.isPureShare || !mention.hasComment).length;
|
|
103
|
+
}
|
|
104
|
+
function isArchivePlaceholderProfile(profile) {
|
|
105
|
+
return /^id\d+$/i.test(profile.handle) && profile.displayName === profile.handle && profile.id === `profile_user_${profile.handle.slice(2)}`;
|
|
106
|
+
}
|
|
107
|
+
function profileNeedsHydration(profile) {
|
|
108
|
+
if (!profile?.handle || isArchivePlaceholderProfile(profile)) return false;
|
|
109
|
+
return !profile.avatarUrl || profile.followersCount === 0;
|
|
110
|
+
}
|
|
111
|
+
function collectProfilesForHydration(data) {
|
|
112
|
+
const handles = /* @__PURE__ */ new Set();
|
|
113
|
+
for (const item of data?.items ?? []) for (const profile of [
|
|
114
|
+
item.topSharer,
|
|
115
|
+
...item.sharers,
|
|
116
|
+
...item.mentions.flatMap((mention) => [
|
|
117
|
+
mention.sharedBy,
|
|
118
|
+
mention.contentAuthor,
|
|
119
|
+
mention.participant
|
|
120
|
+
])
|
|
121
|
+
]) {
|
|
122
|
+
if (!profile || !profileNeedsHydration(profile)) continue;
|
|
123
|
+
handles.add(profile.handle.replace(/^@/, ""));
|
|
124
|
+
if (handles.size >= 30) return [...handles];
|
|
125
|
+
}
|
|
126
|
+
return [...handles];
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/components/links-controller.ts
|
|
130
|
+
function useLinksController(filters, onFiltersChange) {
|
|
131
|
+
const queryClient = useQueryClient();
|
|
132
|
+
const { kind, range, source, sort, q: search } = filters;
|
|
133
|
+
const insightsQuery = useQuery({
|
|
134
|
+
queryKey: linkInsightQueryKey(kind, range, sort, source),
|
|
135
|
+
queryFn: ({ signal }) => fetchLinkInsights(kind, range, sort, source, signal),
|
|
136
|
+
staleTime: LINK_INSIGHTS_CACHE_MAX_AGE_MS
|
|
137
|
+
});
|
|
138
|
+
const data = insightsQuery.data ?? null;
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!data) return;
|
|
141
|
+
const prefetchKind = kind === "links" ? "videos" : "links";
|
|
142
|
+
const timer = window.setTimeout(() => {
|
|
143
|
+
queryClient.prefetchQuery({
|
|
144
|
+
queryKey: linkInsightQueryKey(prefetchKind, range, sort, source),
|
|
145
|
+
queryFn: ({ signal }) => fetchLinkInsights(prefetchKind, range, sort, source, signal),
|
|
146
|
+
staleTime: LINK_INSIGHTS_CACHE_MAX_AGE_MS
|
|
147
|
+
});
|
|
148
|
+
}, 250);
|
|
149
|
+
return () => window.clearTimeout(timer);
|
|
150
|
+
}, [
|
|
151
|
+
data,
|
|
152
|
+
kind,
|
|
153
|
+
queryClient,
|
|
154
|
+
range,
|
|
155
|
+
sort,
|
|
156
|
+
source
|
|
157
|
+
]);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
const handles = collectProfilesForHydration(data);
|
|
160
|
+
if (handles.length === 0) return;
|
|
161
|
+
let active = true;
|
|
162
|
+
let idleId = null;
|
|
163
|
+
const runHydration = () => {
|
|
164
|
+
hydrateProfileHandles(queryClient, handles, { limit: 30 }).then((response) => {
|
|
165
|
+
if (!active) return;
|
|
166
|
+
if (response.fetchedResults.some((result) => result.status === "hit")) queryClient.invalidateQueries({ queryKey: queryKeys.linkInsights });
|
|
167
|
+
}).catch((error) => {
|
|
168
|
+
if (!active) return;
|
|
169
|
+
console.warn("Profile hydration failed", error);
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
const timer = window.setTimeout(() => {
|
|
173
|
+
if ("requestIdleCallback" in window) idleId = window.requestIdleCallback(runHydration, { timeout: 2500 });
|
|
174
|
+
else runHydration();
|
|
175
|
+
}, PROFILE_HYDRATION_DELAY_MS);
|
|
176
|
+
return () => {
|
|
177
|
+
active = false;
|
|
178
|
+
window.clearTimeout(timer);
|
|
179
|
+
if (idleId !== null && "cancelIdleCallback" in window) window.cancelIdleCallback(idleId);
|
|
180
|
+
};
|
|
181
|
+
}, [data, queryClient]);
|
|
182
|
+
return {
|
|
183
|
+
kind,
|
|
184
|
+
setKind: (value) => onFiltersChange({
|
|
185
|
+
...filters,
|
|
186
|
+
kind: value
|
|
187
|
+
}),
|
|
188
|
+
range,
|
|
189
|
+
setRange: (value) => onFiltersChange({
|
|
190
|
+
...filters,
|
|
191
|
+
range: value
|
|
192
|
+
}),
|
|
193
|
+
source,
|
|
194
|
+
setSource: (value) => onFiltersChange({
|
|
195
|
+
...filters,
|
|
196
|
+
source: value
|
|
197
|
+
}),
|
|
198
|
+
sort,
|
|
199
|
+
setSort: (value) => onFiltersChange({
|
|
200
|
+
...filters,
|
|
201
|
+
sort: value
|
|
202
|
+
}),
|
|
203
|
+
search,
|
|
204
|
+
setSearch: (value) => onFiltersChange({
|
|
205
|
+
...filters,
|
|
206
|
+
q: value
|
|
207
|
+
}, { replace: true }),
|
|
208
|
+
items: useMemo(() => {
|
|
209
|
+
const query = search.trim().toLowerCase();
|
|
210
|
+
return (data?.items ?? []).filter((item) => {
|
|
211
|
+
if (!query) return true;
|
|
212
|
+
return [
|
|
213
|
+
item.title,
|
|
214
|
+
item.description,
|
|
215
|
+
item.displayUrl,
|
|
216
|
+
item.host,
|
|
217
|
+
item.topSharer?.handle,
|
|
218
|
+
...item.mentions.map((mention) => mention.commentText)
|
|
219
|
+
].filter(Boolean).some((value) => String(value).toLowerCase().includes(query));
|
|
220
|
+
});
|
|
221
|
+
}, [data?.items, search]),
|
|
222
|
+
subtitle: useMemo(() => {
|
|
223
|
+
if (!data) return "Loading link memory...";
|
|
224
|
+
const label = kind === "videos" ? "video URLs" : "URLs";
|
|
225
|
+
return `${formatCompactNumber(data.stats.occurrences)} ${label} across ${formatCompactNumber(data.stats.groups)} groups`;
|
|
226
|
+
}, [data, kind]),
|
|
227
|
+
loading: insightsQuery.isPending,
|
|
228
|
+
error: insightsQuery.error ? insightsQuery.error instanceof Error ? insightsQuery.error.message : "Link insights unavailable" : null,
|
|
229
|
+
retry: insightsQuery.refetch
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/routes/links.tsx
|
|
234
|
+
var $$splitComponentImporter = () => import("./links-DmH5lxHO.js");
|
|
235
|
+
var Route$1 = createFileRoute("/links")({
|
|
236
|
+
component: lazyRouteComponent($$splitComponentImporter, "component"),
|
|
237
|
+
validateSearch: validateLinksSearch
|
|
238
|
+
});
|
|
239
|
+
//#endregion
|
|
240
|
+
export { itemSubtitle as a, mentionCopy as c, ranges as d, youtubeThumbnailUrl as f, isSameProfile as i, mentionHref as l, useLinksController as n, itemTitle as o, commentCount as r, mediaImage as s, Route$1 as t, pureShareCount as u };
|