import { ArrowLeft } from "@phosphor-icons/react/dist/icons/ArrowLeft"; import { useQuery } from "@tanstack/react-query"; import { Link, useParams, useSearch } from "@tanstack/react-router"; import * as stylex from "@stylexjs/stylex"; import InlineError from "@/lib/InlineError"; import { queryDetailQuery } from "@/lib/queries"; import type { QueryDetail } from "@/lib/types"; import { styles as shared } from "@/ui/styles"; import { colors } from "@/ui/tokens.stylex"; import ProvenanceDetail from "./ProvenanceDetail"; import RelatedActions from "./RelatedActions"; import type { ActivitySearch } from "./search"; const styles = stylex.create({ back: { display: "inline-flex", alignItems: "center", gap: "0.25rem", fontSize: "0.875rem", lineHeight: "1.25rem", color: colors.primaryOnSurface, textDecorationLine: "none", }, backIcon: { display: "inline-flex", }, /** About the height of the filled detail surface, so it does not jump in. */ loading: { marginTop: "1rem", minHeight: "20rem", color: colors.textMuted, }, }); /** * The way back to the investigation, not to a bare list. The originating * Activity search rides in this route's own search, so the reader returns to * the mode, the filters and the absolute window they left — a plain `/activity` * would silently widen the range they had chosen. */ function BackLink({ origin }: { origin: ActivitySearch }) { return ( Activity ); } export default function ActivityDetailPage() { const { id } = useParams({ from: "/shell/activity/queries/$id" }); const origin = useSearch({ from: "/shell/activity/queries/$id" }); const rowId = Number(id); const { data, error, isPending, refetch } = useQuery(queryDetailQuery(rowId)); if (isPending) { return (
Loading query…
); } if (data === undefined) { return (