Skip to content

Commit ca59037

Browse files
add repo and context to recents at your convenience (#40)
1 parent de938d1 commit ca59037

File tree

5 files changed

+67
-9
lines changed

5 files changed

+67
-9
lines changed

assets/logo-mark.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/BranchListItem.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,24 @@ export default function BranchListItem({
146146
<Action
147147
title="Open Branch in GitHub"
148148
onAction={() => {
149+
visitBranch?.(branch, repository);
149150
open(branchURL);
150151
}}
151152
/>
153+
{!fromCache && (
154+
<Action
155+
title="Add Branch to Recents"
156+
onAction={async() => {
157+
visitBranch?.(branch, repository);
158+
await showToast({
159+
title: `Added "${branch.branchName}" to recents`,
160+
style: Toast.Style.Success,
161+
});
162+
}}
163+
shortcut={{ modifiers: ["cmd"], key: "r" }}
164+
/>
165+
)}
166+
152167
{!fromCache && (
153168
<Action
154169
title="Show branch Preview"

src/components/IssueListItem.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ type IssueListItemProps = {
1919
changeBodyVisibility?: (state: boolean) => void;
2020
bodyVisible?: boolean;
2121
mutateList?:
22-
| MutatePromise<SearchCreatedIssuesQuery | undefined>
23-
| MutatePromise<SearchOpenIssuesQuery | undefined>
24-
| MutatePromise<IssueFieldsFragment[] | undefined>;
22+
| MutatePromise<SearchCreatedIssuesQuery | undefined>
23+
| MutatePromise<SearchOpenIssuesQuery | undefined>
24+
| MutatePromise<IssueFieldsFragment[] | undefined>;
2525
visitIssue?: (issue: IssueFieldsFragment) => void;
2626
removeIssue?: (issue: IssueFieldsFragment) => void;
2727
fromCache?: boolean;
@@ -102,6 +102,7 @@ export default function IssueListItem({
102102
<Action
103103
title="View Issue in GitHub"
104104
onAction={() => {
105+
visitIssue?.(issue);
105106
open(issue.url);
106107
}}
107108
/>
@@ -127,6 +128,19 @@ export default function IssueListItem({
127128
}}
128129
/>
129130
)}
131+
{!fromCache && (
132+
<Action
133+
title="Add Issue to Recents"
134+
onAction={async() => {
135+
visitIssue?.(issue);
136+
await showToast({
137+
title: `Added "${issue.title}" to recents`,
138+
style: Toast.Style.Success,
139+
});
140+
}}
141+
shortcut={{ modifiers: ["cmd"], key: "r" }}
142+
/>
143+
)}
130144
{fromCache && (
131145
<Action
132146
title="Remove from Recents"

src/components/PullRequestListItem.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,23 @@ export default function PullRequestListItem({
124124
<Action
125125
title="View PR in GitHub"
126126
onAction={() => {
127+
visitPullReq?.(pullRequest);
127128
open(pullRequest.permalink);
128129
}}
129130
/>
131+
{!fromCache && (
132+
<Action
133+
title="Add PR to Recents"
134+
onAction={async() => {
135+
visitPullReq?.(pullRequest);
136+
await showToast({
137+
title: `Added "${pullRequest.title}" to recents`,
138+
style: Toast.Style.Success,
139+
});
140+
}}
141+
shortcut={{ modifiers: ["cmd"], key: "r" }}
142+
/>
143+
)}
130144
{fromCache && (
131145
<Action
132146
title="Remove from Recents"

src/components/RepositoryListItem.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ export default function RepositoryListItem({
8080
title={repository.name}
8181
{...(numberOfStars > 0
8282
? {
83-
subtitle: {
84-
value: `${numberOfStars}`,
85-
tooltip: `Number of Stars: ${numberOfStars}`,
86-
},
87-
}
83+
subtitle: {
84+
value: `${numberOfStars}`,
85+
tooltip: `Number of Stars: ${numberOfStars}`,
86+
},
87+
}
8888
: {})}
8989
accessories={accessories}
9090
actions={
@@ -96,6 +96,21 @@ export default function RepositoryListItem({
9696
push(<SearchContext repository={repository} />);
9797
}}
9898
/>
99+
<Action title="Open Repo in GitHub" onAction={() => open(repository.url)} />
100+
{!fromCache && (
101+
<Action
102+
title="Add Repo to Recents"
103+
onAction={async () => {
104+
onVisit(repository);
105+
await showToast({
106+
title: `Added "${repository.nameWithOwner}" to recents`,
107+
style: Toast.Style.Success,
108+
});
109+
110+
}}
111+
shortcut={{ modifiers: ["cmd"], key: "r" }}
112+
/>
113+
)}
99114
{fromCache && (
100115
<Action
101116
title="Remove from Recents"
@@ -109,7 +124,6 @@ export default function RepositoryListItem({
109124
shortcut={{ modifiers: ["cmd"], key: "d" }}
110125
/>
111126
)}
112-
<Action title="Open Repo in GitHub" onAction={() => open(repository.url)} />
113127
<Action
114128
title="Trigger Workspace"
115129
onAction={() => OpenInGitpod(repository.url, "Repository", repository.nameWithOwner)}

0 commit comments

Comments
 (0)