@karimsa/mdxserve 0.5.1 → 0.6.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +3 -0
  2. package/client/DocView.tsx +26 -14
  3. package/client/ListingView.tsx +3 -3
  4. package/client/MdSection.tsx +14 -9
  5. package/client/RenderErrorBoundary.tsx +20 -5
  6. package/client/Settings.tsx +26 -21
  7. package/client/app.css +20 -0
  8. package/client/comments/CommentsPanel.tsx +194 -0
  9. package/client/comments/CommentsPopover.tsx +197 -0
  10. package/client/comments/CommentsSheet.tsx +63 -0
  11. package/client/comments/CommentsSidebar.tsx +24 -0
  12. package/client/comments/CtlButton.tsx +33 -0
  13. package/client/comments/DraftThread.tsx +86 -0
  14. package/client/comments/GutterCounters.tsx +121 -0
  15. package/client/comments/ReplyField.tsx +98 -0
  16. package/client/comments/SelectionButton.tsx +142 -0
  17. package/client/comments/Thread.tsx +308 -0
  18. package/client/comments/anchor.ts +204 -0
  19. package/client/comments/data.ts +98 -0
  20. package/client/comments/dom.ts +212 -0
  21. package/client/comments/drafts.ts +36 -0
  22. package/client/comments/highlights.ts +83 -0
  23. package/client/comments/model.ts +241 -0
  24. package/client/comments/motion.ts +44 -0
  25. package/client/comments/pins.ts +37 -0
  26. package/client/comments/self-writes.ts +22 -0
  27. package/client/comments/state.ts +67 -0
  28. package/client/comments/time.ts +21 -0
  29. package/client/entry.tsx +10 -0
  30. package/client/hooks.ts +19 -0
  31. package/client/platform.ts +8 -0
  32. package/client/router.ts +5 -0
  33. package/client/shell/AppShell.tsx +85 -15
  34. package/client/shell/StandaloneShell.tsx +3 -2
  35. package/client/shell/TopBar.tsx +25 -0
  36. package/client/ui/ConfirmDeleteDialog.tsx +1 -1
  37. package/client/ui/Toast.tsx +5 -1
  38. package/client/ui/icon-set.ts +10 -0
  39. package/dist/cli.js +872 -229
  40. package/package.json +1 -1
  41. package/skills/mdxserve/SKILL.md +86 -0
package/README.md CHANGED
@@ -248,6 +248,9 @@ and when it was last edited.
248
248
  - The top bar toggles light and dark (it remembers your choice), prints, and exports.
249
249
  - Double-click a section, or use its pencil, to edit it in place; `⌘S` saves,
250
250
  `Esc` cancels. The edit is written back to the file on disk.
251
+ - Select text and press the comment button to start a thread on it. Agents reply by editing the
252
+ file, since threads live in the doc's frontmatter. See
253
+ [comments](docs/advanced.md#comments).
251
254
  - Saving a file from your editor re-renders the open page, and a toast names what changed.
252
255
  - In a folder listing, select files to move them to the OS Trash (never deleted outright).
253
256
  - Diagrams and charts open full-screen; a flowchart's direction can be flipped without
@@ -1,21 +1,16 @@
1
- import { useLayoutEffect, useMemo, useRef } from "react";
1
+ import { memo, useLayoutEffect, useMemo, useRef, type ComponentType, type ReactNode } from "react";
2
2
  import { useAtomValue, useSetAtom } from "jotai";
3
3
  import { DocContext } from "./DocContext";
4
4
  import { ErrorBox } from "./ErrorBox";
5
+ import { useFullWidth } from "./hooks";
5
6
  import { RenderErrorBoundary } from "./RenderErrorBoundary";
6
7
  import type { DocModuleState } from "./doc-module-cache";
7
8
  import { ResizeHandle } from "./ui/ResizeHandle";
8
- import {
9
- contentLayoutAtom,
10
- DOC_MAX_WIDTH,
11
- DOC_MIN_WIDTH,
12
- docWidthAtom,
13
- openSectionAtom,
14
- } from "./state";
9
+ import { DOC_MAX_WIDTH, DOC_MIN_WIDTH, docWidthAtom, openSectionAtom } from "./state";
15
10
 
16
11
  // Each Component a re-import produces (including an HMR re-import after a
17
12
  // fix) is a distinct function identity, so this assigns it a stable, unique
18
- // key the RenderErrorBoundary below can be keyed on to reset itself.
13
+ // number the RenderErrorBoundary below resets itself on.
19
14
  const moduleKeys = new WeakMap<object, number>();
20
15
  let nextModuleKey = 0;
21
16
  function keyForComponent(Component: object): number {
@@ -27,7 +22,24 @@ function keyForComponent(Component: object): number {
27
22
  return key;
28
23
  }
29
24
 
30
- export function DocView({
25
+ /**
26
+ * Calls the doc's compiled content function instead of mounting it. A re-import
27
+ * after an edit yields a new function; mounted as a component, React would see
28
+ * a new type and rebuild the whole article. Called from this one long-lived
29
+ * component, only the elements it returns are diffed, so unchanged blocks keep
30
+ * their DOM and state. The content function's own hooks (`useMDXComponents`)
31
+ * are the same on every import, so they are safe to run as this component's.
32
+ */
33
+ function DocContent({ render }: { render: ComponentType }) {
34
+ return (render as (props: Record<string, never>) => ReactNode)({});
35
+ }
36
+
37
+ /**
38
+ * Memoized: the shell re-renders on every frame of a width change (the
39
+ * comments sidebar opening, a window resize), and without this each of those
40
+ * would re-run the whole doc's content function.
41
+ */
42
+ export const DocView = memo(function DocView({
31
43
  path,
32
44
  module,
33
45
  onRendered,
@@ -51,7 +63,7 @@ export function DocView({
51
63
  onRendered?: () => void;
52
64
  }) {
53
65
  const cached = module;
54
- const fullWidth = useAtomValue(contentLayoutAtom) === "full-width";
66
+ const fullWidth = useFullWidth();
55
67
  const setWidth = useSetAtom(docWidthAtom);
56
68
  // While a section is being edited the page width is pinned: a drag would
57
69
  // reflow the editor under the caret, and the handles' hover strips sit
@@ -104,11 +116,11 @@ export function DocView({
104
116
  )}
105
117
  <article className="mdx-prose min-w-0 max-w-full">
106
118
  <DocContext value={docContext}>
107
- <RenderErrorBoundary key={keyForComponent(Content)}>
108
- <Content />
119
+ <RenderErrorBoundary resetKey={keyForComponent(Content)}>
120
+ <DocContent render={Content} />
109
121
  </RenderErrorBoundary>
110
122
  </DocContext>
111
123
  </article>
112
124
  </div>
113
125
  );
114
- }
126
+ });
@@ -1,9 +1,10 @@
1
1
  import { AnimatePresence, motion } from "framer-motion";
2
- import { useAtom, useAtomValue, useSetAtom } from "jotai";
2
+ import { useAtom, useSetAtom } from "jotai";
3
3
  import { useMutation } from "@tanstack/react-query";
4
4
  import { useCallback, useEffect, useMemo, useRef, useState, type KeyboardEvent } from "react";
5
5
  import { queryClient, trpc } from "./api";
6
6
  import { formatModified, formatSize } from "./format";
7
+ import { useFullWidth } from "./hooks";
7
8
  import { stagger, TRANSITIONS, VARIANTS } from "./motion";
8
9
  import { Icon } from "./ui/Icon";
9
10
  import { ResizeHandle } from "./ui/ResizeHandle";
@@ -13,7 +14,6 @@ import { shellInfo, type ListingEntry } from "./router";
13
14
  import Button from "./builtins/Button";
14
15
  import Dropdown from "./builtins/Dropdown";
15
16
  import {
16
- contentLayoutAtom,
17
17
  LISTING_MAX_WIDTH,
18
18
  LISTING_MIN_WIDTH,
19
19
  listingSortAtom,
@@ -391,7 +391,7 @@ export function ListingView({
391
391
  [sorted, sidebar],
392
392
  );
393
393
  const setWidth = useSetAtom(listingWidthAtom);
394
- const fullWidth = useAtomValue(contentLayoutAtom) === "full-width";
394
+ const fullWidth = useFullWidth();
395
395
  const container = useRef<HTMLDivElement>(null);
396
396
 
397
397
  const [selectedNames, setSelectedNames] = useState<Set<string>>(new Set());
@@ -58,14 +58,11 @@ export interface MdSectionProps {
58
58
  * it's invisible — same children, same DOM — until hovered, when a pencil
59
59
  * appears to swap it into an inline Tiptap editor seeded from the raw file.
60
60
  *
61
- * This outer component only resolves `path` and re-keys the inner `Section`
62
- * on `path:startLine:endLine`. That key matters after a save: Vite's HMR
63
- * re-executes the doc module and React Fast Refresh re-renders this
64
- * component in place with *new* startLine/endLine props (the edited range
65
- * shifted). Without the key, Fast Refresh would preserve `Section`'s local
66
- * state across that update and leave it holding an editor pointed at
67
- * now-stale line numbers; keying on the range forces a clean remount back to
68
- * read mode instead.
61
+ * This outer component only resolves `path`. `Section` is deliberately not
62
+ * keyed on its line range: anything that adds lines above it — a comment
63
+ * growing the frontmatter, an edit to an earlier section — shifts the range,
64
+ * and a key would remount every section below, diagrams included. `Section`
65
+ * drops back to read mode itself when its range moves.
69
66
  */
70
67
  export function MdSection({ index, startLine, endLine, rawJsx, children }: MdSectionProps) {
71
68
  const ctxPath = useContext(DocContext)?.path;
@@ -78,7 +75,6 @@ export function MdSection({ index, startLine, endLine, rawJsx, children }: MdSec
78
75
 
79
76
  return (
80
77
  <Section
81
- key={`${path}:${startLine}:${endLine}`}
82
78
  path={path}
83
79
  index={index}
84
80
  startLine={Number(startLine)}
@@ -112,6 +108,15 @@ function Section({
112
108
  const [openSection, setOpenSection] = useAtom(openSectionAtom);
113
109
  const key = `${path}:${startLine}:${endLine}`;
114
110
 
111
+ // The range moved under this section (a save or an outside write shifted
112
+ // it), so an open editor now points at stale line numbers: back to read
113
+ // mode. Reset during render so the editor never commits with the new range.
114
+ const [renderedKey, setRenderedKey] = useState(key);
115
+ if (renderedKey !== key) {
116
+ setRenderedKey(key);
117
+ setMode("read");
118
+ }
119
+
115
120
  // Only one section edits (or loads) at a time. The atom is claimed the
116
121
  // moment a section starts opening, so if a different section claims it
117
122
  // while this one is mid-fetch or mid-edit, this one drops back to read
@@ -4,6 +4,8 @@ import { ErrorBox } from "./ErrorBox";
4
4
  type RenderErrorBoundaryState = {
5
5
  error: Error | null;
6
6
  componentStack: string | null;
7
+ /** The `resetKey` this state belongs to. */
8
+ resetKey: number;
7
9
  };
8
10
 
9
11
  /**
@@ -12,15 +14,28 @@ type RenderErrorBoundaryState = {
12
14
  * shows ErrorBox instead of leaving the page blank. React error boundaries
13
15
  * only work as class components — there is no hook equivalent.
14
16
  *
15
- * The parent keys this component on the cached module's identity, so an HMR
16
- * re-import after a fix remounts the boundary and clears the stale error
17
- * rather than getting stuck on the first throw.
17
+ * The parent passes the cached module's identity as `resetKey`, so an HMR
18
+ * re-import after a fix clears the stale error rather than getting stuck on
19
+ * the first throw. It is a prop and not a React `key`: a key would remount the
20
+ * whole article on every re-import, error or not.
18
21
  */
19
22
  export class RenderErrorBoundary extends Component<
20
- { children: ReactNode },
23
+ { resetKey: number; children: ReactNode },
21
24
  RenderErrorBoundaryState
22
25
  > {
23
- state: RenderErrorBoundaryState = { error: null, componentStack: null };
26
+ state: RenderErrorBoundaryState = {
27
+ error: null,
28
+ componentStack: null,
29
+ resetKey: this.props.resetKey,
30
+ };
31
+
32
+ static getDerivedStateFromProps(
33
+ props: { resetKey: number },
34
+ state: RenderErrorBoundaryState,
35
+ ): RenderErrorBoundaryState | null {
36
+ if (props.resetKey === state.resetKey) return null;
37
+ return { error: null, componentStack: null, resetKey: props.resetKey };
38
+ }
24
39
 
25
40
  static getDerivedStateFromError(error: Error): Partial<RenderErrorBoundaryState> {
26
41
  return { error };
@@ -5,6 +5,7 @@ import Network from "lucide-react/dist/esm/icons/network.mjs";
5
5
  import PanelsTopLeft from "lucide-react/dist/esm/icons/panels-top-left.mjs";
6
6
  import SettingsIcon from "lucide-react/dist/esm/icons/settings.mjs";
7
7
  import CloseIcon from "lucide-react/dist/esm/icons/x.mjs";
8
+ import { useCompactScreen } from "./hooks";
8
9
  import { contentLayoutAtom, tocVisibleAtom, type ContentLayout } from "./state";
9
10
  import { Modal } from "./ui/Modal";
10
11
 
@@ -22,6 +23,8 @@ export function Settings({
22
23
  const [category, setCategory] = useState<"diagrams" | "layout">(diagrams ? "diagrams" : "layout");
23
24
  const [layout, setLayout] = useAtom(contentLayoutAtom);
24
25
  const [tocVisible, setTocVisible] = useAtom(tocVisibleAtom);
26
+ // Phones always fill the width (see useFullWidth), so the choice is moot there.
27
+ const compact = useCompactScreen();
25
28
  return (
26
29
  <Modal
27
30
  open
@@ -72,27 +75,29 @@ export function Settings({
72
75
  <section>
73
76
  <h3>Layout</h3>
74
77
  <p>Choose how content fills the available space.</p>
75
- <label className="diagram-setting-row" htmlFor="content-layout">
76
- <span>
77
- <strong>Content layout</strong>
78
- <small>
79
- {layout === "flexible"
80
- ? "Drag the bars to resize content."
81
- : "Content automatically fills the available width."}
82
- </small>
83
- </span>
84
- <span className="diagram-agent-select">
85
- <select
86
- id="content-layout"
87
- value={layout}
88
- onChange={(event) => setLayout(event.target.value as ContentLayout)}
89
- >
90
- <option value="flexible">Flexible</option>
91
- <option value="full-width">Full width</option>
92
- </select>
93
- <ChevronDown size={14} aria-hidden="true" />
94
- </span>
95
- </label>
78
+ {compact ? null : (
79
+ <label className="diagram-setting-row" htmlFor="content-layout">
80
+ <span>
81
+ <strong>Content layout</strong>
82
+ <small>
83
+ {layout === "flexible"
84
+ ? "Drag the bars to resize content."
85
+ : "Content automatically fills the available width."}
86
+ </small>
87
+ </span>
88
+ <span className="diagram-agent-select">
89
+ <select
90
+ id="content-layout"
91
+ value={layout}
92
+ onChange={(event) => setLayout(event.target.value as ContentLayout)}
93
+ >
94
+ <option value="flexible">Flexible</option>
95
+ <option value="full-width">Full width</option>
96
+ </select>
97
+ <ChevronDown size={14} aria-hidden="true" />
98
+ </span>
99
+ </label>
100
+ )}
96
101
  <label className="diagram-setting-row" htmlFor="toc-visibility">
97
102
  <span>
98
103
  <strong>Table of contents</strong>
package/client/app.css CHANGED
@@ -165,6 +165,15 @@ html {
165
165
  scroll-padding-top: calc(var(--topbar-height) + var(--space-2));
166
166
  }
167
167
 
168
+ /* Keep the page from panning sideways or rubber-banding on touch devices.
169
+ `clip` rather than `hidden`, so the sticky topbar and sidebar keep working;
170
+ wide content (code, tables, diagrams) scrolls inside its own box instead. */
171
+ html,
172
+ body {
173
+ overflow-x: clip;
174
+ overscroll-behavior: none;
175
+ }
176
+
168
177
  @media (prefers-reduced-motion: no-preference) {
169
178
  html {
170
179
  scroll-behavior: smooth;
@@ -366,6 +375,17 @@ code[data-line-numbers-max-digits="4"] [data-line]::before {
366
375
  }
367
376
  }
368
377
 
378
+ /* Comment highlights (client/comments/highlights.ts) use the CSS Custom Highlight API,
379
+ so React's DOM is untouched. Browsers without it show the panel and no marks. */
380
+ ::highlight(mdxserve-comment) {
381
+ background-color: var(--status-warn-bg);
382
+ color: inherit;
383
+ }
384
+ ::highlight(mdxserve-comment-active) {
385
+ background-color: color-mix(in oklab, var(--status-warn-fg) 32%, var(--status-warn-bg));
386
+ color: inherit;
387
+ }
388
+
369
389
  /* Print: the reader gets the prose, nothing else. */
370
390
  @media print {
371
391
  [data-print-hide] {
@@ -0,0 +1,194 @@
1
+ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
2
+ import { useAtomValue } from "jotai";
3
+ import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
4
+ import type { CommentThread } from "../../src/comments/schema";
5
+ import { CtlButton } from "./CtlButton";
6
+ import { DraftThread } from "./DraftThread";
7
+ import type { CommentsModel } from "./model";
8
+ import { rowMotion } from "./motion";
9
+ import { activeThreadAtom, draftAtom } from "./state";
10
+ import { Thread } from "./Thread";
11
+
12
+ type Tab = "open" | "resolved";
13
+
14
+ function Tabs({
15
+ tab,
16
+ onChange,
17
+ openCount,
18
+ resolvedCount,
19
+ }: {
20
+ tab: Tab;
21
+ onChange: (next: Tab) => void;
22
+ openCount: number;
23
+ resolvedCount: number;
24
+ }) {
25
+ const entries: Array<{ value: Tab; label: string; count: number }> = [
26
+ { value: "open", label: "Open", count: openCount },
27
+ { value: "resolved", label: "Resolved", count: resolvedCount },
28
+ ];
29
+ return (
30
+ <div role="tablist" aria-label="Comment status" className="flex gap-3.5 self-stretch">
31
+ {entries.map((entry) => (
32
+ <button
33
+ key={entry.value}
34
+ type="button"
35
+ role="tab"
36
+ aria-selected={tab === entry.value}
37
+ onClick={() => onChange(entry.value)}
38
+ className={
39
+ "-mb-px inline-flex cursor-pointer items-center gap-[5px] border-0 border-b-2 bg-transparent p-0 text-[12.5px] leading-none font-semibold tabular-nums " +
40
+ (tab === entry.value
41
+ ? "border-text-heading text-text-heading"
42
+ : "border-transparent text-text-subtle hover:text-text-heading")
43
+ }
44
+ >
45
+ {entry.label}
46
+ <span className="font-medium text-text-subtle">{entry.count}</span>
47
+ </button>
48
+ ))}
49
+ </div>
50
+ );
51
+ }
52
+
53
+ /**
54
+ * One thread's place in the list. It expands in when the thread joins the tab
55
+ * (a new comment, a reopen) and collapses when it leaves (a resolve), so the
56
+ * rows around it move aside instead of jumping.
57
+ */
58
+ function ThreadRow({ active, children }: { active: boolean; children: ReactNode }) {
59
+ const ref = useRef<HTMLDivElement>(null);
60
+ const reducedMotion = useReducedMotion();
61
+ return (
62
+ <motion.div
63
+ ref={ref}
64
+ {...rowMotion(reducedMotion)}
65
+ // Thread scrolls itself into view when it becomes active, but a new one
66
+ // is still collapsed then; bring it fully into view once it has opened.
67
+ onAnimationComplete={() => {
68
+ if (active) ref.current?.scrollIntoView({ block: "nearest" });
69
+ }}
70
+ className="overflow-hidden"
71
+ >
72
+ {children}
73
+ </motion.div>
74
+ );
75
+ }
76
+
77
+ /** Header and thread list shared by the docked sidebar and the phone sheet. */
78
+ export function CommentsPanel({
79
+ model,
80
+ variant,
81
+ onClose,
82
+ }: {
83
+ model: CommentsModel;
84
+ variant: "sidebar" | "sheet";
85
+ onClose: () => void;
86
+ }) {
87
+ const [tab, setTab] = useState<Tab>("open");
88
+ const activeId = useAtomValue(activeThreadAtom);
89
+ // The composer is the sheet's: on desktop a new comment opens in the popover.
90
+ const draft = useAtomValue(draftAtom);
91
+ const { threads, views, readOnly } = model;
92
+ const sheet = variant === "sheet";
93
+
94
+ // Selecting a thread (a highlight click, say) shows the tab that holds it.
95
+ const threadsRef = useRef(threads);
96
+ threadsRef.current = threads;
97
+ useEffect(() => {
98
+ const active = threadsRef.current.find((thread) => thread.id === activeId);
99
+ if (active) setTab(active.resolved ? "resolved" : "open");
100
+ }, [activeId]);
101
+
102
+ const { open, detached, resolved } = useMemo(() => {
103
+ const unresolved = threads.filter((thread) => !thread.resolved);
104
+ const placed: Array<{ thread: CommentThread; position: number; order: number }> = [];
105
+ const lost: CommentThread[] = [];
106
+ unresolved.forEach((thread, order) => {
107
+ const view = views.get(thread.id);
108
+ if (view?.resolution.state === "detached") lost.push(thread);
109
+ else placed.push({ thread, position: view?.position ?? Number.MAX_SAFE_INTEGER, order });
110
+ });
111
+ placed.sort((left, right) => left.position - right.position || left.order - right.order);
112
+ return {
113
+ open: placed.map((entry) => entry.thread),
114
+ detached: lost,
115
+ resolved: threads.filter((thread) => thread.resolved),
116
+ };
117
+ }, [threads, views]);
118
+
119
+ const shown = tab === "open" ? open : resolved;
120
+ const empty = open.length === 0 && detached.length === 0;
121
+
122
+ function renderThread(thread: CommentThread) {
123
+ return (
124
+ <ThreadRow key={`${model.path}:${thread.id}`} active={thread.id === activeId}>
125
+ <Thread
126
+ thread={thread}
127
+ view={views.get(thread.id)}
128
+ active={thread.id === activeId}
129
+ variant={variant}
130
+ model={model}
131
+ />
132
+ </ThreadRow>
133
+ );
134
+ }
135
+
136
+ return (
137
+ <>
138
+ <div
139
+ className={
140
+ "flex h-[42px] shrink-0 items-center gap-3 border-b pr-2 pl-4 " +
141
+ (sheet ? "border-border-subtle" : "border-border-default")
142
+ }
143
+ >
144
+ <Tabs
145
+ tab={tab}
146
+ onChange={setTab}
147
+ openCount={open.length + detached.length}
148
+ resolvedCount={resolved.length}
149
+ />
150
+ <span className="flex-1" />
151
+ <CtlButton
152
+ icon="x"
153
+ label="Close comments"
154
+ className="max-md:h-9 max-md:w-9"
155
+ onClick={onClose}
156
+ />
157
+ </div>
158
+ <div className="min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--border-strong)_transparent] [scrollbar-width:thin]">
159
+ {sheet && draft ? (
160
+ <div className="border-b border-border-default">
161
+ <DraftThread model={model} sidebarOpen={false} reserveTools={false} padded />
162
+ </div>
163
+ ) : null}
164
+ {/* Keyed by tab and doc: switching either swaps the whole list at once,
165
+ and only a thread joining or leaving the list on screen animates. */}
166
+ <div key={`${model.path}:${tab}`} className="divide-y divide-border-default">
167
+ <AnimatePresence initial={false}>{shown.map(renderThread)}</AnimatePresence>
168
+ {tab === "open" && detached.length > 0 ? (
169
+ <div>
170
+ <h3 className="m-0 px-4 pt-3.5 text-[length:var(--size-2xs)] font-semibold tracking-wide text-text-subtle uppercase">
171
+ Detached
172
+ </h3>
173
+ <div className="divide-y divide-border-default">
174
+ <AnimatePresence initial={false}>{detached.map(renderThread)}</AnimatePresence>
175
+ </div>
176
+ </div>
177
+ ) : null}
178
+ </div>
179
+ {tab === "open" && empty && !draft ? (
180
+ <p className="m-0 px-4 py-4 text-[length:var(--size-sm)] text-text-subtle">
181
+ {readOnly
182
+ ? "No open comments."
183
+ : "No open comments. Select text in the doc to add one."}
184
+ </p>
185
+ ) : null}
186
+ {tab === "resolved" && resolved.length === 0 ? (
187
+ <p className="m-0 px-4 py-4 text-[length:var(--size-sm)] text-text-subtle">
188
+ No resolved comments.
189
+ </p>
190
+ ) : null}
191
+ </div>
192
+ </>
193
+ );
194
+ }