import { Info } from 'lucide-react'; import { Button } from '#/components/atoms/button.jsx'; import { Dialog } from '#/components/molecules/dialog.jsx'; import { JsonView } from '#/components/molecules/json-view.jsx'; import { sourceAuthLabel } from '#/lib/spaces.js'; /** A labelled line in the dialog. */ function Line({ label, children }) { return (
{label} {children}
); } /** * Where a screen's values came from: the method that answered, the server it * was addressed to, what was presented to it, and the response itself. * * A space is served by two roles on two different hosts, and which one answered * is the thing a reader most often wants and can least often tell. The response * is shown whole rather than summarised, because the point is to be able to * check the page against it. * * @param {Object} props * @param {import('#/lib/spaces.js').Source} props.source * @param {unknown} props.value - the response body, shown as it arrived * @param {string} [props.note] - what the host was acting as * @param {Record} [props.fields] - which key feeds which row */ export function SourceDialog({ source, value, note, fields }) { return ( } >
{note && (

{note}

)}
{source.method} {source.host} {sourceAuthLabel(source)} {source.after && ( {source.after} answered 501, so the other name was tried )}
{fields && (

What each row reads

{Object.entries(fields).map(([row, path]) => (
{row} {path}
))}
)}

The response

); }