diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx index b6cd9d5b8e2..f6f6493ad55 100644 --- a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx +++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/ChangesView.tsx @@ -1,12 +1,3 @@ -import { - AlertDialog, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from "@superset/ui/alert-dialog"; -import { Button } from "@superset/ui/button"; import { toast } from "@superset/ui/sonner"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@superset/ui/tabs"; import { cn } from "@superset/ui/utils"; @@ -36,6 +27,7 @@ import { sidebarHeaderTabTriggerClassName } from "../headerTabStyles"; import { CategorySection } from "./components/CategorySection"; import { ChangesHeader } from "./components/ChangesHeader"; import { CommitInput } from "./components/CommitInput"; +import { DiscardConfirmDialog } from "./components/DiscardConfirmDialog"; import { ReviewPanel } from "./components/ReviewPanel"; import { useOrderedSections } from "./hooks"; import { getPRActionState, shouldAutoCreatePRAfterPublish } from "./utils"; @@ -834,85 +826,31 @@ export function ChangesView({ - - - - - Discard all unstaged changes? - - - This will revert all unstaged modifications and delete untracked - files. This action cannot be undone. - - - - - - - - + title="Discard all unstaged changes?" + description="This will revert all unstaged modifications and delete untracked files. This action cannot be undone." + onConfirm={() => + discardAllUnstagedMutation.mutate({ + worktreePath: worktreePath || "", + }) + } + confirmLabel="Discard All" + /> - - - - - Discard all staged changes? - - - This will unstage and revert all staged changes. Staged new files - will be deleted. This action cannot be undone. - - - - - - - - + title="Discard all staged changes?" + description="This will unstage and revert all staged changes. Staged new files will be deleted. This action cannot be undone." + onConfirm={() => + discardAllStagedMutation.mutate({ + worktreePath: worktreePath || "", + }) + } + confirmLabel="Discard All" + /> ); } diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx index d9742f4e1f8..7893cbf94b4 100644 --- a/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx +++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx @@ -8,7 +8,6 @@ import { import { Skeleton } from "@superset/ui/skeleton"; import { toast } from "@superset/ui/sonner"; import { cn } from "@superset/ui/utils"; -import type { ReactNode } from "react"; import { useEffect, useRef, useState } from "react"; import { LuArrowUpRight, LuCheck, LuCopy } from "react-icons/lu"; import { VscChevronRight } from "react-icons/vsc"; @@ -20,13 +19,11 @@ import { buildCommentClipboardText, checkIconConfig, checkSummaryIconConfig, - countOpenPullRequestComments, formatShortAge, getCommentAvatarFallback, getCommentCopyActionKey, getCommentKindText, getCommentPreviewText, - prStateLabel, resolveCheckDestinationUrl, reviewDecisionConfig, splitPullRequestComments, @@ -47,7 +44,6 @@ export function ReviewPanel({ }: ReviewPanelProps) { const [checksOpen, setChecksOpen] = useState(true); const [commentsOpen, setCommentsOpen] = useState(true); - const [openCommentsGroupOpen, setOpenCommentsGroupOpen] = useState(true); const [resolvedCommentsGroupOpen, setResolvedCommentsGroupOpen] = useState(false); const [copiedActionKey, setCopiedActionKey] = useState(null); @@ -104,39 +100,8 @@ export function ReviewPanel({ if (isLoading && !pr) { return ( -
-
-
- - - -
-
- - -
-
-
-
- - -
-
- - -
-
-
-
- - -
-
- - - -
-
+
+ Loading review...
); } @@ -150,10 +115,6 @@ export function ReviewPanel({ } const requestedReviewers = pr.requestedReviewers ?? []; - const reviewLabel = - pr.reviewDecision === "pending" && requestedReviewers.length > 0 - ? `Awaiting ${requestedReviewers.join(", ")}` - : reviewDecisionConfig[pr.reviewDecision].label; const relevantChecks = pr.checks.filter( (check) => check.status !== "skipped" && check.status !== "cancelled", @@ -170,9 +131,7 @@ export function ReviewPanel({ const ChecksStatusIcon = checksStatusConfig.icon; const { active: activeComments, resolved: resolvedComments } = splitPullRequestComments(comments); - const commentsCountLabel = isCommentsLoading - ? "..." - : countOpenPullRequestComments(comments); + const commentsCountLabel = isCommentsLoading ? "..." : comments.length; const copyAllCommentsLabel = copiedActionKey === ALL_COMMENTS_COPY_ACTION_KEY ? "Copied" : "Copy all"; @@ -207,6 +166,7 @@ export function ReviewPanel({ {getCommentKindText(comment)} + {age ? ( {age} @@ -223,7 +183,7 @@ export function ReviewPanel({ return (
{comment.url ? ( )} -
+
{comment.url ? ( void; - action?: ReactNode; - }) => ( - -
- - - {title} - - {comments.length} - - - {action ?
{action}
: null} -
- - {renderCommentList(comments)} - -
- ); - return (
-
-
+
+ - {pr.title} - - - #{pr.number} -
- -
+ + +
{reviewDecisionConfig[pr.reviewDecision].label} - - {requestedReviewers.length > 0 - ? reviewLabel - : prStateLabel[pr.state]} - + {requestedReviewers.length > 0 && ( + + Awaiting {requestedReviewers.join(", ")} + + )}
+
+
@@ -388,10 +305,10 @@ export function ReviewPanel({
- + {relevantChecks.length === 0 ? (
- No active checks reported for this pull request yet. + No checks reported.
) : ( relevantChecks.map((check) => { @@ -451,16 +368,18 @@ export function ReviewPanel({
+
+ -
+
+ {activeComments.length > 0 && ( + + )}
- -
- {isCommentsLoading ? ( -
- - - -
- ) : comments.length === 0 ? ( -
- No comments yet. -
- ) : ( - <> - {activeComments.length > 0 - ? renderCommentSection({ - title: "Open", - comments: activeComments, - isOpen: openCommentsGroupOpen, - onOpenChange: setOpenCommentsGroupOpen, - action: ( - - ), - }) - : null} - {resolvedComments.length > 0 ? ( -
- {renderCommentSection({ - title: "Resolved", - comments: resolvedComments, - isOpen: resolvedCommentsGroupOpen, - onOpenChange: setResolvedCommentsGroupOpen, - })} -
- ) : null} - - )} -
+ + {isCommentsLoading ? ( +
+ + + +
+ ) : comments.length === 0 ? ( +
+ No comments yet. +
+ ) : ( + renderCommentList(activeComments) + )}
+ + {resolvedComments.length > 0 && ( + + + + Resolved + + {resolvedComments.length} + + + + {renderCommentList(resolvedComments)} + + + )}
); }