Open source CapCut alternative.
TypeScript
feat(site): outreach admin searches every tab at once
David Lee911f2288235
diff --git a/site/src/app/su/SuHeader.tsx b/site/src/app/su/SuHeader.tsxindex 8689a127..82f896b9 100644--- a/site/src/app/su/SuHeader.tsx+++ b/site/src/app/su/SuHeader.tsx@@ -13,7 +13,11 @@ export function SuHeader() {<div className="sticky top-0 z-20 mx-auto flex w-full max-w-6xl shrink-0 items-start justify-between gap-4 bg-background px-10 pt-9 pb-5"><div><h1 className="text-lg font-semibold tracking-tight">{section.title}</h1>- <p className="mt-1 text-sm text-muted-foreground">{section.description}</p>+ {section.description ? (+ <p className="mt-1 text-sm text-muted-foreground">+ {section.description}+ </p>+ ) : null}</div>{section.Action ? <section.Action /> : null}</div>diff --git a/site/src/app/su/nav.ts b/site/src/app/su/nav.tsindex d069571f..958b9f45 100644--- a/site/src/app/su/nav.ts+++ b/site/src/app/su/nav.ts@@ -14,7 +14,7 @@ export type SuSurface = {label: string;icon: typeof UserRound;title: string;- description: string;+ description?: string;Action?: ComponentType;};@@ -46,7 +46,6 @@ export const SU_NAV: SuSurface[] = [label: "Outreach",icon: Mail,title: "Outreach",- description: "Free accounts spending credits, and where each conversation stands.",Action: ScanOutreachButton,},{diff --git a/site/src/app/su/outreach/page.tsx b/site/src/app/su/outreach/page.tsxindex 9c7c292b..020ebb55 100644--- a/site/src/app/su/outreach/page.tsx+++ b/site/src/app/su/outreach/page.tsx@@ -95,6 +95,7 @@ function RowBadges({ row }: { row: OutreachRow }) {export default function SuOutreachPage() {const [status, setStatus] = useState<OutreachStatus>("todo");+ const [query, setQuery] = useState("");const [sendTarget, setSendTarget] = useState<OutreachRow | null>(null);const [source, setSource] = useState(BLANK);const [subject, setSubject] = useState("");@@ -102,7 +103,14 @@ export default function SuOutreachPage() {const [templateName, setTemplateName] = useState("");const [naming, setNaming] = useState(false);const bodyField = useRef<HTMLTextAreaElement>(null);- const list = useOutreach(status);+ // Search runs in the browser across every tab, so all four lists stay+ // mounted; each tab keeps its own rows and reports its own match count.+ const lists = {+ ignored: useOutreach("ignored"),+ replied: useOutreach("replied"),+ sent: useOutreach("sent"),+ todo: useOutreach("todo"),+ };const counts = useOutreachCounts().data?.counts;const act = useOutreachAction();const busy = useBusyOutreachIds();@@ -277,7 +285,16 @@ export default function SuOutreachPage() {);};- const rows = list.data?.rows ?? [];+ const needle = query.trim().toLowerCase();+ const matches = (row: OutreachRow) =>+ needle === "" ||+ row.name.toLowerCase().includes(needle) ||+ row.email.toLowerCase().includes(needle);+ const rowsFor = (of: OutreachStatus) =>+ (lists[of].data?.rows ?? []).filter(matches);++ const list = lists[status];+ const rows = rowsFor(status);const sending = sendTarget !== null && busy.has(sendTarget.id);// A failed send keeps its dialog open, so the reason belongs in there with// the words that still need fixing.@@ -285,6 +302,14 @@ export default function SuOutreachPage() {return (<div className="space-y-4 pb-9">+ <Input+ className="max-w-sm"+ onChange={(event) => setQuery(event.target.value)}+ placeholder="Search name or email"+ type="search"+ value={query}+ />+<div className="flex flex-wrap items-center gap-2">{FILTERS.map((filter) => (<Button@@ -294,7 +319,11 @@ export default function SuOutreachPage() {variant={status === filter.status ? "default" : "outline"}>{filter.label}- {counts ? (+ {needle !== "" ? (+ <span className="tabular-nums opacity-60">+ {rowsFor(filter.status).length}+ </span>+ ) : counts ? (<span className="tabular-nums opacity-60">{counts[filter.status]}</span>@@ -369,7 +398,11 @@ export default function SuOutreachPage() {</ul>) : (<p className="p-5 text-sm text-muted-foreground">- {list.isPending ? "Loading…" : "Nothing here. Run a scan to refresh."}+ {list.isPending+ ? "Loading…"+ : needle !== ""+ ? "No matches."+ : "Nothing here. Run a scan to refresh."}</p>)}</div>