feat(activity): remit_received events drill to RemitDrawer
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { useSearchParams, useNavigate } from "react-router-dom";
|
||||
import { toast } from "sonner";
|
||||
import { useActivity } from "@/hooks/useActivity";
|
||||
import { useTailStream } from "@/hooks/useTailStream";
|
||||
import { useMergedTail } from "@/hooks/useMergedTail";
|
||||
import { useRemitDrawerUrlState } from "@/hooks/useRemitDrawerUrlState";
|
||||
import { eventKindToUrl } from "@/lib/event-routing";
|
||||
import { TailStatusPill } from "@/components/TailStatusPill";
|
||||
import { PageHeader } from "@/components/PageHeader";
|
||||
import { ActivityFeed } from "@/components/ActivityFeed";
|
||||
import { ActivityFilters, type SinceValue } from "@/components/ActivityFilters";
|
||||
import { RemitDrawer } from "@/components/RemitDrawer";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { EmptyState } from "@/components/ui/empty-state";
|
||||
import { ErrorState } from "@/components/ui/error-state";
|
||||
@@ -35,6 +39,13 @@ function useSinceIso(since: SinceValue): string | undefined {
|
||||
|
||||
export function ActivityLog() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
// SP21 Phase 4 Task 4.7: `remit_received` events with a
|
||||
// remittanceId drill into the RemitDrawer. Calling `open(id)`
|
||||
// pushes `?remit=ID` onto the current URL (no navigation away
|
||||
// from `/activity`), so the activity feed stays visible behind
|
||||
// the drawer and the drawer portals in over it.
|
||||
const { remitId, open, close } = useRemitDrawerUrlState();
|
||||
|
||||
const selectedKinds = useMemo<ActivityKind[]>(
|
||||
() =>
|
||||
@@ -163,9 +174,48 @@ export function ActivityLog() {
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<ActivityFeed items={items} emptyMessage="No activity recorded yet." />
|
||||
<ActivityFeed
|
||||
items={items}
|
||||
emptyMessage="No activity recorded yet."
|
||||
onItemClick={(evt) => {
|
||||
// SP21 Phase 4 Task 4.7: drill into the right surface
|
||||
// based on event kind. `claim_*` and `provider_added`
|
||||
// navigate away via `eventKindToUrl` (the Dashboard uses
|
||||
// the same helper). `remit_received` events stay on
|
||||
// `/activity` and open the RemitDrawer via `open(id)`
|
||||
// — `eventKindToUrl` still returns `null` for that kind
|
||||
// because cross-page navigation isn't the right UX here
|
||||
// (we want to keep the activity feed as context behind
|
||||
// the drawer). Anything else falls back to the
|
||||
// "coming soon" toast so the click still gives feedback.
|
||||
const url = eventKindToUrl(evt);
|
||||
if (url) navigate(url);
|
||||
else if (evt.kind === "remit_received" && evt.remittanceId) {
|
||||
open(evt.remittanceId);
|
||||
} else {
|
||||
toast.info(
|
||||
`Drill for ${evt.kind.replace(/_/g, " ")} coming in a later phase.`,
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* SP21 Phase 4 Task 4.7: RemitDrawer mount. The activity
|
||||
feed's `remit_received` rows drill into the drawer via
|
||||
`open()`. `remits` is empty (the activity feed doesn't
|
||||
keep a flat list of remits around), so j/k is a no-op
|
||||
here — closing reverts the URL via `close()`. */}
|
||||
<RemitDrawer
|
||||
remitId={remitId}
|
||||
remits={[]}
|
||||
onClose={close}
|
||||
onNavigate={open}
|
||||
onToggleHelp={() => {
|
||||
// ActivityLog has no cheatsheet; `?` is a no-op here.
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user