Skip to content

Commit 664d42f

Browse files
authored
Made some tweaks to the upper table decoration (#97)
2 parents 67b8359 + 7af1cd4 commit 664d42f

File tree

9 files changed

+40
-28
lines changed

9 files changed

+40
-28
lines changed

src/components/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const Badge = ({ text, type, data }: BadgeProps) => {
6060
{PopupComponent && data && (
6161
<div
6262
className={twMerge(
63-
"absolute top-full z-10 w-30 rounded border px-2 py-1 text-left text-xs shadow-lg",
63+
"absolute top-full right-0 z-10 w-30 rounded border px-2 py-1 text-left text-xs shadow-lg",
6464
typeColors[type]
6565
)}
6666
>

src/lib/enhancers/github/GitHubIssueAppendEnhancer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class GitHubIssueAppendEnhancer
9191
<IssueOpenedIcon size={16} />
9292
</span>
9393
<span>
94-
#{spot.number} |{" "}
94+
#{spot.number}{" "}
9595
<a
9696
href={`https://${spot.domain}/${spot.slug}`}
9797
className="truncate hover:underline"

src/lib/enhancers/github/GitHubIssueCreateEnhancer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { commonGitHubOptions, prepareGitHubHighlighter } from "./github-common"
1111

1212
const GH_ISSUE_CREATE = "GH_ISSUE_CREATE" as const
1313

14-
interface GitHubIssueCreateSpot extends CommentSpot {
14+
export interface GitHubIssueCreateSpot extends CommentSpot {
1515
type: typeof GH_ISSUE_CREATE
1616
domain: string
1717
slug: string // owner/repo
@@ -81,7 +81,7 @@ export class GitHubIssueCreateEnhancer
8181
<IssueOpenedIcon size={16} />
8282
</span>
8383
<span>
84-
New |{" "}
84+
&lt;draft&gt;{" "}
8585
<a
8686
href={`https://${spot.domain}/${spot.slug}`}
8787
className="truncate hover:underline"
@@ -94,7 +94,7 @@ export class GitHubIssueCreateEnhancer
9494
}
9595

9696
tableTitle(spot: GitHubIssueCreateSpot): string {
97-
return spot.title || "New Issue"
97+
return spot.title || "<untitled issue>"
9898
}
9999

100100
buildUrl(spot: GitHubIssueCreateSpot): string {

src/lib/enhancers/github/GitHubPrAppendEnhancer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FeedPullRequestOpenIcon } from "@primer/octicons-react"
1+
import { GitPullRequestIcon } from "@primer/octicons-react"
22
import OverType, { type OverTypeInstance } from "overtype"
33
import type React from "react"
44
import type {
@@ -87,10 +87,10 @@ export class GitHubPrAppendEnhancer
8787
return (
8888
<>
8989
<span className="flex h-4 w-4 flex-shrink-0 items-center justify-center">
90-
<FeedPullRequestOpenIcon size={16} />
90+
<GitPullRequestIcon size={16} />
9191
</span>
9292
<span>
93-
#{spot.number} |{" "}
93+
#{spot.number}{" "}
9494
<a
9595
href={`https://${spot.domain}/${spot.slug}`}
9696
className="truncate hover:underline"

src/lib/enhancers/github/GitHubPrCreateEnhancer.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FeedPullRequestOpenIcon } from "@primer/octicons-react"
1+
import { GitPullRequestIcon } from "@primer/octicons-react"
22
import OverType, { type OverTypeInstance } from "overtype"
33
import type {
44
CommentEnhancer,
@@ -11,12 +11,12 @@ import { commonGitHubOptions, prepareGitHubHighlighter } from "./github-common"
1111

1212
const GH_PR_CREATE = "GH_PR_CREATE" as const
1313

14-
interface GitHubPrCreateSpot extends CommentSpot {
14+
export interface GitHubPrCreateSpot extends CommentSpot {
1515
type: typeof GH_PR_CREATE
1616
domain: string
1717
slug: string // owner/repo
1818
title: string
19-
head: string // `user:repo:branch` where changes are implemented
19+
head: string // `user:repo:branch ` where changes are implemented
2020
base: string // branch you want changes pulled into
2121
}
2222

@@ -93,10 +93,10 @@ export class GitHubPrCreateEnhancer
9393
return (
9494
<>
9595
<span className="flex h-4 w-4 flex-shrink-0 items-center justify-center">
96-
<FeedPullRequestOpenIcon size={16} />
96+
<GitPullRequestIcon size={16} />
9797
</span>
9898
<span>
99-
New |{" "}
99+
&lt;draft&gt;{" "}
100100
<a
101101
href={`https://${spot.domain}/${spot.slug}`}
102102
className="truncate hover:underline"
@@ -109,7 +109,7 @@ export class GitHubPrCreateEnhancer
109109
}
110110

111111
tableTitle(spot: GitHubPrCreateSpot): string {
112-
return spot.title || "New Pull Request"
112+
return spot.title || "<untitled pull request>"
113113
}
114114

115115
buildUrl(spot: GitHubPrCreateSpot): string {

tests/lib/enhancers/__snapshots__/gh-ui.test.ts.snap

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ exports[`github ui > gh_issue:should render correct UI elements 1`] = `
1616
<span>
1717
#
1818
523
19-
|
2019
2120
<a
2221
className="truncate hover:underline"
@@ -53,7 +52,6 @@ exports[`github ui > gh_issue_edit:should render correct UI elements 1`] = `
5352
<span>
5453
#
5554
56
56-
|
5755
5856
<a
5957
className="truncate hover:underline"
@@ -97,7 +95,6 @@ exports[`github ui > gh_issue_edit_multiple:should render correct UI elements 1`
9795
<span>
9896
#
9997
3
100-
|
10198
10299
<a
103100
className="truncate hover:underline"
@@ -125,7 +122,7 @@ exports[`github ui > gh_issue_new:should render correct UI elements 1`] = `
125122
/>
126123
</span>
127124
<span>
128-
New |
125+
&lt;draft&gt;
129126
130127
<a
131128
className="truncate hover:underline"
@@ -149,14 +146,13 @@ exports[`github ui > gh_pr:should render correct UI elements 1`] = `
149146
<span
150147
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
151148
>
152-
<FeedPullRequestOpenIcon
149+
<GitPullRequestIcon
153150
size={16}
154151
/>
155152
</span>
156153
<span>
157154
#
158155
517
159-
|
160156
161157
<a
162158
className="truncate hover:underline"
@@ -188,14 +184,13 @@ exports[`github ui > gh_pr_edit:should render correct UI elements 1`] = `
188184
<span
189185
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
190186
>
191-
<FeedPullRequestOpenIcon
187+
<GitPullRequestIcon
192188
size={16}
193189
/>
194190
</span>
195191
<span>
196192
#
197193
58
198-
|
199194
200195
<a
201196
className="truncate hover:underline"
@@ -233,14 +228,13 @@ exports[`github ui > gh_pr_edit_multiple:should render correct UI elements 1`] =
233228
<span
234229
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
235230
>
236-
<FeedPullRequestOpenIcon
231+
<GitPullRequestIcon
237232
size={16}
238233
/>
239234
</span>
240235
<span>
241236
#
242237
5
243-
|
244238
245239
<a
246240
className="truncate hover:underline"
@@ -263,12 +257,12 @@ exports[`github ui > gh_pr_new:should render correct UI elements 1`] = `
263257
<span
264258
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
265259
>
266-
<FeedPullRequestOpenIcon
260+
<GitPullRequestIcon
267261
size={16}
268262
/>
269263
</span>
270264
<span>
271-
New |
265+
&lt;draft&gt;
272266
273267
<a
274268
className="truncate hover:underline"

tests/playground/claude.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { allLeafValues, timeAgo } from "@/components/misc"
77
import type { CommentTableRow } from "@/entrypoints/background"
88
import type { FilterState } from "@/entrypoints/popup/popup"
99
import { EnhancerRegistry } from "@/lib/registries"
10-
import { generateMockDrafts } from "./replicaData"
10+
import { generateMockDrafts } from "./claudeData"
1111

1212
export const ClaudePrototype = () => {
1313
const [drafts] = useState(generateMockDrafts())
File renamed without changes.

tests/playground/replica.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { PopupRoot } from "@/components/PopupRoot"
22
import type { CommentStorage, CommentTableRow } from "@/entrypoints/background"
33
import type { CommentSpot } from "@/lib/enhancer"
44
import type { GitHubIssueAppendSpot } from "@/lib/enhancers/github/GitHubIssueAppendEnhancer"
5+
import type { GitHubIssueCreateSpot } from "@/lib/enhancers/github/GitHubIssueCreateEnhancer"
56
import type { GitHubPrAppendSpot } from "@/lib/enhancers/github/GitHubPrAppendEnhancer"
7+
import type { GitHubPrCreateSpot } from "@/lib/enhancers/github/GitHubPrCreateEnhancer"
68

79
const gh_pr: GitHubPrAppendSpot = {
810
domain: "github.com",
@@ -12,6 +14,15 @@ const gh_pr: GitHubPrAppendSpot = {
1214
type: "GH_PR_APPEND",
1315
unique_key: "github.com:diffplug/selfie:517",
1416
}
17+
const gh_pr_new: GitHubPrCreateSpot = {
18+
base: "main",
19+
domain: "github.com",
20+
head: "cavia-porcellus:selfie:main",
21+
slug: "diffplug/selfie",
22+
title: "Update README.md",
23+
type: "GH_PR_CREATE",
24+
unique_key: "github.com:diffplug/selfie:main...cavia-porcellus:selfie:main",
25+
}
1526
const gh_issue: GitHubIssueAppendSpot = {
1627
domain: "github.com",
1728
number: 523,
@@ -20,8 +31,15 @@ const gh_issue: GitHubIssueAppendSpot = {
2031
type: "GH_ISSUE_APPEND",
2132
unique_key: "github.com:diffplug/selfie:523",
2233
}
34+
const gh_issue_new: GitHubIssueCreateSpot = {
35+
domain: "github.com",
36+
slug: "diffplug/gitcasso",
37+
title: "New issue title",
38+
type: "GH_ISSUE_CREATE",
39+
unique_key: "github.com:diffplug/gitcasso:new",
40+
}
2341

24-
const spots: CommentSpot[] = [gh_pr, gh_issue]
42+
const spots: CommentSpot[] = [gh_pr, gh_pr_new, gh_issue, gh_issue_new]
2543
const sampleSpots: CommentStorage[] = spots.map((spot) => {
2644
const state: CommentStorage = {
2745
drafts: [[0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."]],

0 commit comments

Comments
 (0)