Skip to content

Commit 5d208d0

Browse files
committed
Put the "no drafts" empty state inside the popup root.
1 parent 419e1bc commit 5d208d0

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/components/EmptyState.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export function EmptyState() {
22
return (
3-
<div className="mx-auto max-w-4xl py-8 text-center">
3+
<div className="py-8 text-center">
44
<h2 className="mb-4 font-semibold text-2xl">No comments open</h2>
55
<p className="mb-6 text-gray-600">
66
Your drafts will appear here when you start typing in comment boxes
7-
across GitHub and Reddit.
7+
across GitHub and other markdown-friendly sites.
88
</p>
99
</div>
1010
)

src/components/PopupRoot.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Eye, EyeOff, Search, Settings, Trash2 } from "lucide-react"
22
import { useMemo, useState } from "react"
33
import { twMerge } from "tailwind-merge"
4-
import { badgeCVA } from "@/components/design"
4+
import { badgeCVA, typeIcons } from "@/components/design"
55
import MultiSegment from "@/components/MultiSegment"
66
import { allLeafValues } from "@/components/misc"
77
import type { CommentTableRow } from "@/entrypoints/background"
@@ -100,11 +100,6 @@ export function PopupRoot({ drafts }: PopupRootProps) {
100100
showTrashed: true,
101101
})
102102
}
103-
104-
if (drafts.length === 0) {
105-
return <EmptyState />
106-
}
107-
108103
return (
109104
<div className="bg-white">
110105
{/* Bulk actions bar - floating popup */}
@@ -214,10 +209,12 @@ export function PopupRoot({ drafts }: PopupRootProps) {
214209
</tr>
215210
</thead>
216211
<tbody className="divide-y divide-gray-200">
212+
217213
{filteredDrafts.length === 0 && (
218214
<tr>
219215
<td colSpan={2}>
220-
<NoMatchesState onClearFilters={clearFilters} />
216+
{drafts.length === 0 && <EmptyState />}
217+
{drafts.length > 0 && <NoMatchesState onClearFilters={clearFilters} />}
221218
</td>
222219
</tr>
223220
)}
@@ -258,14 +255,21 @@ export function PopupRoot({ drafts }: PopupRootProps) {
258255
overtype
259256
</a>
260257
</div>
261-
<div>
262-
drafts are not being saved{" "}
258+
<div className="flex items-center gap-2">
259+
drafts are not being saved
263260
<a
264261
href="https://github.com/diffplug/gitcasso/issues/26"
265262
target="_blank"
266263
rel="noopener noreferrer"
267-
className="text-blue-600 hover:underline"
264+
className={twMerge(
265+
badgeCVA({ type: "save", clickable: true }),
266+
"hover:opacity-90"
267+
)}
268268
>
269+
{(() => {
270+
const SaveIcon = typeIcons.save
271+
return <SaveIcon className="h-3 w-3" />
272+
})()}
269273
save my drafts
270274
</a>
271275
</div>

0 commit comments

Comments
 (0)