Repository navigation
Build the portal conversation view (W6-03) #137 - #150
Conversation
calebyhan
left a comment
There was a problem hiding this comment.
404 state is never visible in the inbox. Issue #137 asks for a 404 to show "This conversation is no longer available" and clear the selection. Right now ConversationView calls onUnavailable() in an effect as soon as the 404 arrives. Inbox passes clearSelection for that, so selectedId becomes null and the view is removed. The message shows for at most one frame before the pane switches to "Select a conversation from the inbox." The test only renders ConversationView on its own, so it doesn't catch this.
Suggested fix: keep the unavailable state on screen and clear the selection when the responder clicks "Back to inbox", or have Inbox show the message after it clears the selection. Please add an Inbox-level test that checks the message is still visible after a 404.
Note: when a shift ends, the inbox refetch also drops the conversation, which clears the selection too. So the message only stays visible if the view, not the inbox, is what shows it.
# Conflicts: # frontend/src/components/portal/Inbox.tsx # frontend/src/lib/portal/queries.ts
Motivation
This is where responders actually talk to students: the full history of the open conversation, live, with a composer and an "End conversation" button (TDD 4.3.2). The API is #114, and #121 already keeps ["conversation", id] up to date from the socket.
Changes:
ConversationView, shown in the inbox's right-hand slot for active and queued conversations.TODO(#137))./api/portal/conversations/{id}/messages. A message shows as pending until the request returns. A failed send shows "Not sent. Tap to retry." If the socket already delivered the saved message, it isn't added twice./end.useConversation(id)tolib/portal/queries.ts, using the existingconversationQueryKeythat the portal socket already keeps up to date.selfandlabelsprops toMessageListso the portal reuses it instead of copying it. The student chat's defaults are unchanged.descriptionprop toEndConversationDialog, because the default text is written for texters.Not included: the typing indicator
Known limitation: if a send fails after the server already saved the message, retrying can post it twice. The send endpoint has no idempotency key.
No texter identifiers are shown or sent. The view only uses the label, status, timestamps, and message bodies from the existing DTOs.
Closes #137