Skip to content

Commit 0e1886e

Browse files
committed
Add jump keybind to the bottom bar
1 parent 0ee9607 commit 0e1886e

File tree

3 files changed

+89
-54
lines changed

3 files changed

+89
-54
lines changed

src/browser/components/pr-overview.tsx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,10 @@ export const PROverview = memo(function PROverview() {
10621062
)}
10631063

10641064
{/* Successfully merged and closed - show for merged PRs */}
1065-
{pr.merged && (
1065+
{pr.merged && (() => {
1066+
// Check if the head branch is from a fork (different repo than base)
1067+
const isFromFork = pr.head.repo?.full_name !== pr.base.repo?.full_name;
1068+
return (
10661069
<div className="border border-purple-500/30 rounded-md overflow-hidden bg-purple-500/10">
10671070
<div className="flex items-start gap-3 p-4">
10681071
<div className="p-2 rounded-full bg-purple-500/20 text-purple-400">
@@ -1073,14 +1076,26 @@ export const PROverview = memo(function PROverview() {
10731076
Pull request successfully merged and closed
10741077
</h3>
10751078
<p className="text-sm text-muted-foreground mt-1">
1076-
You're all set — the{" "}
1077-
<code className="px-1.5 py-0.5 bg-blue-500/20 text-blue-300 rounded text-xs">
1078-
{pr.head.label || pr.head.ref}
1079-
</code>{" "}
1080-
branch can be safely deleted.
1079+
{isFromFork ? (
1080+
<>
1081+
The{" "}
1082+
<code className="px-1.5 py-0.5 bg-blue-500/20 text-blue-300 rounded text-xs">
1083+
{pr.head.label || pr.head.ref}
1084+
</code>{" "}
1085+
branch is in a fork and cannot be deleted from here.
1086+
</>
1087+
) : (
1088+
<>
1089+
You're all set — the{" "}
1090+
<code className="px-1.5 py-0.5 bg-blue-500/20 text-blue-300 rounded text-xs">
1091+
{pr.head.label || pr.head.ref}
1092+
</code>{" "}
1093+
branch can be safely deleted.
1094+
</>
1095+
)}
10811096
</p>
10821097
</div>
1083-
{canMergeRepo && !branchDeleted && (
1098+
{canMergeRepo && !branchDeleted && !isFromFork && (
10841099
<button
10851100
onClick={handleDeleteBranch}
10861101
disabled={deletingBranch}
@@ -1096,7 +1111,7 @@ export const PROverview = memo(function PROverview() {
10961111
)}
10971112
</button>
10981113
)}
1099-
{branchDeleted && (
1114+
{branchDeleted && !isFromFork && (
11001115
<div className="shrink-0 flex items-center gap-3">
11011116
<span className="text-sm text-muted-foreground flex items-center gap-2">
11021117
<Check className="w-4 h-4 text-green-400" />
@@ -1125,7 +1140,8 @@ export const PROverview = memo(function PROverview() {
11251140
)}
11261141
</div>
11271142
</div>
1128-
)}
1143+
);
1144+
})()}
11291145

11301146
{/* Closed with unmerged commits - show for closed, unmerged PRs */}
11311147
{pr.state === "closed" && !pr.merged && (

src/browser/components/pr-review.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,9 @@ const KeybindsBar = memo(function KeybindsBar() {
845845
<Keycap keyName="Shift" size="xs" />
846846
<KeycapGroup keys={["up", "down"]} size="xs" /> select range
847847
</span>
848+
<span className="flex items-center gap-1.5 text-muted-foreground">
849+
<KeycapGroup keys={["cmd", "up"]} size="xs" /> jump 10
850+
</span>
848851
</>
849852
) : (
850853
<>
@@ -854,6 +857,9 @@ const KeybindsBar = memo(function KeybindsBar() {
854857
<span className="flex items-center gap-1.5 text-muted-foreground">
855858
<KeycapGroup keys={["up", "down"]} size="xs" /> select line
856859
</span>
860+
<span className="flex items-center gap-1.5 text-muted-foreground">
861+
<KeycapGroup keys={["cmd", "up"]} size="xs" /> jump 10
862+
</span>
857863
<span className="flex items-center gap-1.5 text-muted-foreground">
858864
<Keycap keyName="g" size="xs" /> goto line
859865
</span>

src/browser/components/welcome-dialog.tsx

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ import {
2222
DialogTitle,
2323
DialogDescription,
2424
} from "../ui/dialog";
25+
import {
26+
DropdownMenu,
27+
DropdownMenuContent,
28+
DropdownMenuItem,
29+
DropdownMenuLabel,
30+
DropdownMenuSeparator,
31+
DropdownMenuTrigger,
32+
} from "../ui/dropdown-menu";
2533
import { Button } from "../ui/button";
2634
import { useAuth } from "../contexts/auth";
2735
import { useCurrentUser } from "../contexts/github";
@@ -1174,7 +1182,6 @@ export function UserMenuButton({ className }: { className?: string }) {
11741182
const { isAuthenticated, isAnonymous, logout, setShowWelcomeDialog } =
11751183
useAuth();
11761184
const currentUser = useCurrentUser()?.login ?? null;
1177-
const [showConfirm, setShowConfirm] = useState(false);
11781185

11791186
// Anonymous mode - show read-only indicator with sign-in option
11801187
if (isAnonymous && !isAuthenticated) {
@@ -1198,51 +1205,57 @@ export function UserMenuButton({ className }: { className?: string }) {
11981205
return null;
11991206
}
12001207

1201-
if (showConfirm) {
1202-
return (
1203-
<div className={cn("flex items-center gap-1", className)}>
1204-
<span className="text-xs text-muted-foreground">Sign out?</span>
1205-
<Button
1206-
variant="ghost"
1207-
size="sm"
1208-
onClick={() => {
1209-
logout();
1210-
setShowConfirm(false);
1211-
}}
1212-
className="h-6 px-2 text-xs text-destructive hover:text-destructive hover:bg-destructive/10"
1208+
return (
1209+
<DropdownMenu>
1210+
<DropdownMenuTrigger asChild>
1211+
<button
1212+
className={cn(
1213+
"flex items-center gap-1.5 p-1 rounded-md hover:bg-muted/50 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background",
1214+
className
1215+
)}
1216+
title={currentUser ? `Signed in as ${currentUser}` : "Account"}
12131217
>
1214-
Yes
1215-
</Button>
1216-
<Button
1217-
variant="ghost"
1218-
size="sm"
1219-
onClick={() => setShowConfirm(false)}
1220-
className="h-6 px-2 text-xs"
1218+
{currentUser ? (
1219+
<img
1220+
src={`https://github.com/${currentUser}.png`}
1221+
alt={currentUser}
1222+
className="w-5 h-5 rounded-full ring-1 ring-border"
1223+
/>
1224+
) : (
1225+
<LogOut className="w-3.5 h-3.5 text-muted-foreground" />
1226+
)}
1227+
</button>
1228+
</DropdownMenuTrigger>
1229+
<DropdownMenuContent align="end" className="w-48">
1230+
{currentUser && (
1231+
<>
1232+
<DropdownMenuLabel className="font-normal">
1233+
<div className="flex items-center gap-2">
1234+
<img
1235+
src={`https://github.com/${currentUser}.png`}
1236+
alt={currentUser}
1237+
className="w-8 h-8 rounded-full"
1238+
/>
1239+
<div className="flex flex-col">
1240+
<span className="text-sm font-medium">{currentUser}</span>
1241+
<span className="text-xs text-muted-foreground">
1242+
Signed in with GitHub
1243+
</span>
1244+
</div>
1245+
</div>
1246+
</DropdownMenuLabel>
1247+
<DropdownMenuSeparator />
1248+
</>
1249+
)}
1250+
<DropdownMenuItem
1251+
variant="destructive"
1252+
onClick={logout}
1253+
className="cursor-pointer"
12211254
>
1222-
No
1223-
</Button>
1224-
</div>
1225-
);
1226-
}
1227-
1228-
return (
1229-
<button
1230-
onClick={() => setShowConfirm(true)}
1231-
className={cn(
1232-
"flex items-center gap-1.5 p-1 rounded-md hover:bg-muted/50 transition-colors",
1233-
className
1234-
)}
1235-
title={currentUser ? `Signed in as ${currentUser}` : "Sign out"}
1236-
>
1237-
{currentUser ? (
1238-
<img
1239-
src={`https://github.com/${currentUser}.png`}
1240-
alt={currentUser}
1241-
className="w-5 h-5 rounded-full ring-1 ring-border"
1242-
/>
1243-
) : (
1244-
<LogOut className="w-3.5 h-3.5 text-muted-foreground" />
1245-
)}
1246-
</button>
1255+
<LogOut className="w-4 h-4" />
1256+
Sign out
1257+
</DropdownMenuItem>
1258+
</DropdownMenuContent>
1259+
</DropdownMenu>
12471260
);
12481261
}

0 commit comments

Comments
 (0)