-
Notifications
You must be signed in to change notification settings - Fork 2
Add Request Changes button to merge queue UI #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,22 @@ | ||
| import { useMemo, useState } from "react"; | ||
| import { Link } from "react-router-dom"; | ||
| import { ExternalLink, Check, X, Info } from "lucide-react"; | ||
| import { ExternalLink, Check, X, Info, MessageSquare } from "lucide-react"; | ||
| import { toast } from "sonner"; | ||
| import { useAppState } from "@/hooks/use-app-state"; | ||
| import { flushMergeQueue, approveMerge, rejectMerge } from "@/lib/api"; | ||
| import { flushMergeQueue, approveMerge, rejectMerge, requestChanges } from "@/lib/api"; | ||
| import { formatRelativeTime, projectLabel } from "@/lib/utils"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { ListView, ListEmptyState } from "@/components/ui/list-view"; | ||
| import { ListHeader, ListHeaderTabs } from "@/components/ui/list-header"; | ||
| import { | ||
| Dialog, | ||
| DialogContent, | ||
| DialogDescription, | ||
| DialogFooter, | ||
| DialogHeader, | ||
| DialogTitle, | ||
| DialogTrigger, | ||
| } from "@/components/ui/dialog"; | ||
| import { | ||
| ListRow, | ||
| LinkCell, | ||
|
|
@@ -84,6 +93,25 @@ function MergeQueueRow({ | |
| } | ||
| } | ||
|
|
||
| const [requestChangesOpen, setRequestChangesOpen] = useState(false); | ||
| const [feedback, setFeedback] = useState(""); | ||
| const [submitting, setSubmitting] = useState(false); | ||
|
|
||
| async function handleRequestChanges() { | ||
| if (!feedback.trim()) return; | ||
| setSubmitting(true); | ||
| try { | ||
| await requestChanges(entry.id, feedback.trim(), feedback.trim()); | ||
| setRequestChangesOpen(false); | ||
| setFeedback(""); | ||
| onRefresh(); | ||
| } catch { | ||
| toast.error("Failed to request changes"); | ||
| } finally { | ||
| setSubmitting(false); | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <ListRow> | ||
| {/* PR number */} | ||
|
|
@@ -161,6 +189,48 @@ function MergeQueueRow({ | |
| <Check className="h-3.5 w-3.5" /> | ||
| Approve | ||
| </Button> | ||
| <Dialog open={requestChangesOpen} onOpenChange={setRequestChangesOpen}> | ||
| <DialogTrigger asChild> | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
| className="h-7 gap-1 rounded-none border-r border-border" | ||
| > | ||
| <MessageSquare className="h-3.5 w-3.5" /> | ||
| Request Changes | ||
| </Button> | ||
| </DialogTrigger> | ||
| <DialogContent> | ||
| <DialogHeader> | ||
| <DialogTitle>Request Changes</DialogTitle> | ||
| <DialogDescription> | ||
| Describe the changes needed. This feedback will be sent back to the agent. | ||
| </DialogDescription> | ||
| </DialogHeader> | ||
| <textarea | ||
| className="w-full rounded-md border border-border bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring min-h-[100px] resize-y" | ||
| placeholder="Describe what needs to change..." | ||
| value={feedback} | ||
| onChange={(e) => setFeedback(e.target.value)} | ||
| /> | ||
| <DialogFooter> | ||
| <Button | ||
| variant="outline" | ||
| size="sm" | ||
| onClick={() => setRequestChangesOpen(false)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [SUGGESTION] Priority: Code Quality The Cancel button closes the dialog but doesn't reset the onClick={() => setRequestChangesOpen(false)}If a user types some feedback, cancels, then reopens the dialog for the same entry, the previous draft text is still present. The success path correctly clears feedback ( Consider resetting on close: |
||
| > | ||
| Cancel | ||
| </Button> | ||
| <Button | ||
| size="sm" | ||
| onClick={handleRequestChanges} | ||
| disabled={!feedback.trim() || submitting} | ||
| > | ||
| {submitting ? "Submitting..." : "Submit"} | ||
| </Button> | ||
| </DialogFooter> | ||
| </DialogContent> | ||
| </Dialog> | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[SUGGESTION]
Priority: Code Quality
The
columnsexport (TanStack Table column definitions) is not imported by any active consumer —page.tsxonly imports utility functions from this file (statusBadge,lifecyclePhases, etc.), not thecolumnsarray. This meanshandleRequestChangesusingwindow.prompt()is dead code and will never run in the current UI.If the table view is intended to be revived, this implementation has two problems compared to the
page.tsxdialog approach: it uses a blocking native browser prompt (can be suppressed by browsers, unstyled, inconsistent UX) and it has no error handling — ifrequestChanges()throws, the error propagates silently.Consider either wiring up the
columnsexport to a table view, or removing thehandleRequestChangesfromcolumns.tsxentirely since the dialog inpage.tsxhandles this correctly.