Remove comment composer interrupt checkbox
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
74687553f3
commit
bc61eb84df
2 changed files with 5 additions and 35 deletions
|
|
@ -40,12 +40,7 @@ interface CommentThreadProps {
|
||||||
linkedRuns?: LinkedRunItem[];
|
linkedRuns?: LinkedRunItem[];
|
||||||
companyId?: string | null;
|
companyId?: string | null;
|
||||||
projectId?: string | null;
|
projectId?: string | null;
|
||||||
onAdd: (
|
onAdd: (body: string, reopen?: boolean, reassignment?: CommentReassignment) => Promise<void>;
|
||||||
body: string,
|
|
||||||
reopen?: boolean,
|
|
||||||
reassignment?: CommentReassignment,
|
|
||||||
interrupt?: boolean,
|
|
||||||
) => Promise<void>;
|
|
||||||
issueStatus?: string;
|
issueStatus?: string;
|
||||||
agentMap?: Map<string, Agent>;
|
agentMap?: Map<string, Agent>;
|
||||||
imageUploadHandler?: (file: File) => Promise<string>;
|
imageUploadHandler?: (file: File) => Promise<string>;
|
||||||
|
|
@ -58,7 +53,6 @@ interface CommentThreadProps {
|
||||||
currentAssigneeValue?: string;
|
currentAssigneeValue?: string;
|
||||||
suggestedAssigneeValue?: string;
|
suggestedAssigneeValue?: string;
|
||||||
mentions?: MentionOption[];
|
mentions?: MentionOption[];
|
||||||
interruptAvailable?: boolean;
|
|
||||||
onInterruptQueued?: (runId: string) => Promise<void>;
|
onInterruptQueued?: (runId: string) => Promise<void>;
|
||||||
interruptingQueuedRunId?: string | null;
|
interruptingQueuedRunId?: string | null;
|
||||||
}
|
}
|
||||||
|
|
@ -329,13 +323,11 @@ export function CommentThread({
|
||||||
currentAssigneeValue = "",
|
currentAssigneeValue = "",
|
||||||
suggestedAssigneeValue,
|
suggestedAssigneeValue,
|
||||||
mentions: providedMentions,
|
mentions: providedMentions,
|
||||||
interruptAvailable = false,
|
|
||||||
onInterruptQueued,
|
onInterruptQueued,
|
||||||
interruptingQueuedRunId = null,
|
interruptingQueuedRunId = null,
|
||||||
}: CommentThreadProps) {
|
}: CommentThreadProps) {
|
||||||
const [body, setBody] = useState("");
|
const [body, setBody] = useState("");
|
||||||
const [reopen, setReopen] = useState(true);
|
const [reopen, setReopen] = useState(true);
|
||||||
const [interrupt, setInterrupt] = useState(false);
|
|
||||||
const [submitting, setSubmitting] = useState(false);
|
const [submitting, setSubmitting] = useState(false);
|
||||||
const [attaching, setAttaching] = useState(false);
|
const [attaching, setAttaching] = useState(false);
|
||||||
const effectiveSuggestedAssigneeValue = suggestedAssigneeValue ?? currentAssigneeValue;
|
const effectiveSuggestedAssigneeValue = suggestedAssigneeValue ?? currentAssigneeValue;
|
||||||
|
|
@ -405,14 +397,6 @@ export function CommentThread({
|
||||||
setReassignTarget(effectiveSuggestedAssigneeValue);
|
setReassignTarget(effectiveSuggestedAssigneeValue);
|
||||||
}, [effectiveSuggestedAssigneeValue]);
|
}, [effectiveSuggestedAssigneeValue]);
|
||||||
|
|
||||||
const interruptVisible = interruptAvailable && body.trim().length > 0;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!interruptVisible && interrupt) {
|
|
||||||
setInterrupt(false);
|
|
||||||
}
|
|
||||||
}, [interruptVisible, interrupt]);
|
|
||||||
|
|
||||||
// Scroll to comment when URL hash matches #comment-{id}
|
// Scroll to comment when URL hash matches #comment-{id}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const hash = location.hash;
|
const hash = location.hash;
|
||||||
|
|
@ -439,11 +423,10 @@ export function CommentThread({
|
||||||
|
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
try {
|
try {
|
||||||
await onAdd(trimmed, reopen ? true : undefined, reassignment ?? undefined, interrupt ? true : undefined);
|
await onAdd(trimmed, reopen ? true : undefined, reassignment ?? undefined);
|
||||||
setBody("");
|
setBody("");
|
||||||
if (draftKey) clearDraft(draftKey);
|
if (draftKey) clearDraft(draftKey);
|
||||||
setReopen(true);
|
setReopen(true);
|
||||||
setInterrupt(false);
|
|
||||||
setReassignTarget(effectiveSuggestedAssigneeValue);
|
setReassignTarget(effectiveSuggestedAssigneeValue);
|
||||||
} catch {
|
} catch {
|
||||||
// Parent mutation handlers surface the failure and keep the draft intact.
|
// Parent mutation handlers surface the failure and keep the draft intact.
|
||||||
|
|
@ -564,17 +547,6 @@ export function CommentThread({
|
||||||
/>
|
/>
|
||||||
Re-open
|
Re-open
|
||||||
</label>
|
</label>
|
||||||
{interruptVisible && (
|
|
||||||
<label className="flex items-center gap-1.5 text-xs text-red-700 dark:text-red-300 cursor-pointer select-none">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={interrupt}
|
|
||||||
onChange={(e) => setInterrupt(e.target.checked)}
|
|
||||||
className="rounded border-red-300 accent-red-600"
|
|
||||||
/>
|
|
||||||
Interrupt
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
{enableReassign && reassignOptions.length > 0 && (
|
{enableReassign && reassignOptions.length > 0 && (
|
||||||
<InlineEntitySelector
|
<InlineEntitySelector
|
||||||
value={reassignTarget}
|
value={reassignTarget}
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,6 @@ export function IssueDetail() {
|
||||||
),
|
),
|
||||||
[activeRun, liveRuns],
|
[activeRun, liveRuns],
|
||||||
);
|
);
|
||||||
const hasRunningIssueRun = Boolean(runningIssueRun);
|
|
||||||
const sourceBreadcrumb = useMemo(
|
const sourceBreadcrumb = useMemo(
|
||||||
() => readIssueDetailBreadcrumb(location.state, location.search) ?? { label: "Issues", href: "/issues" },
|
() => readIssueDetailBreadcrumb(location.state, location.search) ?? { label: "Issues", href: "/issues" },
|
||||||
[location.state, location.search],
|
[location.state, location.search],
|
||||||
|
|
@ -1246,17 +1245,16 @@ export function IssueDetail() {
|
||||||
currentAssigneeValue={actualAssigneeValue}
|
currentAssigneeValue={actualAssigneeValue}
|
||||||
suggestedAssigneeValue={suggestedAssigneeValue}
|
suggestedAssigneeValue={suggestedAssigneeValue}
|
||||||
mentions={mentionOptions}
|
mentions={mentionOptions}
|
||||||
interruptAvailable={hasRunningIssueRun}
|
|
||||||
onInterruptQueued={async (runId) => {
|
onInterruptQueued={async (runId) => {
|
||||||
await interruptQueuedComment.mutateAsync(runId);
|
await interruptQueuedComment.mutateAsync(runId);
|
||||||
}}
|
}}
|
||||||
interruptingQueuedRunId={interruptQueuedComment.isPending ? runningIssueRun?.id ?? null : null}
|
interruptingQueuedRunId={interruptQueuedComment.isPending ? runningIssueRun?.id ?? null : null}
|
||||||
onAdd={async (body, reopen, reassignment, interrupt) => {
|
onAdd={async (body, reopen, reassignment) => {
|
||||||
if (reassignment) {
|
if (reassignment) {
|
||||||
await addCommentAndReassign.mutateAsync({ body, reopen, reassignment, interrupt });
|
await addCommentAndReassign.mutateAsync({ body, reopen, reassignment });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await addComment.mutateAsync({ body, reopen, interrupt });
|
await addComment.mutateAsync({ body, reopen });
|
||||||
}}
|
}}
|
||||||
imageUploadHandler={async (file) => {
|
imageUploadHandler={async (file) => {
|
||||||
const attachment = await uploadAttachment.mutateAsync(file);
|
const attachment = await uploadAttachment.mutateAsync(file);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue