@dxos/plugin-thread 0.7.4-staging.f7e8224 → 0.7.5-labs.071a3e2
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/dist/lib/browser/ThreadContainer-T4WIBHY6.mjs +19 -0
- package/dist/lib/browser/ThreadContainer-T4WIBHY6.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-IANFWFYN.mjs +121 -0
- package/dist/lib/browser/app-graph-builder-IANFWFYN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-52HWDLBR.mjs → chunk-5EQVG4L3.mjs} +33 -121
- package/dist/lib/browser/chunk-5EQVG4L3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ENERBDYI.mjs → chunk-636QDHE3.mjs} +3 -3
- package/dist/lib/browser/chunk-636QDHE3.mjs.map +7 -0
- package/dist/lib/browser/chunk-BNEWNQBO.mjs +71 -0
- package/dist/lib/browser/chunk-BNEWNQBO.mjs.map +7 -0
- package/dist/lib/browser/chunk-L4QHQNDC.mjs +18 -0
- package/dist/lib/browser/chunk-L4QHQNDC.mjs.map +7 -0
- package/dist/lib/browser/chunk-NAO3LZMZ.mjs +16 -0
- package/dist/lib/browser/chunk-NAO3LZMZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-NO5AZLUZ.mjs +81 -0
- package/dist/lib/browser/chunk-NO5AZLUZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +147 -1094
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-QFP6L3AF.mjs +287 -0
- package/dist/lib/browser/intent-resolver-QFP6L3AF.mjs.map +7 -0
- package/dist/lib/browser/markdown-2NBXKXCY.mjs +112 -0
- package/dist/lib/browser/markdown-2NBXKXCY.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-LDPZN456.mjs +424 -0
- package/dist/lib/browser/react-surface-LDPZN456.mjs.map +7 -0
- package/dist/lib/browser/settings-TKOPRXSU.mjs +22 -0
- package/dist/lib/browser/settings-TKOPRXSU.mjs.map +7 -0
- package/dist/lib/browser/state-GNFUURIC.mjs +33 -0
- package/dist/lib/browser/state-GNFUURIC.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +6 -4
- package/dist/lib/node/{ThreadArticle-I7ADXDW3.cjs → ThreadContainer-4XACAVGV.cjs} +14 -13
- package/dist/lib/node/ThreadContainer-4XACAVGV.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-LFEDPJLK.cjs +135 -0
- package/dist/lib/node/app-graph-builder-LFEDPJLK.cjs.map +7 -0
- package/dist/lib/node/{ThreadMain-MRNJC3TI.cjs → chunk-346YIZVL.cjs} +26 -23
- package/dist/lib/node/chunk-346YIZVL.cjs.map +7 -0
- package/dist/lib/node/chunk-AUVKOX5Q.cjs +101 -0
- package/dist/lib/node/chunk-AUVKOX5Q.cjs.map +7 -0
- package/dist/lib/node/chunk-AWSTZ2KN.cjs +93 -0
- package/dist/lib/node/chunk-AWSTZ2KN.cjs.map +7 -0
- package/dist/lib/node/{chunk-IC2NICNC.cjs → chunk-F735VMTN.cjs} +7 -7
- package/dist/lib/node/chunk-F735VMTN.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-FPWNZ6TB.cjs} +13 -10
- package/dist/lib/node/chunk-FPWNZ6TB.cjs.map +7 -0
- package/dist/lib/node/{chunk-YCDM2SZM.cjs → chunk-VAZ3BCTU.cjs} +77 -168
- package/dist/lib/node/chunk-VAZ3BCTU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +142 -1083
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-ZSOQILPJ.cjs +299 -0
- package/dist/lib/node/intent-resolver-ZSOQILPJ.cjs.map +7 -0
- package/dist/lib/node/markdown-FWRKMSKV.cjs +122 -0
- package/dist/lib/node/markdown-FWRKMSKV.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-MCQUT7BC.cjs +426 -0
- package/dist/lib/node/react-surface-MCQUT7BC.cjs.map +7 -0
- package/dist/lib/node/settings-TH4YSUVU.cjs +36 -0
- package/dist/lib/node/settings-TH4YSUVU.cjs.map +7 -0
- package/dist/lib/node/state-TQWEZ6B3.cjs +49 -0
- package/dist/lib/node/state-TQWEZ6B3.cjs.map +7 -0
- package/dist/lib/node/types.cjs +6 -4
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/ThreadContainer-FGFB25TQ.mjs +20 -0
- package/dist/lib/node-esm/ThreadContainer-FGFB25TQ.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-IXHFRMCY.mjs +122 -0
- package/dist/lib/node-esm/app-graph-builder-IXHFRMCY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3INUK3A6.mjs +20 -0
- package/dist/lib/node-esm/chunk-3INUK3A6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-B3CF35MY.mjs +82 -0
- package/dist/lib/node-esm/chunk-B3CF35MY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JG7MXH6O.mjs → chunk-DKCH2H5C.mjs} +33 -121
- package/dist/lib/node-esm/chunk-DKCH2H5C.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7QRGG25F.mjs → chunk-FXUATCLW.mjs} +3 -3
- package/dist/lib/node-esm/chunk-FXUATCLW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HLWJTUWZ.mjs +73 -0
- package/dist/lib/node-esm/chunk-HLWJTUWZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZJITX3TO.mjs +17 -0
- package/dist/lib/node-esm/chunk-ZJITX3TO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +147 -1094
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-MHP4C2NZ.mjs +288 -0
- package/dist/lib/node-esm/intent-resolver-MHP4C2NZ.mjs.map +7 -0
- package/dist/lib/node-esm/markdown-6AQFDAW3.mjs +113 -0
- package/dist/lib/node-esm/markdown-6AQFDAW3.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-6JMVZUDM.mjs +425 -0
- package/dist/lib/node-esm/react-surface-6JMVZUDM.mjs.map +7 -0
- package/dist/lib/node-esm/settings-KEDRR7RM.mjs +23 -0
- package/dist/lib/node-esm/settings-KEDRR7RM.mjs.map +7 -0
- package/dist/lib/node-esm/state-7MLR27YG.mjs +34 -0
- package/dist/lib/node-esm/state-7MLR27YG.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +6 -4
- package/dist/types/src/ThreadPlugin.d.ts +1 -3
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +180 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +15 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +187 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +4 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +7 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentContainer.d.ts +1 -1
- package/dist/types/src/components/CommentContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts +2 -7
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts +1 -6
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
- package/dist/types/src/components/ThreadContainer.d.ts +7 -0
- package/dist/types/src/components/ThreadContainer.d.ts.map +1 -0
- package/dist/types/src/components/command-extension.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -15
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +50 -66
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +5 -5
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/extensions/threads.d.ts +2 -2
- package/dist/types/src/extensions/threads.d.ts.map +1 -1
- package/dist/types/src/hooks/analytics.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +86 -22
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -38
- package/src/ThreadPlugin.tsx +108 -620
- package/src/capabilities/app-graph-builder.ts +119 -0
- package/src/capabilities/capabilities.ts +19 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +239 -0
- package/src/capabilities/markdown.ts +18 -0
- package/src/capabilities/react-surface.tsx +62 -0
- package/src/capabilities/settings.ts +14 -0
- package/src/capabilities/state.ts +25 -0
- package/src/components/Chat.stories.tsx +26 -22
- package/src/components/ChatContainer.tsx +12 -10
- package/src/components/CommentContainer.tsx +21 -32
- package/src/components/CommentsContainer.tsx +1 -17
- package/src/components/MessageContainer.tsx +7 -5
- package/src/components/ThreadComplementary.tsx +91 -68
- package/src/components/ThreadContainer.tsx +22 -0
- package/src/components/ThreadSettings.tsx +3 -3
- package/src/components/command-extension.ts +2 -5
- package/src/components/index.ts +1 -2
- package/src/components/testing.ts +26 -22
- package/src/components/types.ts +5 -5
- package/src/extensions/threads.ts +16 -25
- package/src/hooks/analytics.ts +6 -10
- package/src/index.ts +1 -5
- package/src/meta.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/types.ts +70 -38
- package/dist/lib/browser/ThreadArticle-6IXTL7CH.mjs +0 -18
- package/dist/lib/browser/ThreadArticle-6IXTL7CH.mjs.map +0 -7
- package/dist/lib/browser/ThreadMain-4IAS67KE.mjs +0 -26
- package/dist/lib/browser/ThreadMain-4IAS67KE.mjs.map +0 -7
- package/dist/lib/browser/chunk-52HWDLBR.mjs.map +0 -7
- package/dist/lib/browser/chunk-ENERBDYI.mjs.map +0 -7
- package/dist/lib/browser/chunk-XUHNZID5.mjs +0 -20
- package/dist/lib/browser/chunk-XUHNZID5.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/ThreadArticle-I7ADXDW3.cjs.map +0 -7
- package/dist/lib/node/ThreadMain-MRNJC3TI.cjs.map +0 -7
- package/dist/lib/node/chunk-IC2NICNC.cjs.map +0 -7
- package/dist/lib/node/chunk-XFO6D2LG.cjs +0 -39
- package/dist/lib/node/chunk-XFO6D2LG.cjs.map +0 -7
- package/dist/lib/node/chunk-YCDM2SZM.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/ThreadArticle-CJHYMF2W.mjs +0 -19
- package/dist/lib/node-esm/ThreadArticle-CJHYMF2W.mjs.map +0 -7
- package/dist/lib/node-esm/ThreadMain-VISGW4IF.mjs +0 -27
- package/dist/lib/node-esm/ThreadMain-VISGW4IF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7QRGG25F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-I5MU54RT.mjs +0 -21
- package/dist/lib/node-esm/chunk-I5MU54RT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JG7MXH6O.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -12
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/components/ThreadArticle.d.ts +0 -5
- package/dist/types/src/components/ThreadArticle.d.ts.map +0 -1
- package/dist/types/src/components/ThreadMain.d.ts +0 -7
- package/dist/types/src/components/ThreadMain.d.ts.map +0 -1
- package/src/components/ThreadArticle.tsx +0 -18
- package/src/components/ThreadMain.tsx +0 -27
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, createIntent, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
7
|
+
import { createExtension, toSignal } from '@dxos/plugin-graph';
|
|
8
|
+
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
9
|
+
import { memoizeQuery } from '@dxos/plugin-space';
|
|
10
|
+
import { getTypename, parseId, SpaceState } from '@dxos/react-client/echo';
|
|
11
|
+
|
|
12
|
+
import { ThreadCapabilities } from './capabilities';
|
|
13
|
+
import { THREAD_PLUGIN } from '../meta';
|
|
14
|
+
|
|
15
|
+
const type = 'orphan-comments-for-subject';
|
|
16
|
+
const icon = 'ph--chat-text--regular';
|
|
17
|
+
|
|
18
|
+
export default (context: PluginsContext) => {
|
|
19
|
+
const resolver = (typename: string) =>
|
|
20
|
+
context.requestCapabilities(Capabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {};
|
|
21
|
+
|
|
22
|
+
return contributes(
|
|
23
|
+
Capabilities.AppGraphBuilder,
|
|
24
|
+
createExtension({
|
|
25
|
+
id: `${THREAD_PLUGIN}/comments-for-subject`,
|
|
26
|
+
resolver: ({ id }) => {
|
|
27
|
+
if (!id.endsWith('~comments')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
32
|
+
const [subjectId] = id.split('~');
|
|
33
|
+
const { spaceId, objectId } = parseId(subjectId);
|
|
34
|
+
const spaces = toSignal(
|
|
35
|
+
(onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,
|
|
36
|
+
() => client.spaces.get(),
|
|
37
|
+
);
|
|
38
|
+
const space = spaces?.find((space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY);
|
|
39
|
+
if (!objectId) {
|
|
40
|
+
// TODO(wittjosiah): Support comments for arbitrary subjects.
|
|
41
|
+
// This is to ensure that the comments panel is not stuck on an old object.
|
|
42
|
+
return {
|
|
43
|
+
id,
|
|
44
|
+
type,
|
|
45
|
+
data: null,
|
|
46
|
+
properties: {
|
|
47
|
+
icon,
|
|
48
|
+
label: ['unnamed object threads label', { ns: THREAD_PLUGIN }],
|
|
49
|
+
showResolvedThreads: false,
|
|
50
|
+
object: null,
|
|
51
|
+
space,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const [object] = memoizeQuery(space, { id: objectId });
|
|
57
|
+
if (!object || !subjectId) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const meta = resolver(getTypename(object) ?? '');
|
|
62
|
+
const label = meta.label?.(object) ||
|
|
63
|
+
object.name ||
|
|
64
|
+
meta.placeholder || ['unnamed object threads label', { ns: THREAD_PLUGIN }];
|
|
65
|
+
|
|
66
|
+
const { getViewState } = context.requestCapability(ThreadCapabilities.State);
|
|
67
|
+
const viewState = getViewState(subjectId);
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
id,
|
|
71
|
+
type,
|
|
72
|
+
data: null,
|
|
73
|
+
properties: {
|
|
74
|
+
icon,
|
|
75
|
+
label,
|
|
76
|
+
showResolvedThreads: viewState.showResolvedThreads,
|
|
77
|
+
object,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
actions: ({ node }) => {
|
|
82
|
+
const dataId = node.id.split('~').at(0);
|
|
83
|
+
if (!node.id.endsWith('~comments') || !dataId) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const [spaceId, objectId] = dataId.split(':');
|
|
88
|
+
|
|
89
|
+
const { getViewState } = context.requestCapability(ThreadCapabilities.State);
|
|
90
|
+
const viewState = getViewState(dataId);
|
|
91
|
+
const toggle = async () => {
|
|
92
|
+
const newToggleState = !viewState.showResolvedThreads;
|
|
93
|
+
viewState.showResolvedThreads = newToggleState;
|
|
94
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
95
|
+
await dispatch(
|
|
96
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
97
|
+
name: 'threads.toggle-show-resolved',
|
|
98
|
+
properties: { spaceId, threadId: objectId, showResolved: newToggleState },
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return [
|
|
104
|
+
{
|
|
105
|
+
id: `${THREAD_PLUGIN}/toggle-show-resolved/${node.id}`,
|
|
106
|
+
data: toggle,
|
|
107
|
+
properties: {
|
|
108
|
+
label: ['toggle show resolved', { ns: THREAD_PLUGIN }],
|
|
109
|
+
menuItemType: 'toggle',
|
|
110
|
+
isChecked: viewState.showResolvedThreads,
|
|
111
|
+
testId: 'threadPlugin.toggleShowResolved',
|
|
112
|
+
icon: viewState.showResolvedThreads ? 'ph--eye-slash--regular' : 'ph--eye--regular',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
+
import { type DeepReadonly } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
import { THREAD_PLUGIN } from '../meta';
|
|
9
|
+
import { type ViewState, type ThreadState } from '../types';
|
|
10
|
+
|
|
11
|
+
export namespace ThreadCapabilities {
|
|
12
|
+
type GetViewState = (subjectId: string) => ViewState;
|
|
13
|
+
export const State = defineCapability<{ state: DeepReadonly<ThreadState>; getViewState: GetViewState }>(
|
|
14
|
+
`${THREAD_PLUGIN}/capability/state`,
|
|
15
|
+
);
|
|
16
|
+
export const MutableState = defineCapability<{ state: ThreadState; getViewState: GetViewState }>(
|
|
17
|
+
`${THREAD_PLUGIN}/capability/state`,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { lazy } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
|
|
8
|
+
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
|
+
export const Markdown = lazy(() => import('./markdown'));
|
|
10
|
+
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
11
|
+
export const ThreadSettings = lazy(() => import('./settings'));
|
|
12
|
+
export const ThreadState = lazy(() => import('./state'));
|
|
13
|
+
|
|
14
|
+
export * from './capabilities';
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Capabilities,
|
|
7
|
+
contributes,
|
|
8
|
+
createIntent,
|
|
9
|
+
createResolver,
|
|
10
|
+
LayoutAction,
|
|
11
|
+
type PluginsContext,
|
|
12
|
+
} from '@dxos/app-framework';
|
|
13
|
+
import { Ref } from '@dxos/echo-schema';
|
|
14
|
+
import { log } from '@dxos/log';
|
|
15
|
+
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
16
|
+
import { ChannelType, ThreadType } from '@dxos/plugin-space/types';
|
|
17
|
+
import { create, fullyQualifiedId, getSpace, makeRef } from '@dxos/react-client/echo';
|
|
18
|
+
|
|
19
|
+
import { ThreadCapabilities } from './capabilities';
|
|
20
|
+
import { THREAD_PLUGIN } from '../meta';
|
|
21
|
+
import { ThreadAction } from '../types';
|
|
22
|
+
|
|
23
|
+
export default (context: PluginsContext) =>
|
|
24
|
+
contributes(Capabilities.IntentResolver, [
|
|
25
|
+
createResolver({
|
|
26
|
+
intent: ThreadAction.Create,
|
|
27
|
+
resolve: ({ name, cursor, subject }) => {
|
|
28
|
+
if (cursor && subject) {
|
|
29
|
+
// Seed the threads array if it does not exist.
|
|
30
|
+
if (subject?.threads === undefined) {
|
|
31
|
+
try {
|
|
32
|
+
// Static schema will throw an error if subject does not support threads array property.
|
|
33
|
+
subject.threads = [];
|
|
34
|
+
} catch (err) {
|
|
35
|
+
log.error('Subject does not support threads array', { typename: subject?.typename });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { state } = context.requestCapability(ThreadCapabilities.MutableState);
|
|
41
|
+
const subjectId = fullyQualifiedId(subject);
|
|
42
|
+
const thread = create(ThreadType, { name, anchor: cursor, messages: [], status: 'staged' });
|
|
43
|
+
const draft = state.drafts[subjectId];
|
|
44
|
+
if (draft) {
|
|
45
|
+
draft.push(thread);
|
|
46
|
+
} else {
|
|
47
|
+
state.drafts[subjectId] = [thread];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
data: { object: thread },
|
|
52
|
+
intents: [
|
|
53
|
+
createIntent(ThreadAction.Select, { current: fullyQualifiedId(thread) }),
|
|
54
|
+
createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', subject: 'comments' }),
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
// NOTE: This is the standalone thread creation case.
|
|
59
|
+
return {
|
|
60
|
+
data: { object: create(ChannelType, { threads: [makeRef(create(ThreadType, { messages: [] }))] }) },
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
createResolver({
|
|
66
|
+
intent: ThreadAction.Select,
|
|
67
|
+
resolve: ({ current, skipOpen }) => {
|
|
68
|
+
const { state } = context.requestCapability(ThreadCapabilities.MutableState);
|
|
69
|
+
state.current = current;
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
intents: !skipOpen
|
|
73
|
+
? [createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', subject: 'comments' })]
|
|
74
|
+
: undefined,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
createResolver({
|
|
79
|
+
intent: ThreadAction.ToggleResolved,
|
|
80
|
+
resolve: ({ thread }) => {
|
|
81
|
+
if (thread.status === 'active' || thread.status === undefined) {
|
|
82
|
+
thread.status = 'resolved';
|
|
83
|
+
} else if (thread.status === 'resolved') {
|
|
84
|
+
thread.status = 'active';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const space = getSpace(thread);
|
|
88
|
+
const spaceId = space?.id;
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
intents: [
|
|
92
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
93
|
+
name: 'threads.toggle-resolved',
|
|
94
|
+
properties: { threadId: thread.id, spaceId },
|
|
95
|
+
}),
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
createResolver({
|
|
101
|
+
intent: ThreadAction.Delete,
|
|
102
|
+
resolve: ({ subject, thread }, undo) => {
|
|
103
|
+
const { state } = context.requestCapability(ThreadCapabilities.MutableState);
|
|
104
|
+
const subjectId = fullyQualifiedId(subject);
|
|
105
|
+
const draft = state.drafts[subjectId];
|
|
106
|
+
if (draft) {
|
|
107
|
+
// Check if we're deleting a draft; if so, remove it.
|
|
108
|
+
const index = draft.findIndex((t) => t.id === thread.id);
|
|
109
|
+
if (index !== -1) {
|
|
110
|
+
draft.splice(index, 1);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const space = getSpace(thread);
|
|
116
|
+
if (!space || !subject.threads) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!undo) {
|
|
121
|
+
const index = subject.threads.findIndex((t: any) => t?.id === thread.id);
|
|
122
|
+
const cursor = subject.threads[index]?.anchor;
|
|
123
|
+
if (index !== -1) {
|
|
124
|
+
subject.threads?.splice(index, 1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
space.db.remove(thread);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
undoable: {
|
|
131
|
+
message: ['thread deleted label', { ns: THREAD_PLUGIN }],
|
|
132
|
+
data: { cursor },
|
|
133
|
+
},
|
|
134
|
+
intents: [
|
|
135
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
136
|
+
name: 'threads.delete',
|
|
137
|
+
properties: { threadId: thread.id, spaceId: space.id },
|
|
138
|
+
}),
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
} else {
|
|
142
|
+
// TODO(wittjosiah): SDK should do this automatically.
|
|
143
|
+
const savedThread = space.db.add(thread);
|
|
144
|
+
subject.threads.push(savedThread);
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
intents: [
|
|
148
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
149
|
+
name: 'threads.undo-delete',
|
|
150
|
+
properties: { threadId: thread.id, spaceId: space.id },
|
|
151
|
+
}),
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
}),
|
|
157
|
+
createResolver({
|
|
158
|
+
intent: ThreadAction.OnMessageAdd,
|
|
159
|
+
resolve: ({ thread, subject }) => {
|
|
160
|
+
const { state } = context.requestCapability(ThreadCapabilities.MutableState);
|
|
161
|
+
const subjectId = fullyQualifiedId(subject);
|
|
162
|
+
const space = getSpace(subject);
|
|
163
|
+
const intents = [];
|
|
164
|
+
const analyticsProperties = { threadId: thread.id, spaceId: space?.id };
|
|
165
|
+
|
|
166
|
+
if (state.drafts[subjectId]?.find((t) => t === thread)) {
|
|
167
|
+
// Move draft to document.
|
|
168
|
+
thread.status = 'active';
|
|
169
|
+
subject.threads ? subject.threads.push(makeRef(thread)) : (subject.threads = [makeRef(thread)]);
|
|
170
|
+
state.drafts[subjectId] = state.drafts[subjectId]?.filter(({ id }) => id !== thread.id);
|
|
171
|
+
intents.push(
|
|
172
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
173
|
+
name: 'threads.thread-created',
|
|
174
|
+
properties: analyticsProperties,
|
|
175
|
+
}),
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
intents.push(
|
|
180
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
181
|
+
name: 'threads.message-added',
|
|
182
|
+
properties: { ...analyticsProperties, threadLength: thread.messages.length },
|
|
183
|
+
}),
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
return { intents };
|
|
187
|
+
},
|
|
188
|
+
}),
|
|
189
|
+
createResolver({
|
|
190
|
+
intent: ThreadAction.DeleteMessage,
|
|
191
|
+
resolve: ({ subject, thread, messageId, message, messageIndex }, undo) => {
|
|
192
|
+
const space = getSpace(subject);
|
|
193
|
+
|
|
194
|
+
if (!undo) {
|
|
195
|
+
const messageIndex = thread.messages.findIndex(Ref.hasObjectId(messageId));
|
|
196
|
+
const message = thread.messages[messageIndex]?.target;
|
|
197
|
+
if (!message) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (messageIndex === 0 && thread.messages.length === 1) {
|
|
202
|
+
// If the message is the only message in the thread, delete the thread.
|
|
203
|
+
return {
|
|
204
|
+
intents: [createIntent(ThreadAction.Delete, { subject, thread })],
|
|
205
|
+
};
|
|
206
|
+
} else {
|
|
207
|
+
thread.messages.splice(messageIndex, 1);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
undoable: {
|
|
212
|
+
message: ['message deleted label', { ns: THREAD_PLUGIN }],
|
|
213
|
+
data: { message, messageIndex },
|
|
214
|
+
},
|
|
215
|
+
intents: [
|
|
216
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
217
|
+
name: 'threads.message.delete',
|
|
218
|
+
properties: { threadId: thread.id, spaceId: space?.id },
|
|
219
|
+
}),
|
|
220
|
+
],
|
|
221
|
+
};
|
|
222
|
+
} else {
|
|
223
|
+
if (!messageIndex || !message) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
thread.messages.splice(messageIndex, 0, makeRef(message));
|
|
228
|
+
return {
|
|
229
|
+
intents: [
|
|
230
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
231
|
+
name: 'threads.message.undo-delete',
|
|
232
|
+
properties: { threadId: thread.id, spaceId: space?.id },
|
|
233
|
+
}),
|
|
234
|
+
],
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
}),
|
|
239
|
+
]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
+
import { MarkdownCapabilities } from '@dxos/plugin-markdown';
|
|
7
|
+
|
|
8
|
+
import { ThreadCapabilities } from './capabilities';
|
|
9
|
+
import { threads } from '../extensions';
|
|
10
|
+
|
|
11
|
+
export default (context: PluginsContext) =>
|
|
12
|
+
contributes(MarkdownCapabilities.Extensions, [
|
|
13
|
+
({ document: doc }) => {
|
|
14
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
15
|
+
const { state } = context.requestCapability(ThreadCapabilities.MutableState);
|
|
16
|
+
return threads(state, doc, dispatch);
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, contributes, createSurface, useLayout } from '@dxos/app-framework';
|
|
8
|
+
import { type Ref } from '@dxos/echo-schema';
|
|
9
|
+
import { SettingsStore } from '@dxos/local-storage';
|
|
10
|
+
import { log } from '@dxos/log';
|
|
11
|
+
import { ChannelType, type ThreadType } from '@dxos/plugin-space/types';
|
|
12
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
13
|
+
|
|
14
|
+
import { ThreadContainer, ThreadComplementary, ThreadSettings } from '../components';
|
|
15
|
+
import { THREAD_PLUGIN } from '../meta';
|
|
16
|
+
import { type ThreadSettingsProps } from '../types';
|
|
17
|
+
|
|
18
|
+
export default () =>
|
|
19
|
+
contributes(Capabilities.ReactSurface, [
|
|
20
|
+
createSurface({
|
|
21
|
+
id: `${THREAD_PLUGIN}/channel`,
|
|
22
|
+
role: 'article',
|
|
23
|
+
filter: (data): data is { subject: ChannelType } =>
|
|
24
|
+
data.subject instanceof ChannelType && !!data.subject.threads[0],
|
|
25
|
+
component: ({ data, role }) => {
|
|
26
|
+
const layout = useLayout();
|
|
27
|
+
const channel = data.subject;
|
|
28
|
+
void channel.threads[0].load();
|
|
29
|
+
const thread = channel.threads[0].target;
|
|
30
|
+
if (!thread) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
log.info('thread', { thread });
|
|
34
|
+
const currentPosition = layout.active.findIndex((id) => id === channel.id);
|
|
35
|
+
if (currentPosition > 0) {
|
|
36
|
+
const objectToTheLeft = layout.active[currentPosition - 1];
|
|
37
|
+
const context = getSpace(channel)?.db.getObjectById(objectToTheLeft);
|
|
38
|
+
return <ThreadContainer role={role} thread={thread} context={context} />;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return <ThreadContainer role={role} thread={thread} />;
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
createSurface({
|
|
45
|
+
id: `${THREAD_PLUGIN}/thread`,
|
|
46
|
+
role: 'complementary--comments',
|
|
47
|
+
filter: (data): data is { subject: { threads: Ref<ThreadType>[] } } =>
|
|
48
|
+
!!data.subject &&
|
|
49
|
+
typeof data.subject === 'object' &&
|
|
50
|
+
'threads' in data.subject &&
|
|
51
|
+
Array.isArray(data.subject.threads) &&
|
|
52
|
+
!(data.subject instanceof ChannelType),
|
|
53
|
+
component: ({ data }) => <ThreadComplementary subject={data.subject} />,
|
|
54
|
+
}),
|
|
55
|
+
createSurface({
|
|
56
|
+
id: `${THREAD_PLUGIN}/settings`,
|
|
57
|
+
role: 'article',
|
|
58
|
+
filter: (data): data is { subject: SettingsStore<ThreadSettingsProps> } =>
|
|
59
|
+
data.subject instanceof SettingsStore && data.subject.prefix === THREAD_PLUGIN,
|
|
60
|
+
component: ({ data: { subject } }) => <ThreadSettings settings={subject.value} />,
|
|
61
|
+
}),
|
|
62
|
+
]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { create } from '@dxos/live-object';
|
|
7
|
+
|
|
8
|
+
import { THREAD_PLUGIN } from '../meta';
|
|
9
|
+
import { type ThreadSettingsProps, ThreadSettingsSchema } from '../types';
|
|
10
|
+
|
|
11
|
+
export default () => {
|
|
12
|
+
const settings = create<ThreadSettingsProps>({});
|
|
13
|
+
return contributes(Capabilities.Settings, { schema: ThreadSettingsSchema, prefix: THREAD_PLUGIN, value: settings });
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { contributes } from '@dxos/app-framework';
|
|
6
|
+
import { create } from '@dxos/live-object';
|
|
7
|
+
|
|
8
|
+
import { ThreadCapabilities } from './capabilities';
|
|
9
|
+
import { type ThreadState, type ViewStore } from '../types';
|
|
10
|
+
|
|
11
|
+
const initialViewState = { showResolvedThreads: false };
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
const state = create<ThreadState>({ drafts: {} });
|
|
15
|
+
const viewStore = create<ViewStore>({});
|
|
16
|
+
|
|
17
|
+
const getViewState = (subjectId: string) => {
|
|
18
|
+
if (!viewStore[subjectId]) {
|
|
19
|
+
viewStore[subjectId] = { ...initialViewState };
|
|
20
|
+
}
|
|
21
|
+
return viewStore[subjectId];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return contributes(ThreadCapabilities.State, { state, getViewState });
|
|
25
|
+
};
|
|
@@ -7,13 +7,14 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta } from '@storybook/react';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { MessageType, ThreadType } from '@dxos/plugin-space/types';
|
|
12
13
|
import { faker } from '@dxos/random';
|
|
13
14
|
import { useClient } from '@dxos/react-client';
|
|
14
15
|
import { type Space } from '@dxos/react-client/echo';
|
|
15
16
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
16
|
-
import {
|
|
17
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
17
18
|
import { Mosaic } from '@dxos/react-ui-mosaic';
|
|
18
19
|
import { Thread } from '@dxos/react-ui-thread';
|
|
19
20
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -46,22 +47,10 @@ const Story = () => {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return <span>{JSON.stringify({ role })}</span>;
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
}}
|
|
57
|
-
>
|
|
58
|
-
<Mosaic.Root debug>
|
|
59
|
-
<main className='max-is-prose mli-auto bs-dvh overflow-hidden'>
|
|
60
|
-
{space && <ChatContainer thread={thread} />}
|
|
61
|
-
</main>
|
|
62
|
-
<Mosaic.DragOverlay />
|
|
63
|
-
</Mosaic.Root>
|
|
64
|
-
</SurfaceProvider>
|
|
50
|
+
<Mosaic.Root debug>
|
|
51
|
+
<main className='max-is-prose mli-auto bs-dvh overflow-hidden'>{space && <ChatContainer thread={thread} />}</main>
|
|
52
|
+
<Mosaic.DragOverlay />
|
|
53
|
+
</Mosaic.Root>
|
|
65
54
|
);
|
|
66
55
|
};
|
|
67
56
|
|
|
@@ -70,9 +59,24 @@ export const Default = {};
|
|
|
70
59
|
const meta: Meta = {
|
|
71
60
|
title: 'plugins/plugin-thread/Chat',
|
|
72
61
|
component: Thread,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
render: () => <Story />,
|
|
63
|
+
decorators: [
|
|
64
|
+
withPluginManager({
|
|
65
|
+
capabilities: [
|
|
66
|
+
contributes(
|
|
67
|
+
Capabilities.ReactSurface,
|
|
68
|
+
createSurface({
|
|
69
|
+
id: 'test',
|
|
70
|
+
role: 'card',
|
|
71
|
+
component: ({ role }) => <span>{JSON.stringify({ role })}</span>,
|
|
72
|
+
}),
|
|
73
|
+
),
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
withTheme,
|
|
77
|
+
withLayout({ fullscreen: true, tooltips: true }),
|
|
78
|
+
withClientProvider({ createSpace: true, types: [ThreadType, MessageType] }),
|
|
79
|
+
],
|
|
76
80
|
parameters: { translations },
|
|
77
81
|
};
|
|
78
82
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Ref } from '@dxos/echo-schema';
|
|
8
|
+
import { create, makeRef, RefArray } from '@dxos/live-object';
|
|
8
9
|
import { MessageType } from '@dxos/plugin-space/types';
|
|
9
10
|
import { fullyQualifiedId, getSpace, useMembers } from '@dxos/react-client/echo';
|
|
10
11
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
@@ -13,7 +14,6 @@ import { createBasicExtensions, createThemeExtensions, listener } from '@dxos/re
|
|
|
13
14
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
14
15
|
import { mx } from '@dxos/react-ui-theme';
|
|
15
16
|
import { MessageTextbox, type MessageTextboxProps, Thread, ThreadFooter, threadLayout } from '@dxos/react-ui-thread';
|
|
16
|
-
import { nonNullable } from '@dxos/util';
|
|
17
17
|
|
|
18
18
|
import { MessageContainer } from './MessageContainer';
|
|
19
19
|
import { command } from './command-extension';
|
|
@@ -77,12 +77,14 @@ export const ChatContainer = ({ thread, context, current, autoFocusTextbox }: Th
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
thread.messages.push(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
makeRef(
|
|
81
|
+
create(MessageType, {
|
|
82
|
+
sender: { identityKey: identity.identityKey.toHex() },
|
|
83
|
+
timestamp: new Date().toISOString(),
|
|
84
|
+
text: messageRef.current,
|
|
85
|
+
context: context ? makeRef(context) : undefined,
|
|
86
|
+
}),
|
|
87
|
+
),
|
|
86
88
|
);
|
|
87
89
|
|
|
88
90
|
messageRef.current = '';
|
|
@@ -93,7 +95,7 @@ export const ChatContainer = ({ thread, context, current, autoFocusTextbox }: Th
|
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
const handleDelete = (id: string) => {
|
|
96
|
-
const messageIndex = thread.messages.
|
|
98
|
+
const messageIndex = thread.messages.findIndex(Ref.hasObjectId(id));
|
|
97
99
|
if (messageIndex !== -1) {
|
|
98
100
|
thread.messages.splice(messageIndex, 1);
|
|
99
101
|
}
|
|
@@ -108,7 +110,7 @@ export const ChatContainer = ({ thread, context, current, autoFocusTextbox }: Th
|
|
|
108
110
|
<ScrollArea.Root classNames='col-span-2'>
|
|
109
111
|
<ScrollArea.Viewport classNames='overflow-anchored after:overflow-anchor after:block after:bs-px after:-mbs-px [&>div]:min-bs-full [&>div]:!grid [&>div]:grid-rows-[1fr_0]'>
|
|
110
112
|
<div role='none' className={mx(threadLayout, 'place-self-end')}>
|
|
111
|
-
{thread.messages
|
|
113
|
+
{RefArray.allResolvedTargets(thread.messages ?? []).map((message) => (
|
|
112
114
|
<MessageContainer key={message.id} message={message} members={members} onDelete={handleDelete} />
|
|
113
115
|
))}
|
|
114
116
|
</div>
|