import React from 'react'; interface Props { useUrl: boolean; setUseUrl: (v: boolean) => void; prUrl: string; setPrUrl: (v: string) => void; owner: string; setOwner: (v: string) => void; repo: string; setRepo: (v: string) => void; prNumber: string; setPrNumber: (v: string) => void; /** unique prefix so id attributes don't collide when both PR & Drift forms mount */ idPrefix?: string; } /** * Shared PR reference input — used by PR Intelligence and Architecture Drift. * Owns: URL vs (owner/repo/number) toggle + labelled inputs. * * The mode toggle is a thin underlined rail matching the analysis tab rail, and * the fields are `console-field` surfaces so a pasted PR URL reads as input * rather than as a form widget. Roles, ids and state wiring are unchanged. */ export const PRReferenceForm: React.FC = ({ useUrl, setUseUrl, prUrl, setPrUrl, owner, setOwner, repo, setRepo, prNumber, setPrNumber, idPrefix = 'pr', }) => (
{(['url', 'coords'] as const).map((k) => { const active = (k === 'url') === useUrl; return ( ); })}
{useUrl ? ( setPrUrl(e.target.value)} /> ) : (
setOwner(e.target.value)} /> setRepo(e.target.value)} /> setPrNumber(e.target.value)} />
)}
); const Field: React.FC<{ id: string; label: string; children: React.ReactNode }> = ({ id, label, children, }) => (
{children}
); export default PRReferenceForm;