@dxos/plugin-thread 0.8.4-main.406dc2a → 0.8.4-main.548089c
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/ChannelContainer-56QROCE4.mjs +16 -0
- package/dist/lib/browser/ChatContainer-7F5Y6GXJ.mjs +15 -0
- package/dist/lib/browser/{app-graph-builder-ODKIAXR7.mjs → app-graph-builder-USFBLGFG.mjs} +19 -20
- package/dist/lib/browser/app-graph-builder-USFBLGFG.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-6BKYTMJS.mjs +104 -0
- package/dist/lib/browser/blueprint-definition-6BKYTMJS.mjs.map +7 -0
- package/dist/lib/browser/{call-manager-BCKLI4QD.mjs → call-manager-MAXQLMMS.mjs} +5 -5
- package/dist/lib/browser/{chunk-CMCVHULC.mjs → chunk-44S2SB4N.mjs} +34 -31
- package/dist/lib/browser/chunk-44S2SB4N.mjs.map +7 -0
- package/dist/lib/browser/{chunk-L326LSNS.mjs → chunk-BBTXGRIR.mjs} +2 -2
- package/dist/lib/browser/{chunk-L326LSNS.mjs.map → chunk-BBTXGRIR.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-B7YQ7QR2.mjs → chunk-FR6MEAZI.mjs} +17 -16
- package/dist/lib/browser/chunk-FR6MEAZI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XYUJXHYV.mjs → chunk-ISCHODBV.mjs} +1 -1
- package/dist/lib/browser/{chunk-XYUJXHYV.mjs.map → chunk-ISCHODBV.mjs.map} +2 -2
- package/dist/lib/browser/chunk-K2DUJRFJ.mjs +27 -0
- package/dist/lib/browser/chunk-K2DUJRFJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HDEQRBOC.mjs → chunk-KOBXMDCI.mjs} +68 -67
- package/dist/lib/browser/chunk-KOBXMDCI.mjs.map +7 -0
- package/dist/lib/browser/chunk-NMJEVD36.mjs +168 -0
- package/dist/lib/browser/chunk-NMJEVD36.mjs.map +7 -0
- package/dist/lib/browser/chunk-NSREO7OX.mjs +23 -0
- package/dist/lib/browser/chunk-NSREO7OX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ZCEU5K23.mjs → chunk-ZCW3NSDZ.mjs} +139 -236
- package/dist/lib/browser/chunk-ZCW3NSDZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VJMKS4CZ.mjs → chunk-ZO5ZGDN5.mjs} +45 -47
- package/dist/lib/browser/chunk-ZO5ZGDN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +37 -36
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-VOQD3TQ2.mjs → intent-resolver-BOUT4WGY.mjs} +25 -91
- package/dist/lib/browser/intent-resolver-BOUT4WGY.mjs.map +7 -0
- package/dist/lib/browser/{markdown-R6MGRIA6.mjs → markdown-74EUSQGV.mjs} +22 -20
- package/dist/lib/browser/markdown-74EUSQGV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-UMSBTN6H.mjs → react-root-2VRIT2HF.mjs} +10 -10
- package/dist/lib/browser/{react-surface-SXMQEWKE.mjs → react-surface-UOECBYHE.mjs} +17 -16
- package/dist/lib/browser/react-surface-UOECBYHE.mjs.map +7 -0
- package/dist/lib/browser/{settings-TCNF54PN.mjs → settings-LGQUZITB.mjs} +3 -3
- package/dist/lib/browser/{state-ZQ4IPOJT.mjs → state-36REWXO5.mjs} +3 -3
- package/dist/lib/browser/types/index.mjs +7 -9
- package/dist/lib/node-esm/ChannelContainer-4SV22AKC.mjs +17 -0
- package/dist/lib/node-esm/{ChatContainer-SH6LTFQL.mjs → ChatContainer-C526R4DI.mjs} +5 -5
- package/dist/lib/node-esm/{app-graph-builder-DMPT3MY6.mjs → app-graph-builder-DWYGNENL.mjs} +19 -20
- package/dist/lib/node-esm/app-graph-builder-DWYGNENL.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-6LEAWSC7.mjs +105 -0
- package/dist/lib/node-esm/blueprint-definition-6LEAWSC7.mjs.map +7 -0
- package/dist/lib/node-esm/{call-manager-Q7RY2YP4.mjs → call-manager-LC4OS2KD.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-TIPIOH2J.mjs → chunk-7KZWZS2U.mjs} +139 -236
- package/dist/lib/node-esm/chunk-7KZWZS2U.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NHSIAEDW.mjs → chunk-KE6SKBPO.mjs} +45 -47
- package/dist/lib/node-esm/chunk-KE6SKBPO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2KZ4ODHU.mjs → chunk-NEGIPZTJ.mjs} +34 -31
- package/dist/lib/node-esm/chunk-NEGIPZTJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2MMJF7DW.mjs → chunk-PZH2EDU5.mjs} +68 -67
- package/dist/lib/node-esm/chunk-PZH2EDU5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TJKM5JZT.mjs +169 -0
- package/dist/lib/node-esm/chunk-TJKM5JZT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BTGKI5IK.mjs → chunk-TWKGDFCS.mjs} +17 -16
- package/dist/lib/node-esm/chunk-TWKGDFCS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2V3WSLUZ.mjs → chunk-VBI32FGI.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-2V3WSLUZ.mjs.map → chunk-VBI32FGI.mjs.map} +2 -2
- package/dist/lib/node-esm/chunk-VM6WD3YY.mjs +25 -0
- package/dist/lib/node-esm/chunk-VM6WD3YY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XI45H4IV.mjs +28 -0
- package/dist/lib/node-esm/chunk-XI45H4IV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LCHTNRK7.mjs → chunk-ZQAGII7M.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-LCHTNRK7.mjs.map → chunk-ZQAGII7M.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +37 -36
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-AKVH66PH.mjs → intent-resolver-45PLIFCJ.mjs} +25 -91
- package/dist/lib/node-esm/intent-resolver-45PLIFCJ.mjs.map +7 -0
- package/dist/lib/node-esm/{markdown-MYGTDXT6.mjs → markdown-566XXB55.mjs} +22 -20
- package/dist/lib/node-esm/markdown-566XXB55.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-W6AVTL5M.mjs → react-root-JAE2VI2D.mjs} +10 -10
- package/dist/lib/node-esm/{react-surface-NLSZJGMO.mjs → react-surface-BYKXK5YA.mjs} +17 -16
- package/dist/lib/node-esm/react-surface-BYKXK5YA.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-ZQHGVFBY.mjs → settings-WKLJSP6R.mjs} +3 -3
- package/dist/lib/node-esm/{state-FSLLJ5TZ.mjs → state-X3W67GTL.mjs} +3 -3
- package/dist/lib/node-esm/types/index.mjs +7 -9
- package/dist/types/src/ThreadPlugin.d.ts.map +1 -1
- package/dist/types/src/calls/media-manager.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +2 -2
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Call/Toolbar.d.ts +2 -2
- package/dist/types/src/components/Call/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/ChannelContainer.d.ts +2 -2
- package/dist/types/src/components/ChannelContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChannelContainer.stories.d.ts +71 -5
- package/dist/types/src/components/ChannelContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat.stories.d.ts +71 -4
- package/dist/types/src/components/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +6 -5
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentsContainer.d.ts +2 -2
- package/dist/types/src/components/CommentsContainer.d.ts.map +1 -1
- package/dist/types/src/components/CommentsThreadContainer.d.ts +8 -8
- package/dist/types/src/components/CommentsThreadContainer.d.ts.map +1 -1
- package/dist/types/src/components/MessageContainer.d.ts +2 -2
- package/dist/types/src/components/MessageContainer.d.ts.map +1 -1
- package/dist/types/src/components/ResponsiveGrid/ResponsiveGridItem.d.ts.map +1 -1
- package/dist/types/src/components/ThreadComplementary.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +3 -3
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/extensions/threads.d.ts.map +1 -1
- package/dist/types/src/functions/create-proposals.d.ts +6 -0
- package/dist/types/src/functions/create-proposals.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +2 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/hooks/analytics.d.ts +2 -2
- package/dist/types/src/hooks/analytics.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/stories.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +71 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Channel.d.ts +16 -0
- package/dist/types/src/types/Channel.d.ts.map +1 -0
- package/dist/types/src/types/{schema.d.ts → Thread.d.ts} +13 -25
- package/dist/types/src/types/Thread.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +22 -110
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -46
- package/src/ThreadPlugin.tsx +26 -18
- package/src/calls/media-manager.ts +9 -6
- package/src/calls/util/stub-media-streams.ts +2 -2
- package/src/capabilities/app-graph-builder.ts +27 -17
- package/src/capabilities/blueprint-definition.ts +38 -0
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +17 -54
- package/src/capabilities/markdown.ts +5 -3
- package/src/capabilities/react-surface.tsx +8 -7
- package/src/components/Call/Call.tsx +1 -1
- package/src/components/Call/Toolbar.tsx +5 -5
- package/src/components/CallDebugPanel.tsx +2 -2
- package/src/components/CallSidebar.tsx +1 -1
- package/src/components/ChannelContainer.stories.tsx +6 -6
- package/src/components/ChannelContainer.tsx +18 -14
- package/src/components/Chat.stories.tsx +7 -13
- package/src/components/ChatContainer.tsx +30 -21
- package/src/components/Comments.stories.tsx +6 -6
- package/src/components/CommentsContainer.tsx +6 -7
- package/src/components/CommentsThreadContainer.tsx +32 -27
- package/src/components/Lobby/Lobby.tsx +1 -1
- package/src/components/Media/VideoObject.tsx +1 -1
- package/src/components/MessageContainer.tsx +6 -6
- package/src/components/Participant/Participant.tsx +1 -1
- package/src/components/ResponsiveGrid/ResponsiveContainer.tsx +2 -2
- package/src/components/ResponsiveGrid/ResponsiveGrid.stories.tsx +1 -1
- package/src/components/ResponsiveGrid/ResponsiveGrid.tsx +4 -4
- package/src/components/ResponsiveGrid/ResponsiveGridItem.tsx +5 -2
- package/src/components/ThreadComplementary.tsx +38 -31
- package/src/components/testing.ts +8 -8
- package/src/extensions/threads.ts +25 -16
- package/src/functions/create-proposals.ts +58 -0
- package/src/functions/index.ts +5 -0
- package/src/hooks/analytics.ts +4 -7
- package/src/hooks/index.ts +3 -2
- package/src/meta.ts +6 -1
- package/src/testing/stories.ts +2 -5
- package/src/translations.ts +3 -2
- package/src/types/Channel.ts +27 -0
- package/src/types/Thread.ts +26 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +17 -25
- package/dist/lib/browser/ChannelContainer-BGDGZHV4.mjs +0 -16
- package/dist/lib/browser/ChatContainer-75KJZ4XR.mjs +0 -15
- package/dist/lib/browser/app-graph-builder-ODKIAXR7.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MUYQOQE.mjs +0 -23
- package/dist/lib/browser/chunk-2MUYQOQE.mjs.map +0 -7
- package/dist/lib/browser/chunk-B7YQ7QR2.mjs.map +0 -7
- package/dist/lib/browser/chunk-CMCVHULC.mjs.map +0 -7
- package/dist/lib/browser/chunk-HDEQRBOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-T4KJ5JR4.mjs +0 -15
- package/dist/lib/browser/chunk-T4KJ5JR4.mjs.map +0 -7
- package/dist/lib/browser/chunk-VJMKS4CZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-VTYX3SIM.mjs +0 -147
- package/dist/lib/browser/chunk-VTYX3SIM.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZCEU5K23.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-VOQD3TQ2.mjs.map +0 -7
- package/dist/lib/browser/markdown-R6MGRIA6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SXMQEWKE.mjs.map +0 -7
- package/dist/lib/browser/toolkit-JF4B4QIO.mjs +0 -84
- package/dist/lib/browser/toolkit-JF4B4QIO.mjs.map +0 -7
- package/dist/lib/node-esm/ChannelContainer-OXC6BTU7.mjs +0 -17
- package/dist/lib/node-esm/app-graph-builder-DMPT3MY6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2KZ4ODHU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2MMJF7DW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BAMZXJS4.mjs +0 -148
- package/dist/lib/node-esm/chunk-BAMZXJS4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BTGKI5IK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GZ4WL2IS.mjs +0 -25
- package/dist/lib/node-esm/chunk-GZ4WL2IS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NHSIAEDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OBVAURUU.mjs +0 -17
- package/dist/lib/node-esm/chunk-OBVAURUU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TIPIOH2J.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-AKVH66PH.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-MYGTDXT6.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-NLSZJGMO.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-DHPKJITO.mjs +0 -85
- package/dist/lib/node-esm/toolkit-DHPKJITO.mjs.map +0 -7
- package/dist/types/src/capabilities/toolkit.d.ts +0 -6
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/toolkit.ts +0 -82
- package/src/types/schema.ts +0 -33
- /package/dist/lib/browser/{ChannelContainer-BGDGZHV4.mjs.map → ChannelContainer-56QROCE4.mjs.map} +0 -0
- /package/dist/lib/browser/{ChatContainer-75KJZ4XR.mjs.map → ChatContainer-7F5Y6GXJ.mjs.map} +0 -0
- /package/dist/lib/browser/{call-manager-BCKLI4QD.mjs.map → call-manager-MAXQLMMS.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-UMSBTN6H.mjs.map → react-root-2VRIT2HF.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-TCNF54PN.mjs.map → settings-LGQUZITB.mjs.map} +0 -0
- /package/dist/lib/browser/{state-ZQ4IPOJT.mjs.map → state-36REWXO5.mjs.map} +0 -0
- /package/dist/lib/node-esm/{ChannelContainer-OXC6BTU7.mjs.map → ChannelContainer-4SV22AKC.mjs.map} +0 -0
- /package/dist/lib/node-esm/{ChatContainer-SH6LTFQL.mjs.map → ChatContainer-C526R4DI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{call-manager-Q7RY2YP4.mjs.map → call-manager-LC4OS2KD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-W6AVTL5M.mjs.map → react-root-JAE2VI2D.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-ZQHGVFBY.mjs.map → settings-WKLJSP6R.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-FSLLJ5TZ.mjs.map → state-X3W67GTL.mjs.map} +0 -0
|
@@ -11,11 +11,11 @@ import { invariant } from '@dxos/invariant';
|
|
|
11
11
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
|
|
12
12
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
13
13
|
import { CollectionAction, SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
-
import { Ref,
|
|
15
|
-
import { AnchoredTo,
|
|
14
|
+
import { Ref, getSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { AnchoredTo, Message } from '@dxos/types';
|
|
16
16
|
|
|
17
17
|
import { meta } from '../meta';
|
|
18
|
-
import {
|
|
18
|
+
import { Channel, Thread, ThreadAction } from '../types';
|
|
19
19
|
|
|
20
20
|
import { ThreadCapabilities } from './capabilities';
|
|
21
21
|
|
|
@@ -27,7 +27,7 @@ export default (context: PluginContext) =>
|
|
|
27
27
|
Effect.gen(function* () {
|
|
28
28
|
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
29
29
|
const { object: collection } = yield* dispatch(
|
|
30
|
-
createIntent(CollectionAction.CreateQueryCollection, { typename: Type.getTypename(
|
|
30
|
+
createIntent(CollectionAction.CreateQueryCollection, { typename: Type.getTypename(Channel.Channel) }),
|
|
31
31
|
);
|
|
32
32
|
rootCollection.objects.push(Ref.make(collection));
|
|
33
33
|
|
|
@@ -41,18 +41,14 @@ export default (context: PluginContext) =>
|
|
|
41
41
|
intent: ThreadAction.CreateChannel,
|
|
42
42
|
resolve: ({ name }) => ({
|
|
43
43
|
data: {
|
|
44
|
-
object:
|
|
45
|
-
name,
|
|
46
|
-
defaultThread: Ref.make(Obj.make(ThreadType, { messages: [], status: 'active' })),
|
|
47
|
-
threads: [],
|
|
48
|
-
}),
|
|
44
|
+
object: Channel.make({ name }),
|
|
49
45
|
},
|
|
50
46
|
}),
|
|
51
47
|
}),
|
|
52
48
|
createResolver({
|
|
53
49
|
intent: ThreadAction.CreateChannelThread,
|
|
54
50
|
resolve: ({ channel }) => {
|
|
55
|
-
const thread =
|
|
51
|
+
const thread = Thread.make({ status: 'active' });
|
|
56
52
|
channel.threads.push(Ref.make(thread));
|
|
57
53
|
return {
|
|
58
54
|
data: {
|
|
@@ -69,9 +65,9 @@ export default (context: PluginContext) =>
|
|
|
69
65
|
invariant(space, 'Space not found');
|
|
70
66
|
|
|
71
67
|
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
72
|
-
const subjectId =
|
|
73
|
-
const thread =
|
|
74
|
-
const anchor = Relation.make(AnchoredTo, {
|
|
68
|
+
const subjectId = Obj.getDXN(subject).toString();
|
|
69
|
+
const thread = Thread.make({ name });
|
|
70
|
+
const anchor = Relation.make(AnchoredTo.AnchoredTo, {
|
|
75
71
|
[Relation.Source]: thread,
|
|
76
72
|
[Relation.Target]: subject,
|
|
77
73
|
anchor: _anchor,
|
|
@@ -86,40 +82,7 @@ export default (context: PluginContext) =>
|
|
|
86
82
|
|
|
87
83
|
return {
|
|
88
84
|
intents: [
|
|
89
|
-
createIntent(ThreadAction.Select, { current:
|
|
90
|
-
createIntent(DeckAction.ChangeCompanion, {
|
|
91
|
-
primary: subjectId,
|
|
92
|
-
companion: `${subjectId}${ATTENDABLE_PATH_SEPARATOR}comments`,
|
|
93
|
-
}),
|
|
94
|
-
],
|
|
95
|
-
};
|
|
96
|
-
},
|
|
97
|
-
}),
|
|
98
|
-
createResolver({
|
|
99
|
-
intent: ThreadAction.AddProposal,
|
|
100
|
-
resolve: ({ text, anchor, sender, subject }) => {
|
|
101
|
-
const space = getSpace(subject);
|
|
102
|
-
invariant(space, 'Space not found');
|
|
103
|
-
|
|
104
|
-
const subjectId = fullyQualifiedId(subject);
|
|
105
|
-
const proposal = Obj.make(DataType.Message, {
|
|
106
|
-
created: new Date().toISOString(),
|
|
107
|
-
sender,
|
|
108
|
-
blocks: [{ _tag: 'proposal', text }],
|
|
109
|
-
});
|
|
110
|
-
const thread = Obj.make(ThreadType, { name: 'Proposal', messages: [Ref.make(proposal)], status: 'active' });
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
intents: [
|
|
114
|
-
createIntent(SpaceAction.AddObject, { object: thread, target: space, hidden: true }),
|
|
115
|
-
createIntent(SpaceAction.AddRelation, {
|
|
116
|
-
space,
|
|
117
|
-
schema: AnchoredTo,
|
|
118
|
-
source: thread,
|
|
119
|
-
target: subject,
|
|
120
|
-
fields: { anchor },
|
|
121
|
-
}),
|
|
122
|
-
createIntent(ThreadAction.Select, { current: fullyQualifiedId(thread) }),
|
|
85
|
+
createIntent(ThreadAction.Select, { current: Obj.getDXN(thread).toString() }),
|
|
123
86
|
createIntent(DeckAction.ChangeCompanion, {
|
|
124
87
|
primary: subjectId,
|
|
125
88
|
companion: `${subjectId}${ATTENDABLE_PATH_SEPARATOR}comments`,
|
|
@@ -164,9 +127,9 @@ export default (context: PluginContext) =>
|
|
|
164
127
|
createResolver({
|
|
165
128
|
intent: ThreadAction.Delete,
|
|
166
129
|
resolve: async ({ subject, anchor, thread: _thread }, undo) => {
|
|
167
|
-
const thread = _thread ?? (Relation.getSource(anchor) as
|
|
130
|
+
const thread = _thread ?? (Relation.getSource(anchor) as Thread.Thread);
|
|
168
131
|
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
169
|
-
const subjectId =
|
|
132
|
+
const subjectId = Obj.getDXN(subject).toString();
|
|
170
133
|
const draft = state.drafts[subjectId];
|
|
171
134
|
if (draft) {
|
|
172
135
|
// Check if we're deleting a draft; if so, remo ve it.
|
|
@@ -226,13 +189,13 @@ export default (context: PluginContext) =>
|
|
|
226
189
|
createResolver({
|
|
227
190
|
intent: ThreadAction.AddMessage,
|
|
228
191
|
resolve: ({ anchor, subject, sender, text }) => {
|
|
229
|
-
const thread = Relation.getSource(anchor) as
|
|
192
|
+
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
230
193
|
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
231
|
-
const subjectId =
|
|
194
|
+
const subjectId = Obj.getDXN(subject).toString();
|
|
232
195
|
const space = getSpace(subject);
|
|
233
196
|
invariant(space, 'Space not found');
|
|
234
197
|
|
|
235
|
-
const message = Obj.make(
|
|
198
|
+
const message = Obj.make(Message.Message, {
|
|
236
199
|
created: new Date().toISOString(),
|
|
237
200
|
sender,
|
|
238
201
|
blocks: [{ _tag: 'text', text }],
|
|
@@ -252,7 +215,7 @@ export default (context: PluginContext) =>
|
|
|
252
215
|
intents.push(
|
|
253
216
|
createIntent(SpaceAction.AddRelation, {
|
|
254
217
|
space,
|
|
255
|
-
schema: AnchoredTo,
|
|
218
|
+
schema: AnchoredTo.AnchoredTo,
|
|
256
219
|
source: thread,
|
|
257
220
|
target: subject,
|
|
258
221
|
fields: { anchor: draft.anchor },
|
|
@@ -288,7 +251,7 @@ export default (context: PluginContext) =>
|
|
|
288
251
|
createResolver({
|
|
289
252
|
intent: ThreadAction.DeleteMessage,
|
|
290
253
|
resolve: ({ subject, anchor, messageId, message, messageIndex }, undo) => {
|
|
291
|
-
const thread = Relation.getSource(anchor) as
|
|
254
|
+
const thread = Relation.getSource(anchor) as Thread.Thread;
|
|
292
255
|
const space = getSpace(subject);
|
|
293
256
|
invariant(space, 'Space not found');
|
|
294
257
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { EditorView } from '@codemirror/view';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
|
|
9
10
|
import { MarkdownCapabilities } from '@dxos/plugin-markdown';
|
|
10
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
11
11
|
import { type EditorState, commentClickedEffect, commentsState, overlap } from '@dxos/react-ui-editor';
|
|
12
12
|
|
|
13
13
|
import { threads } from '../extensions';
|
|
@@ -22,17 +22,19 @@ export default (context: PluginContext) =>
|
|
|
22
22
|
return threads(state, doc, dispatch);
|
|
23
23
|
},
|
|
24
24
|
({ document: doc }) => {
|
|
25
|
+
if (!doc) return [];
|
|
25
26
|
const { state } = context.getCapability(ThreadCapabilities.MutableState);
|
|
26
27
|
|
|
27
28
|
return EditorView.updateListener.of((update) => {
|
|
28
29
|
if (update.docChanged || update.selectionSet) {
|
|
29
|
-
state.toolbar[
|
|
30
|
+
state.toolbar[Obj.getDXN(doc).toString()] = selectionOverlapsComment(update.state);
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
},
|
|
33
34
|
({ document: doc }) => {
|
|
35
|
+
if (!doc) return [];
|
|
34
36
|
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
35
|
-
const id =
|
|
37
|
+
const id = Obj.getDXN(doc).toString();
|
|
36
38
|
|
|
37
39
|
return EditorView.updateListener.of((update) => {
|
|
38
40
|
update.transactions.forEach((transaction) => {
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities, contributes, createSurface
|
|
7
|
+
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
8
9
|
import { Obj, type Ref } from '@dxos/echo';
|
|
9
10
|
import { SettingsStore } from '@dxos/local-storage';
|
|
10
11
|
import { getSpace } from '@dxos/react-client/echo';
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
ThreadSettings,
|
|
19
20
|
} from '../components';
|
|
20
21
|
import { meta } from '../meta';
|
|
21
|
-
import {
|
|
22
|
+
import { Channel, Thread, type ThreadSettingsProps } from '../types';
|
|
22
23
|
|
|
23
24
|
import { ThreadCapabilities } from './capabilities';
|
|
24
25
|
|
|
@@ -27,14 +28,14 @@ export default () =>
|
|
|
27
28
|
createSurface({
|
|
28
29
|
id: `${meta.id}/channel`,
|
|
29
30
|
role: 'article',
|
|
30
|
-
filter: (data): data is { subject:
|
|
31
|
+
filter: (data): data is { subject: Channel.Channel } => Obj.instanceOf(Channel.Channel, data.subject),
|
|
31
32
|
component: ({ data: { subject: channel }, role }) => <ChannelContainer channel={channel} role={role} />,
|
|
32
33
|
}),
|
|
33
34
|
createSurface({
|
|
34
35
|
id: `${meta.id}/chat-companion`,
|
|
35
36
|
role: 'article',
|
|
36
|
-
filter: (data): data is { companionTo:
|
|
37
|
-
Obj.instanceOf(
|
|
37
|
+
filter: (data): data is { companionTo: Channel.Channel; subject: 'chat' } =>
|
|
38
|
+
Obj.instanceOf(Channel.Channel, data.companionTo) && data.subject === 'chat',
|
|
38
39
|
component: ({ data: { companionTo: channel } }) => {
|
|
39
40
|
const space = getSpace(channel);
|
|
40
41
|
const thread = channel.defaultThread.target;
|
|
@@ -48,7 +49,7 @@ export default () =>
|
|
|
48
49
|
createSurface({
|
|
49
50
|
id: `${meta.id}/thread`,
|
|
50
51
|
role: 'article',
|
|
51
|
-
filter: (data): data is { subject:
|
|
52
|
+
filter: (data): data is { subject: Thread.Thread } => Obj.instanceOf(Thread.Thread, data.subject),
|
|
52
53
|
component: ({ data: { subject: thread } }) => {
|
|
53
54
|
const space = getSpace(thread);
|
|
54
55
|
if (!space || !thread) {
|
|
@@ -61,7 +62,7 @@ export default () =>
|
|
|
61
62
|
createSurface({
|
|
62
63
|
id: `${meta.id}/comments`,
|
|
63
64
|
role: 'article',
|
|
64
|
-
filter: (data): data is { companionTo: { threads: Ref.Ref<
|
|
65
|
+
filter: (data): data is { companionTo: { threads: Ref.Ref<Thread.Thread>[] } } =>
|
|
65
66
|
data.subject === 'comments' && Obj.isObject(data.companionTo),
|
|
66
67
|
// TODO(wittjosiah): This isn't scrolling properly in a plank.
|
|
67
68
|
component: ({ data }) => <ThreadComplementary subject={data.companionTo} />,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type FC, type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useCapability } from '@dxos/app-framework';
|
|
7
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
8
8
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { ThreadCapabilities } from '../../capabilities';
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { useAppGraph, useCapability } from '@dxos/app-framework';
|
|
7
|
+
import { useAppGraph, useCapability } from '@dxos/app-framework/react';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { useActions, useNode } from '@dxos/plugin-graph';
|
|
9
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
10
|
import {
|
|
11
11
|
Icon,
|
|
12
12
|
IconButton,
|
|
@@ -20,10 +20,10 @@ import { groupHoverControlItemWithTransition, mx } from '@dxos/react-ui-theme';
|
|
|
20
20
|
|
|
21
21
|
import { ThreadCapabilities } from '../../capabilities';
|
|
22
22
|
import { meta } from '../../meta';
|
|
23
|
-
import { type
|
|
23
|
+
import { type Channel } from '../../types';
|
|
24
24
|
|
|
25
25
|
export type ToolbarProps = ThemedClassName<{
|
|
26
|
-
channel?:
|
|
26
|
+
channel?: Channel.Channel;
|
|
27
27
|
participants?: number;
|
|
28
28
|
autoHideControls?: boolean;
|
|
29
29
|
isInRoom?: boolean;
|
|
@@ -45,7 +45,7 @@ export const Toolbar = ({
|
|
|
45
45
|
const call = useCapability(ThreadCapabilities.CallManager);
|
|
46
46
|
|
|
47
47
|
// Channel app graph node.
|
|
48
|
-
const node = useNode(graph, channel &&
|
|
48
|
+
const node = useNode(graph, channel && Obj.getDXN(channel).toString());
|
|
49
49
|
const actions = useActions(graph, node?.id).filter((action) => action.properties.disposition === 'toolbar');
|
|
50
50
|
|
|
51
51
|
// Screen sharing.
|
|
@@ -76,7 +76,7 @@ export const CallDebugPanel = ({ state }: CallDebugPanelProps) => {
|
|
|
76
76
|
maxHeight={false}
|
|
77
77
|
info={<div className='flex items-center gap-2'> {state?.call.joined ? 'Active' : 'Inactive'}</div>}
|
|
78
78
|
>
|
|
79
|
-
<div className='flex flex-col
|
|
79
|
+
<div className='flex flex-col is-full gap-2 text-xs'>
|
|
80
80
|
<div className='flex items-center gap-2'>
|
|
81
81
|
<Input.Root>
|
|
82
82
|
<Input.Label classNames={'text-sm'}>{t('show webrtc stats title')}</Input.Label>
|
|
@@ -160,7 +160,7 @@ export type TableProps = {
|
|
|
160
160
|
|
|
161
161
|
export const Table = ({ rows }: TableProps) => {
|
|
162
162
|
return (
|
|
163
|
-
<div className='
|
|
163
|
+
<div className='is-full text-xs font-mono'>
|
|
164
164
|
{rows.map(([prefix, label, value, unit], i) => (
|
|
165
165
|
<div key={i} className='grid grid-cols-[3fr_1fr_1fr_1fr]'>
|
|
166
166
|
<div className='p-1'>{prefix}</div>
|
|
@@ -9,20 +9,20 @@ import { contributes } from '@dxos/app-framework';
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
11
11
|
import { Query, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
12
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
-
import { DataType } from '@dxos/schema';
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
13
|
import { render } from '@dxos/storybook-utils';
|
|
14
|
+
import { Message } from '@dxos/types';
|
|
15
15
|
|
|
16
16
|
import { createThreadPlugins } from '../testing';
|
|
17
17
|
import { translations } from '../translations';
|
|
18
|
-
import {
|
|
18
|
+
import { Channel, Thread } from '../types';
|
|
19
19
|
|
|
20
20
|
import { ChannelContainer, type ChannelContainerProps } from './ChannelContainer';
|
|
21
21
|
|
|
22
22
|
// TODO(wittjosiah): Channel doesn't render full height.
|
|
23
23
|
const DefaultStory = ({ roomId }: ChannelContainerProps) => {
|
|
24
24
|
const space = useSpace();
|
|
25
|
-
const [channel] = useQuery(space, Query.type(
|
|
25
|
+
const [channel] = useQuery(space, Query.type(Channel.Channel));
|
|
26
26
|
if (!channel) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
@@ -36,13 +36,13 @@ const meta = {
|
|
|
36
36
|
render: render(DefaultStory),
|
|
37
37
|
decorators: [
|
|
38
38
|
withTheme,
|
|
39
|
+
withLayout({ container: 'column' }),
|
|
39
40
|
withPluginManager({
|
|
40
41
|
plugins: [...(await createThreadPlugins())],
|
|
41
|
-
capabilities: [contributes(ClientCapabilities.Schema, [
|
|
42
|
+
capabilities: [contributes(ClientCapabilities.Schema, [Channel.Channel, Thread.Thread, Message.Message])],
|
|
42
43
|
}),
|
|
43
44
|
],
|
|
44
45
|
parameters: {
|
|
45
|
-
layout: 'column',
|
|
46
46
|
translations,
|
|
47
47
|
},
|
|
48
48
|
} satisfies Meta<typeof ChannelContainer>;
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import React, { type ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { useCapabilities, useCapability } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities, useCapability } from '@dxos/app-framework/react';
|
|
9
9
|
import { Context } from '@dxos/context';
|
|
10
10
|
import { failUndefined } from '@dxos/debug';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
11
12
|
import { log } from '@dxos/log';
|
|
12
13
|
import { useClient } from '@dxos/react-client';
|
|
13
|
-
import {
|
|
14
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
14
15
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
15
|
-
import { ElevationProvider, Input,
|
|
16
|
+
import { ElevationProvider, Input, useTranslation } from '@dxos/react-ui';
|
|
16
17
|
import { ControlGroup, ControlGroupButton, ControlItemInput } from '@dxos/react-ui-form';
|
|
17
18
|
import { MenuProvider, ToolbarMenu, createMenuAction, createMenuItemGroup, useMenuActions } from '@dxos/react-ui-menu';
|
|
18
19
|
import { useSoundEffect } from '@dxos/react-ui-sfx';
|
|
@@ -20,13 +21,15 @@ import { StackItem } from '@dxos/react-ui-stack';
|
|
|
20
21
|
|
|
21
22
|
import { ThreadCapabilities } from '../capabilities';
|
|
22
23
|
import { meta } from '../meta';
|
|
23
|
-
import { type
|
|
24
|
+
import { type Channel } from '../types';
|
|
24
25
|
|
|
25
26
|
import { Call } from './Call';
|
|
26
27
|
import ChatContainer from './ChatContainer';
|
|
27
28
|
|
|
29
|
+
// TODO(burdon): Create Radix style layout.
|
|
30
|
+
|
|
28
31
|
export type ChannelContainerProps = {
|
|
29
|
-
channel?:
|
|
32
|
+
channel?: Channel.Channel;
|
|
30
33
|
roomId?: string;
|
|
31
34
|
role?: string;
|
|
32
35
|
fullscreen?: boolean;
|
|
@@ -38,7 +41,8 @@ export type ChannelContainerProps = {
|
|
|
38
41
|
export const ChannelContainer = ({ channel, roomId: _roomId, role, fullscreen }: ChannelContainerProps) => {
|
|
39
42
|
const space = getSpace(channel);
|
|
40
43
|
const callManager = useCapability(ThreadCapabilities.CallManager);
|
|
41
|
-
const
|
|
44
|
+
const attendableId = channel ? Obj.getDXN(channel).toString() : undefined;
|
|
45
|
+
const roomId = _roomId ?? attendableId ?? failUndefined();
|
|
42
46
|
const identity = useIdentity();
|
|
43
47
|
const isNamed = !!identity?.profile?.displayName;
|
|
44
48
|
const joinSound = useSoundEffect('JoinCall');
|
|
@@ -124,8 +128,8 @@ export const ChannelContainer = ({ channel, roomId: _roomId, role, fullscreen }:
|
|
|
124
128
|
)}
|
|
125
129
|
{!isJoined && channel && channel.defaultThread.target && space && (
|
|
126
130
|
<>
|
|
127
|
-
<ChannelToolbar attendableId={
|
|
128
|
-
<ChatContainer space={space} thread={channel.defaultThread.target} />
|
|
131
|
+
<ChannelToolbar attendableId={attendableId} role={role} onJoinCall={handleJoin} />
|
|
132
|
+
<ChatContainer space={space} thread={channel.defaultThread.target} classNames='container-max-width' />
|
|
129
133
|
</>
|
|
130
134
|
)}
|
|
131
135
|
</StackItem.Content>
|
|
@@ -161,7 +165,7 @@ const DisplayNameMissing = () => {
|
|
|
161
165
|
const useChannelToolbarActions = (onJoinCall?: () => void) => {
|
|
162
166
|
const creator = useMemo(
|
|
163
167
|
() =>
|
|
164
|
-
|
|
168
|
+
Atom.make(() => {
|
|
165
169
|
return {
|
|
166
170
|
nodes: [
|
|
167
171
|
createMenuItemGroup('root', {
|
|
@@ -182,19 +186,19 @@ const useChannelToolbarActions = (onJoinCall?: () => void) => {
|
|
|
182
186
|
return useMenuActions(creator);
|
|
183
187
|
};
|
|
184
188
|
|
|
185
|
-
type ChannelToolbarProps =
|
|
189
|
+
type ChannelToolbarProps = {
|
|
186
190
|
attendableId?: string;
|
|
187
191
|
role?: string;
|
|
188
192
|
onJoinCall?: () => void;
|
|
189
|
-
}
|
|
193
|
+
};
|
|
190
194
|
|
|
191
|
-
const ChannelToolbar = ({ attendableId, role, onJoinCall
|
|
195
|
+
const ChannelToolbar = ({ attendableId, role, onJoinCall }: ChannelToolbarProps) => {
|
|
192
196
|
const menuProps = useChannelToolbarActions(onJoinCall);
|
|
193
197
|
|
|
194
198
|
return (
|
|
195
199
|
<ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>
|
|
196
200
|
<MenuProvider {...menuProps} attendableId={attendableId}>
|
|
197
|
-
<ToolbarMenu
|
|
201
|
+
<ToolbarMenu textBlockWidth />
|
|
198
202
|
</MenuProvider>
|
|
199
203
|
</ElevationProvider>
|
|
200
204
|
);
|
|
@@ -7,7 +7,6 @@ import React, { useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Capabilities, IntentPlugin, contributes, createSurface } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
11
10
|
import { faker } from '@dxos/random';
|
|
12
11
|
import { useClient } from '@dxos/react-client';
|
|
13
12
|
import { type Space } from '@dxos/react-client/echo';
|
|
@@ -15,12 +14,12 @@ import { useIdentity } from '@dxos/react-client/halo';
|
|
|
15
14
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
15
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
17
16
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
18
|
-
import { Thread } from '@dxos/react-ui-thread';
|
|
19
|
-
import { DataType } from '@dxos/schema';
|
|
17
|
+
import { Thread as ThreadComponent } from '@dxos/react-ui-thread';
|
|
20
18
|
import { render } from '@dxos/storybook-utils';
|
|
19
|
+
import { Message } from '@dxos/types';
|
|
21
20
|
|
|
22
21
|
import { translations } from '../translations';
|
|
23
|
-
import {
|
|
22
|
+
import { Channel, Thread } from '../types';
|
|
24
23
|
|
|
25
24
|
import { ChatContainer } from './ChatContainer';
|
|
26
25
|
|
|
@@ -30,17 +29,12 @@ const DefaultStory = () => {
|
|
|
30
29
|
const client = useClient();
|
|
31
30
|
const identity = useIdentity();
|
|
32
31
|
const [space, setSpace] = useState<Space>();
|
|
33
|
-
const [channel, setChannel] = useState<
|
|
32
|
+
const [channel, setChannel] = useState<Channel.Channel | null>();
|
|
34
33
|
|
|
35
34
|
useAsyncEffect(async () => {
|
|
36
35
|
if (identity) {
|
|
37
36
|
const space = await client.spaces.create();
|
|
38
|
-
const channel = space.db.add(
|
|
39
|
-
Obj.make(ChannelType, {
|
|
40
|
-
defaultThread: Ref.make(Obj.make(ThreadType, { messages: [], status: 'active' })),
|
|
41
|
-
threads: [],
|
|
42
|
-
}),
|
|
43
|
-
);
|
|
37
|
+
const channel = space.db.add(Channel.make());
|
|
44
38
|
setSpace(space);
|
|
45
39
|
setChannel(channel);
|
|
46
40
|
}
|
|
@@ -59,7 +53,7 @@ const DefaultStory = () => {
|
|
|
59
53
|
|
|
60
54
|
const meta = {
|
|
61
55
|
title: 'plugins/plugin-thread/Chat',
|
|
62
|
-
component:
|
|
56
|
+
component: ThreadComponent.Root as any,
|
|
63
57
|
render: render(DefaultStory),
|
|
64
58
|
decorators: [
|
|
65
59
|
withTheme,
|
|
@@ -76,7 +70,7 @@ const meta = {
|
|
|
76
70
|
),
|
|
77
71
|
],
|
|
78
72
|
}),
|
|
79
|
-
withClientProvider({ createSpace: true, types: [
|
|
73
|
+
withClientProvider({ createSpace: true, types: [Thread.Thread, Channel.Channel, Message.Message] }),
|
|
80
74
|
],
|
|
81
75
|
parameters: {
|
|
82
76
|
layout: 'fullscreen',
|
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj, Ref } from '@dxos/echo';
|
|
8
|
-
import { type Space,
|
|
8
|
+
import { type Space, useMembers } from '@dxos/react-client/echo';
|
|
9
9
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
10
|
-
import { Icon, ScrollArea, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { Icon, ScrollArea, type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { createBasicExtensions, createThemeExtensions, listener } from '@dxos/react-ui-editor';
|
|
12
12
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
13
13
|
import { mx } from '@dxos/react-ui-theme';
|
|
14
14
|
import {
|
|
15
15
|
MessageTextbox,
|
|
16
16
|
type MessageTextboxProps,
|
|
17
|
-
Thread,
|
|
17
|
+
Thread as ThreadComponent,
|
|
18
18
|
type ThreadRootProps,
|
|
19
19
|
threadLayout,
|
|
20
20
|
} from '@dxos/react-ui-thread';
|
|
21
|
-
import {
|
|
21
|
+
import { Message } from '@dxos/types';
|
|
22
22
|
import { isNonNullable } from '@dxos/util';
|
|
23
23
|
|
|
24
24
|
import { useStatus } from '../hooks';
|
|
25
25
|
import { meta } from '../meta';
|
|
26
|
-
import { type
|
|
26
|
+
import { type Thread } from '../types';
|
|
27
27
|
import { getMessageMetadata } from '../util';
|
|
28
28
|
|
|
29
29
|
import { command } from './command-extension';
|
|
@@ -41,16 +41,25 @@ export const ChatHeading = ({ attendableId }: { attendableId?: string }) => {
|
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export type ChatContainerProps =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
export type ChatContainerProps = ThemedClassName<
|
|
45
|
+
{
|
|
46
|
+
space: Space;
|
|
47
|
+
thread: Thread.Thread;
|
|
48
|
+
context?: Obj.Any;
|
|
49
|
+
autoFocusTextbox?: boolean;
|
|
50
|
+
} & Pick<ThreadRootProps, 'current'>
|
|
51
|
+
>;
|
|
52
|
+
|
|
53
|
+
export const ChatContainer = ({
|
|
54
|
+
classNames,
|
|
55
|
+
space,
|
|
56
|
+
thread,
|
|
57
|
+
context,
|
|
58
|
+
current,
|
|
59
|
+
autoFocusTextbox,
|
|
60
|
+
}: ChatContainerProps) => {
|
|
52
61
|
const { t } = useTranslation(meta.id);
|
|
53
|
-
const id =
|
|
62
|
+
const id = Obj.getDXN(thread).toString();
|
|
54
63
|
const identity = useIdentity()!;
|
|
55
64
|
const members = useMembers(space?.key);
|
|
56
65
|
const activity = useStatus(space, id);
|
|
@@ -67,7 +76,7 @@ export const ChatContainer = ({ space, thread, context, current, autoFocusTextbo
|
|
|
67
76
|
() => [
|
|
68
77
|
createBasicExtensions({ placeholder: t('message placeholder') }),
|
|
69
78
|
createThemeExtensions({ themeMode }),
|
|
70
|
-
listener({ onChange: (text) => (messageRef.current = text) }),
|
|
79
|
+
listener({ onChange: ({ text }) => (messageRef.current = text) }),
|
|
71
80
|
command,
|
|
72
81
|
],
|
|
73
82
|
[themeMode, _count],
|
|
@@ -92,7 +101,7 @@ export const ChatContainer = ({ space, thread, context, current, autoFocusTextbo
|
|
|
92
101
|
|
|
93
102
|
thread.messages.push(
|
|
94
103
|
Ref.make(
|
|
95
|
-
Obj.make(
|
|
104
|
+
Obj.make(Message.Message, {
|
|
96
105
|
created: new Date().toISOString(),
|
|
97
106
|
sender: { identityDid: identity.did },
|
|
98
107
|
blocks: [{ _tag: 'text', text: messageRef.current }],
|
|
@@ -109,12 +118,13 @@ export const ChatContainer = ({ space, thread, context, current, autoFocusTextbo
|
|
|
109
118
|
};
|
|
110
119
|
|
|
111
120
|
return (
|
|
112
|
-
<
|
|
121
|
+
<ThreadComponent.Root
|
|
113
122
|
current={current}
|
|
114
123
|
id={id}
|
|
115
124
|
classNames={[
|
|
116
|
-
'bs-full
|
|
125
|
+
'bs-full grid-rows-[1fr_min-content_min-content] overflow-hidden',
|
|
117
126
|
'transition-[padding-block-end] [[data-sidebar-inline-start-state=open]_&]:lg:pbe-0',
|
|
127
|
+
classNames,
|
|
118
128
|
]}
|
|
119
129
|
>
|
|
120
130
|
<ScrollArea.Root classNames='col-span-2'>
|
|
@@ -136,9 +146,8 @@ export const ChatContainer = ({ space, thread, context, current, autoFocusTextbo
|
|
|
136
146
|
</ScrollArea.Root>
|
|
137
147
|
|
|
138
148
|
<MessageTextbox extensions={extensions} autoFocus={autoFocus} onSend={handleCreate} {...textboxMetadata} />
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
</Thread.Root>
|
|
149
|
+
<ThreadComponent.Status activity={activity}>{t('activity message')}</ThreadComponent.Status>
|
|
150
|
+
</ThreadComponent.Root>
|
|
142
151
|
);
|
|
143
152
|
};
|
|
144
153
|
|
|
@@ -14,11 +14,11 @@ import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
|
14
14
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
15
15
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
16
16
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
17
|
-
import { AnchoredTo, DataType } from '@dxos/schema';
|
|
18
17
|
import { render } from '@dxos/storybook-utils';
|
|
18
|
+
import { AnchoredTo, Message } from '@dxos/types';
|
|
19
19
|
|
|
20
20
|
import { translations } from '../translations';
|
|
21
|
-
import {
|
|
21
|
+
import { Thread } from '../types';
|
|
22
22
|
|
|
23
23
|
import { CommentsContainer } from './CommentsContainer';
|
|
24
24
|
import { createCommentThread, createProposalThread } from './testing';
|
|
@@ -28,7 +28,7 @@ faker.seed(1);
|
|
|
28
28
|
const DefaultStory = () => {
|
|
29
29
|
const identity = useIdentity();
|
|
30
30
|
const space = useSpace();
|
|
31
|
-
const anchors = useQuery(space, Query.type(AnchoredTo));
|
|
31
|
+
const anchors = useQuery(space, Query.type(AnchoredTo.AnchoredTo));
|
|
32
32
|
|
|
33
33
|
useAsyncEffect(async () => {
|
|
34
34
|
if (identity && space) {
|
|
@@ -36,14 +36,14 @@ const DefaultStory = () => {
|
|
|
36
36
|
const thread1 = space.db.add(createCommentThread(identity));
|
|
37
37
|
const thread2 = space.db.add(createProposalThread(identity));
|
|
38
38
|
space.db.add(
|
|
39
|
-
Relation.make(AnchoredTo, {
|
|
39
|
+
Relation.make(AnchoredTo.AnchoredTo, {
|
|
40
40
|
[Relation.Source]: thread1,
|
|
41
41
|
[Relation.Target]: object,
|
|
42
42
|
anchor: 'test',
|
|
43
43
|
}),
|
|
44
44
|
);
|
|
45
45
|
space.db.add(
|
|
46
|
-
Relation.make(AnchoredTo, {
|
|
46
|
+
Relation.make(AnchoredTo.AnchoredTo, {
|
|
47
47
|
[Relation.Source]: thread2,
|
|
48
48
|
[Relation.Target]: object,
|
|
49
49
|
anchor: 'test',
|
|
@@ -71,7 +71,7 @@ const meta = {
|
|
|
71
71
|
plugins: [
|
|
72
72
|
IntentPlugin(),
|
|
73
73
|
ClientPlugin({
|
|
74
|
-
types: [
|
|
74
|
+
types: [Message.Message, Thread.Thread, AnchoredTo.AnchoredTo],
|
|
75
75
|
onClientInitialized: async ({ client }) => {
|
|
76
76
|
await client.halo.createIdentity();
|
|
77
77
|
},
|