Show the customer's terminal session on the support ticket page

React · React · intermediate · modification

Agents kept asking customers to paste their failing command into the reply, although the contact form already has a "What did you run?" box; the ticket page just never showed it. This shows it the way the docs site shows CLI sessions. `package.json` adds `prismjs` (pinned exactly like the rest of our dependencies, at 1.26.0, the version the docs site uses, so the shared token colours look the same), and `package-lock.json` gets its registry entry. `src/tickets/TerminalSession.jsx` (new) splits the session into lines, strips the `$ ` from command lines, passes the other line numbers to the Command Line plugin as `data-output`, writes the text into the `<code>` element and highlights it with `Prism.highlightElement`; it shows "No terminal session." when there is none. `src/tickets/TicketDetail.jsx` adds the section under the message. `src/tickets/TerminalSession.test.jsx` (new) renders a session with two commands and an error line, checking the text, the prompts and which lines get one, and renders a ticket without a session.

Support dashboard of DeployHub, an app-hosting platform: a React 18.3 single-page app built with Vite 5, function components, tests with Vitest 2, @testing-library/react 16 and jsdom (`npm test`). It is served from `support.deployhub.example`, the same origin as the support API, and agents sign in with a session cookie that the browser sends with every same-origin API request; the dashboard sends no Content-Security-Policy header. `TicketDetail` receives `ticket` from `GET /api/support/tickets/:id` (existing, unchanged). `ticket.terminalSession` is the contact-form field as stored: a string of 1 to 4000 characters, any characters (the form's textarea accepts anything), with line breaks stored as `\n` (the API turns `\r\n` into `\n`), or `null` when the customer left it blank (blank or whitespace-only input is stored as `null`); a ticket's fields never change after it is opened. This is the first use of Prism in the dashboard. The global stylesheet `src/styles.css` (existing, unchanged, imported once by the app) already has the docs site's colours for Prism's `.token` classes, plus `.muted` and `.note-text`. CI runs `npm ci` and `npm test` on every pull request; it has no dependency audit step. `package-lock.json` (lockfileVersion 3) is shown trimmed to its top-level fields, the root entry and the entry this PR adds; the other entries are unchanged and all resolve from `https://registry.npmjs.org/`.

Requirements

Files touched

Review this PR

React practice