@bridgebrew/sessions 0.0.0-stage → 0.0.7
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.
- package/LICENSE +21 -0
- package/README.md +43 -2
- package/answers.ts +167 -0
- package/browser/branch-actions.tsx +166 -0
- package/browser/changes.tsx +415 -0
- package/browser/children.tsx +650 -0
- package/browser/conversation.tsx +2381 -0
- package/browser/decision-questions.tsx +191 -0
- package/browser/elapsed.tsx +44 -0
- package/browser/gallery.tsx +218 -0
- package/browser/index.tsx +3434 -0
- package/browser/media-origins.tsx +38 -0
- package/browser/mobile.tsx +663 -0
- package/browser/open-link.tsx +30 -0
- package/browser/pull-request.tsx +116 -0
- package/browser/questions.tsx +156 -0
- package/browser/session-scheduled.tsx +203 -0
- package/browser/subagent-view.tsx +136 -0
- package/browser/subagents.tsx +339 -0
- package/browser/tabs.tsx +228 -0
- package/browser/tsconfig.json +15 -0
- package/browser/views/view.tsx +1064 -0
- package/browser/views.tsx +166 -0
- package/contract.ts +287 -0
- package/delegations.ts +1975 -0
- package/diff.ts +88 -0
- package/docs/en/images.mdx +51 -0
- package/docs/en/index.mdx +22 -0
- package/docs/en/meta.json +4 -0
- package/docs/en/organize-sessions.mdx +53 -0
- package/docs/en/start-a-session.mdx +63 -0
- package/docs/meta.json +4 -0
- package/git.ts +223 -0
- package/listing.ts +382 -0
- package/package.json +1023 -4
- package/peers.ts +677 -0
- package/pull-request-watch.ts +282 -0
- package/pull-requests.ts +606 -0
- package/server.ts +5915 -0
- package/text.ts +19 -0
- package/tsconfig.json +3 -0
- package/viewer-activity.ts +57 -0
- package/views/examples.ts +153 -0
- package/views/library.ts +1116 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// The questions of an open decision (the harness contract's `questions`: an agent's question tool), in its card: each
|
|
2
|
+
// question with its header and its options (what each means under it), checkboxes where several may be chosen, a text
|
|
3
|
+
// field where a free answer is allowed, and one Submit for the whole request (enabled once every required question has
|
|
4
|
+
// an answer, `checkAnswer`), beside Dismiss.
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Button, Checkbox, Icon, Textarea, cn } from '@bridge/ui';
|
|
7
|
+
import { checkAnswer, type Answers, type Question } from '../answers.ts';
|
|
8
|
+
|
|
9
|
+
export function DecisionQuestions({
|
|
10
|
+
questions,
|
|
11
|
+
busy,
|
|
12
|
+
onAnswer,
|
|
13
|
+
primary,
|
|
14
|
+
}: {
|
|
15
|
+
questions: Question[];
|
|
16
|
+
busy: boolean;
|
|
17
|
+
/** The request's answers, or `null` to dismiss it. */
|
|
18
|
+
onAnswer: (answer: Answers | null) => void;
|
|
19
|
+
/** Its first control, focused when nothing else is. */
|
|
20
|
+
primary?: React.Ref<HTMLButtonElement> | undefined;
|
|
21
|
+
}) {
|
|
22
|
+
const [chosen, setChosen] = React.useState<Record<string, string[]>>({});
|
|
23
|
+
const [texts, setTexts] = React.useState<Record<string, string>>({});
|
|
24
|
+
const answers: Answers = {
|
|
25
|
+
answers: questions.flatMap((question) => {
|
|
26
|
+
const options = chosen[question.id] ?? [];
|
|
27
|
+
const text = texts[question.id]?.trim() ?? '';
|
|
28
|
+
return options.length || text
|
|
29
|
+
? [
|
|
30
|
+
{
|
|
31
|
+
question: question.id,
|
|
32
|
+
...(options.length && { options }),
|
|
33
|
+
...(text && { text }),
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
: [];
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
const ready = !checkAnswer({ questions }, answers);
|
|
40
|
+
// A single choice is one answer: an option chosen clears its text, a text typed clears its option.
|
|
41
|
+
const pick = (question: Question, option: string, on: boolean) => {
|
|
42
|
+
if (!question.multiSelect && on) setTexts((was) => ({ ...was, [question.id]: '' }));
|
|
43
|
+
setChosen((was) => {
|
|
44
|
+
const now = was[question.id] ?? [];
|
|
45
|
+
return {
|
|
46
|
+
...was,
|
|
47
|
+
[question.id]: question.multiSelect
|
|
48
|
+
? on
|
|
49
|
+
? [...now.filter((each) => each !== option), option]
|
|
50
|
+
: now.filter((each) => each !== option)
|
|
51
|
+
: on
|
|
52
|
+
? [option]
|
|
53
|
+
: [],
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
return (
|
|
58
|
+
<form
|
|
59
|
+
data-who="decision-questions"
|
|
60
|
+
className="mt-2 flex flex-col gap-3"
|
|
61
|
+
onSubmit={(event) => {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
if (ready && !busy) onAnswer(answers);
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
{questions.map((question, index) => {
|
|
67
|
+
const mine = chosen[question.id] ?? [];
|
|
68
|
+
return (
|
|
69
|
+
<fieldset
|
|
70
|
+
key={question.id}
|
|
71
|
+
data-question={question.id}
|
|
72
|
+
className="m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0"
|
|
73
|
+
>
|
|
74
|
+
<legend className="mb-1 flex min-w-0 flex-wrap items-baseline gap-x-2 p-0">
|
|
75
|
+
{question.header && (
|
|
76
|
+
<span className="shrink-0 rounded-sm bg-surface px-1.5 text-[11px] font-medium uppercase tracking-wide text-secondary">
|
|
77
|
+
{question.header}
|
|
78
|
+
</span>
|
|
79
|
+
)}
|
|
80
|
+
<span className="whitespace-pre-wrap break-words text-foreground">
|
|
81
|
+
{question.question}
|
|
82
|
+
</span>
|
|
83
|
+
{question.multiSelect && <span className="text-xs text-muted">Choose any</span>}
|
|
84
|
+
{question.required === false && <span className="text-xs text-muted">Optional</span>}
|
|
85
|
+
</legend>
|
|
86
|
+
{question.options.length > 0 && (
|
|
87
|
+
<ul
|
|
88
|
+
className="m-0 flex list-none flex-col gap-1 p-0"
|
|
89
|
+
aria-label={question.header ?? question.question}
|
|
90
|
+
>
|
|
91
|
+
{question.options.map((option, at) => {
|
|
92
|
+
const on = mine.includes(option.id);
|
|
93
|
+
const first = index === 0 && at === 0;
|
|
94
|
+
const describe = option.description
|
|
95
|
+
? `${question.id}-${option.id}-about`
|
|
96
|
+
: undefined;
|
|
97
|
+
return (
|
|
98
|
+
<li key={option.id} className="flex min-w-0 items-start gap-2">
|
|
99
|
+
{question.multiSelect ? (
|
|
100
|
+
<label className="flex min-w-0 cursor-pointer items-start gap-2 py-0.5">
|
|
101
|
+
<Checkbox
|
|
102
|
+
ref={first ? primary : undefined}
|
|
103
|
+
className="mt-0.5"
|
|
104
|
+
data-option={option.id}
|
|
105
|
+
checked={on}
|
|
106
|
+
disabled={busy}
|
|
107
|
+
aria-describedby={describe}
|
|
108
|
+
onCheckedChange={(checked) => pick(question, option.id, checked)}
|
|
109
|
+
/>
|
|
110
|
+
<span className="min-w-0">
|
|
111
|
+
<span className="text-foreground">{option.label}</span>
|
|
112
|
+
{option.description && (
|
|
113
|
+
<span id={describe} className="block text-xs text-muted">
|
|
114
|
+
{option.description}
|
|
115
|
+
</span>
|
|
116
|
+
)}
|
|
117
|
+
</span>
|
|
118
|
+
</label>
|
|
119
|
+
) : (
|
|
120
|
+
<>
|
|
121
|
+
<Button
|
|
122
|
+
ref={first ? primary : undefined}
|
|
123
|
+
type="button"
|
|
124
|
+
size="sm"
|
|
125
|
+
variant="outline"
|
|
126
|
+
data-option={option.id}
|
|
127
|
+
aria-pressed={on}
|
|
128
|
+
aria-describedby={describe}
|
|
129
|
+
disabled={busy}
|
|
130
|
+
className={cn('shrink-0 gap-1', on && 'border-accent text-foreground')}
|
|
131
|
+
onClick={() => pick(question, option.id, !on)}
|
|
132
|
+
>
|
|
133
|
+
{on && <Icon name="check" size={12} />}
|
|
134
|
+
{option.label}
|
|
135
|
+
</Button>
|
|
136
|
+
{option.description && (
|
|
137
|
+
<span id={describe} className="min-w-0 pt-0.5 text-xs text-muted">
|
|
138
|
+
{option.description}
|
|
139
|
+
</span>
|
|
140
|
+
)}
|
|
141
|
+
</>
|
|
142
|
+
)}
|
|
143
|
+
</li>
|
|
144
|
+
);
|
|
145
|
+
})}
|
|
146
|
+
</ul>
|
|
147
|
+
)}
|
|
148
|
+
{question.custom && (
|
|
149
|
+
<Textarea
|
|
150
|
+
variant="outline"
|
|
151
|
+
aria-label={`${question.header ?? question.question}: your own answer`}
|
|
152
|
+
placeholder={
|
|
153
|
+
question.options.length ? 'Or answer in your own words…' : 'Your answer…'
|
|
154
|
+
}
|
|
155
|
+
value={texts[question.id] ?? ''}
|
|
156
|
+
disabled={busy}
|
|
157
|
+
onInput={(event) => {
|
|
158
|
+
const value = event.currentTarget.value;
|
|
159
|
+
setTexts((was) => ({ ...was, [question.id]: value }));
|
|
160
|
+
if (!question.multiSelect && value.trim())
|
|
161
|
+
setChosen((was) => ({ ...was, [question.id]: [] }));
|
|
162
|
+
}}
|
|
163
|
+
onKeyDown={(event) => {
|
|
164
|
+
// ⌘↵ submits the request; ↵ alone is a new line.
|
|
165
|
+
if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
event.currentTarget.form?.requestSubmit();
|
|
168
|
+
}
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</fieldset>
|
|
173
|
+
);
|
|
174
|
+
})}
|
|
175
|
+
<div className="flex flex-wrap items-center justify-end gap-2">
|
|
176
|
+
<Button
|
|
177
|
+
type="button"
|
|
178
|
+
size="sm"
|
|
179
|
+
variant="ghost"
|
|
180
|
+
disabled={busy}
|
|
181
|
+
onClick={() => onAnswer(null)}
|
|
182
|
+
>
|
|
183
|
+
Dismiss
|
|
184
|
+
</Button>
|
|
185
|
+
<Button type="submit" size="sm" variant="primary" data-submit disabled={busy || !ready}>
|
|
186
|
+
Submit
|
|
187
|
+
</Button>
|
|
188
|
+
</div>
|
|
189
|
+
</form>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Time and activity marks the session views share (./conversation.tsx, ./children.tsx): a duration in short, a clock
|
|
2
|
+
// ticking from a start, and the spinner of something running.
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Icon, cn } from '@bridge/ui';
|
|
5
|
+
|
|
6
|
+
/** A duration, short: "0.4s", "12s", "2m 14s", "1h 3m". */
|
|
7
|
+
export const duration = (ms: number) => {
|
|
8
|
+
if (ms < 10_000) return `${Math.max(0, ms / 1000).toFixed(ms < 1000 ? 1 : 0)}s`;
|
|
9
|
+
const seconds = Math.round(ms / 1000);
|
|
10
|
+
if (seconds < 60) return `${seconds}s`;
|
|
11
|
+
const minutes = Math.floor(seconds / 60);
|
|
12
|
+
if (minutes < 60) return `${minutes}m ${seconds % 60}s`;
|
|
13
|
+
return `${Math.floor(minutes / 60)}h ${minutes % 60}m`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Spinner = ({
|
|
17
|
+
label = 'Running',
|
|
18
|
+
className,
|
|
19
|
+
size = 14,
|
|
20
|
+
}: {
|
|
21
|
+
label?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
size?: number;
|
|
24
|
+
}) => (
|
|
25
|
+
<span role="img" aria-label={label} className={cn('inline-flex text-muted', className)}>
|
|
26
|
+
<Icon name="loader-circle" size={size} className="animate-spin motion-reduce:animate-none" />
|
|
27
|
+
</span>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/** "0:42" ("42s" when `short`), ticking each second from `since`. */
|
|
31
|
+
export function Elapsed({ since, short = false }: { since?: string | undefined; short?: boolean }) {
|
|
32
|
+
const [now, setNow] = React.useState(Date.now);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
const timer = setInterval(() => setNow(Date.now()), 1000);
|
|
35
|
+
return () => clearInterval(timer);
|
|
36
|
+
}, []);
|
|
37
|
+
const seconds = since ? Math.max(0, Math.floor((now - Date.parse(since)) / 1000)) : 0;
|
|
38
|
+
const text = short
|
|
39
|
+
? duration(Math.max(1, seconds) * 1000)
|
|
40
|
+
: seconds >= 3600
|
|
41
|
+
? `${Math.floor(seconds / 3600)}:${String(Math.floor(seconds / 60) % 60).padStart(2, '0')}:${String(seconds % 60).padStart(2, '0')}`
|
|
42
|
+
: `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`;
|
|
43
|
+
return <span className="tabular-nums">{text}</span>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// The gallery, opened from a session: the images and videos the user pinned, kept for good, newest first, in the session, its
|
|
2
|
+
// project, or the whole workspace (the project when the session has one). A thumbnail opens the viewer over the scope's
|
|
3
|
+
// images, which can unpin one and open the session it came from; nothing else lives here (no sidebar entry).
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
Dialog,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
EmptyState,
|
|
11
|
+
Icon,
|
|
12
|
+
SegmentGroup,
|
|
13
|
+
Tooltip,
|
|
14
|
+
TooltipContent,
|
|
15
|
+
TooltipTrigger,
|
|
16
|
+
formatDate,
|
|
17
|
+
} from '@bridge/ui';
|
|
18
|
+
import { blobUrl, ImageViewer, type Pinned, type Viewed } from '@bridge/session-ui/media';
|
|
19
|
+
|
|
20
|
+
/** Where the gallery looks: a node and everything below it, or one session of it. */
|
|
21
|
+
export interface Scope {
|
|
22
|
+
key: 'session' | 'project' | 'workspace';
|
|
23
|
+
label: string;
|
|
24
|
+
node: string;
|
|
25
|
+
session?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function GalleryDialog({
|
|
29
|
+
open,
|
|
30
|
+
onOpenChange,
|
|
31
|
+
workspace,
|
|
32
|
+
scopes,
|
|
33
|
+
load,
|
|
34
|
+
unpin,
|
|
35
|
+
onOpenSession,
|
|
36
|
+
titleOf,
|
|
37
|
+
}: {
|
|
38
|
+
open: boolean;
|
|
39
|
+
onOpenChange: (open: boolean) => void;
|
|
40
|
+
workspace: string;
|
|
41
|
+
scopes: Scope[];
|
|
42
|
+
load: (scope: Scope) => Promise<Pinned[]>;
|
|
43
|
+
unpin: (pin: Pinned) => Promise<void>;
|
|
44
|
+
/** Opens session `id`; `titleOf` names the sessions it can open (those of the page's listing). */
|
|
45
|
+
onOpenSession: (id: string) => void;
|
|
46
|
+
titleOf: (id: string) => string | undefined;
|
|
47
|
+
}) {
|
|
48
|
+
const [key, setKey] = React.useState<Scope['key']>();
|
|
49
|
+
const scope =
|
|
50
|
+
scopes.find((each) => each.key === key) ??
|
|
51
|
+
scopes.find((each) => each.key === 'project') ??
|
|
52
|
+
scopes[0]!;
|
|
53
|
+
const [pins, setPins] = React.useState<Pinned[]>();
|
|
54
|
+
const [index, setIndex] = React.useState<number | null>(null);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (!open) return;
|
|
57
|
+
let live = true;
|
|
58
|
+
setPins(undefined);
|
|
59
|
+
load(scope).then(
|
|
60
|
+
(found) => {
|
|
61
|
+
if (live) setPins(found);
|
|
62
|
+
},
|
|
63
|
+
() => {
|
|
64
|
+
if (live) setPins([]);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
return () => {
|
|
68
|
+
live = false;
|
|
69
|
+
};
|
|
70
|
+
}, [open, scope.key, scope.node, scope.session]);
|
|
71
|
+
const images: (Viewed & { pin: Pinned })[] = (pins ?? []).map((pin) => ({
|
|
72
|
+
url: blobUrl(workspace, pin),
|
|
73
|
+
name: pin.name,
|
|
74
|
+
...(pin.caption && { caption: pin.caption }),
|
|
75
|
+
blob: pin.blob,
|
|
76
|
+
...(pin.type.startsWith('video/') && { video: true }),
|
|
77
|
+
pin,
|
|
78
|
+
}));
|
|
79
|
+
// In the gallery every image is pinned: Unpin takes it out, and the viewer goes on with the next one.
|
|
80
|
+
const pinsOf = {
|
|
81
|
+
pinned: (image: Viewed) => pins?.find((each) => each.blob === image.blob),
|
|
82
|
+
toggle: async (image: Viewed) => {
|
|
83
|
+
const pin = pins?.find((each) => each.blob === image.blob);
|
|
84
|
+
if (!pin) return;
|
|
85
|
+
// Refused: the page says why (`unpin` reports it), the image stays.
|
|
86
|
+
try {
|
|
87
|
+
await unpin(pin);
|
|
88
|
+
} catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const left = pins!.filter((each) => each !== pin);
|
|
92
|
+
setPins(left);
|
|
93
|
+
setIndex((at) => (at === null || !left.length ? null : Math.min(at, left.length - 1)));
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
return (
|
|
97
|
+
<Dialog
|
|
98
|
+
open={open}
|
|
99
|
+
onOpenChange={(next) => {
|
|
100
|
+
if (!next) setIndex(null);
|
|
101
|
+
onOpenChange(next);
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<DialogContent fullscreen className="outline-none">
|
|
105
|
+
<header className="flex shrink-0 items-center gap-3 border-b border-border-subtle px-4 py-3">
|
|
106
|
+
<Icon name="image" size={16} className="text-muted" />
|
|
107
|
+
<DialogTitle className="m-0 text-sm font-semibold">Gallery</DialogTitle>
|
|
108
|
+
{scopes.length > 1 && (
|
|
109
|
+
<SegmentGroup
|
|
110
|
+
aria-label="Show the pinned images of"
|
|
111
|
+
items={scopes.map(({ key: value, label }) => ({ value, label }))}
|
|
112
|
+
value={scope.key}
|
|
113
|
+
onValueChange={(value) => setKey(value as Scope['key'])}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
<span className="text-xs text-muted">{pins ? `${pins.length} pinned` : ''}</span>
|
|
117
|
+
<span className="flex-1" />
|
|
118
|
+
<Button size="icon" aria-label="Close" onClick={() => onOpenChange(false)}>
|
|
119
|
+
<Icon name="x" size={16} />
|
|
120
|
+
</Button>
|
|
121
|
+
</header>
|
|
122
|
+
<div className="min-h-0 flex-1 overflow-auto p-4">
|
|
123
|
+
{pins && !pins.length && (
|
|
124
|
+
<EmptyState className="mx-auto mt-6 max-w-sm">
|
|
125
|
+
No pinned image here yet. Open an image in a session and pin it: Bridge keeps a copy
|
|
126
|
+
for good. The others stay where the agent wrote them.
|
|
127
|
+
</EmptyState>
|
|
128
|
+
)}
|
|
129
|
+
<div
|
|
130
|
+
data-who="gallery"
|
|
131
|
+
className="grid grid-cols-[repeat(auto-fill,minmax(10rem,1fr))] gap-3"
|
|
132
|
+
>
|
|
133
|
+
{images.map((image, i) => (
|
|
134
|
+
<button
|
|
135
|
+
key={image.pin.id}
|
|
136
|
+
type="button"
|
|
137
|
+
title={image.caption ?? image.name}
|
|
138
|
+
aria-label={`Preview ${image.caption ?? image.name}`}
|
|
139
|
+
className="m-0 flex min-w-0 cursor-zoom-in appearance-none flex-col gap-1 border-0 bg-transparent p-0 text-left outline-none focus:outline-none"
|
|
140
|
+
onClick={() => setIndex(i)}
|
|
141
|
+
>
|
|
142
|
+
<span className="relative block aspect-square w-full overflow-hidden rounded-lg border border-solid border-border bg-hover">
|
|
143
|
+
{image.video ? (
|
|
144
|
+
<>
|
|
145
|
+
<video
|
|
146
|
+
className="block size-full object-cover"
|
|
147
|
+
src={image.url}
|
|
148
|
+
preload="metadata"
|
|
149
|
+
muted
|
|
150
|
+
aria-hidden="true"
|
|
151
|
+
/>
|
|
152
|
+
<span className="absolute inset-0 flex items-center justify-center">
|
|
153
|
+
<span className="inline-flex size-9 items-center justify-center rounded-full bg-black/55 text-white">
|
|
154
|
+
<svg
|
|
155
|
+
aria-hidden="true"
|
|
156
|
+
viewBox="0 0 16 16"
|
|
157
|
+
className="ml-0.5 size-4 fill-current"
|
|
158
|
+
>
|
|
159
|
+
<path d="M4 2.5v11l9-5.5z" />
|
|
160
|
+
</svg>
|
|
161
|
+
</span>
|
|
162
|
+
</span>
|
|
163
|
+
</>
|
|
164
|
+
) : (
|
|
165
|
+
<img
|
|
166
|
+
className="block size-full object-cover"
|
|
167
|
+
src={image.url}
|
|
168
|
+
alt={image.caption ?? image.name}
|
|
169
|
+
loading="lazy"
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</span>
|
|
173
|
+
<span className="block w-full truncate text-xs text-secondary">
|
|
174
|
+
{image.caption ?? image.name}
|
|
175
|
+
</span>
|
|
176
|
+
</button>
|
|
177
|
+
))}
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
<ImageViewer
|
|
181
|
+
images={images}
|
|
182
|
+
index={index}
|
|
183
|
+
onIndex={setIndex}
|
|
184
|
+
pins={pinsOf}
|
|
185
|
+
actions={(image) => {
|
|
186
|
+
const pin = pins?.find((each) => each.blob === image.blob);
|
|
187
|
+
const title = pin && titleOf(pin.session);
|
|
188
|
+
return (
|
|
189
|
+
pin &&
|
|
190
|
+
title !== undefined && (
|
|
191
|
+
<Tooltip>
|
|
192
|
+
<TooltipTrigger
|
|
193
|
+
render={
|
|
194
|
+
<Button
|
|
195
|
+
size="sm"
|
|
196
|
+
className="max-w-64 rounded-full bg-surface/80"
|
|
197
|
+
onClick={() => {
|
|
198
|
+
setIndex(null);
|
|
199
|
+
onOpenChange(false);
|
|
200
|
+
onOpenSession(pin.session);
|
|
201
|
+
}}
|
|
202
|
+
/>
|
|
203
|
+
}
|
|
204
|
+
>
|
|
205
|
+
<span className="truncate">Open {title}</span>
|
|
206
|
+
</TooltipTrigger>
|
|
207
|
+
<TooltipContent>
|
|
208
|
+
Pinned {formatDate(pin.pinnedAt, { dateStyle: 'medium' })} in this session
|
|
209
|
+
</TooltipContent>
|
|
210
|
+
</Tooltip>
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
}}
|
|
214
|
+
/>
|
|
215
|
+
</DialogContent>
|
|
216
|
+
</Dialog>
|
|
217
|
+
);
|
|
218
|
+
}
|