@dxos/plugin-space 0.8.1-staging.5be625a → 0.8.1-staging.9eaf14f
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/{app-graph-builder-VHO33TWC.mjs → app-graph-builder-GMFCSOLG.mjs} +32 -5
- package/dist/lib/browser/app-graph-builder-GMFCSOLG.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-serializer-F3ASSBHI.mjs → app-graph-serializer-DSF2U3A5.mjs} +4 -4
- package/dist/lib/browser/{chunk-RZ7IWZW3.mjs → chunk-5BDV575R.mjs} +18 -10
- package/dist/lib/browser/{chunk-RZ7IWZW3.mjs.map → chunk-5BDV575R.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-HSC56GUH.mjs → chunk-AYW4IDRT.mjs} +10 -4
- package/dist/lib/browser/chunk-AYW4IDRT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4CTAR2NQ.mjs → chunk-JZXWPMLA.mjs} +849 -583
- package/dist/lib/browser/chunk-JZXWPMLA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-O7LODPTY.mjs → chunk-KVRYWFZU.mjs} +2 -2
- package/dist/lib/browser/chunk-KVRYWFZU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-3UOTYBKX.mjs → chunk-LO5UL6RU.mjs} +44 -12
- package/dist/lib/browser/chunk-LO5UL6RU.mjs.map +7 -0
- package/dist/lib/browser/{identity-created-YSJQAFUZ.mjs → identity-created-JR7BNXFH.mjs} +2 -2
- package/dist/lib/browser/index.mjs +33 -38
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-OQ243G6B.mjs → intent-resolver-RKYILWWQ.mjs} +65 -42
- package/dist/lib/browser/intent-resolver-RKYILWWQ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-5CIQKAFC.mjs → react-root-6H7NX2M2.mjs} +5 -5
- package/dist/lib/browser/{react-surface-SEBYKQD5.mjs → react-surface-7AGLOVMK.mjs} +35 -35
- package/dist/lib/browser/react-surface-7AGLOVMK.mjs.map +7 -0
- package/dist/lib/browser/{schema-UOCBWGA4.mjs → schema-FHTA26SW.mjs} +2 -2
- package/dist/lib/browser/{schema-tools-6J5ZEDBC.mjs → schema-tools-YAXPRIXP.mjs} +3 -3
- package/dist/lib/browser/schema-tools-YAXPRIXP.mjs.map +7 -0
- package/dist/lib/browser/{settings-C4ZEZTJF.mjs → settings-PJPTJUPE.mjs} +2 -2
- package/dist/lib/browser/{spaces-ready-EWHXCOBW.mjs → spaces-ready-BSSP7HHG.mjs} +7 -7
- package/dist/lib/browser/spaces-ready-BSSP7HHG.mjs.map +7 -0
- package/dist/lib/browser/{state-BUM7SQUV.mjs → state-X7VLCC6E.mjs} +4 -2
- package/dist/lib/browser/state-X7VLCC6E.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-DFCMCAMT.cjs → app-graph-builder-DPY7AUZE.cjs} +63 -36
- package/dist/lib/node/app-graph-builder-DPY7AUZE.cjs.map +7 -0
- package/dist/lib/node/{app-graph-serializer-7O35O6SV.cjs → app-graph-serializer-JELGJUAY.cjs} +20 -20
- package/dist/lib/node/{chunk-LRW6ZBDX.cjs → chunk-3GKCNADA.cjs} +903 -644
- package/dist/lib/node/chunk-3GKCNADA.cjs.map +7 -0
- package/dist/lib/node/{chunk-GRM6AGWI.cjs → chunk-IKIDS6XF.cjs} +5 -5
- package/dist/lib/node/chunk-IKIDS6XF.cjs.map +7 -0
- package/dist/lib/node/{chunk-FOYDT2Z3.cjs → chunk-PU2EYH4E.cjs} +22 -14
- package/dist/lib/node/{chunk-FOYDT2Z3.cjs.map → chunk-PU2EYH4E.cjs.map} +2 -2
- package/dist/lib/node/{chunk-K3HRT4CT.cjs → chunk-TUZWEPGX.cjs} +78 -46
- package/dist/lib/node/chunk-TUZWEPGX.cjs.map +7 -0
- package/dist/lib/node/{chunk-MFVXBJQJ.cjs → chunk-WDEIFDTX.cjs} +12 -6
- package/dist/lib/node/chunk-WDEIFDTX.cjs.map +7 -0
- package/dist/lib/node/{identity-created-YNPY3SHI.cjs → identity-created-XU4HFV2T.cjs} +6 -6
- package/dist/lib/node/index.cjs +80 -85
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-G5CNUJCN.cjs → intent-resolver-VJ7YV74L.cjs} +123 -99
- package/dist/lib/node/intent-resolver-VJ7YV74L.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-root-GUOHMGWR.cjs → react-root-TEL5RW3N.cjs} +10 -10
- package/dist/lib/node/{react-surface-NDV3KMWF.cjs → react-surface-2H3S5TY5.cjs} +66 -65
- package/dist/lib/node/react-surface-2H3S5TY5.cjs.map +7 -0
- package/dist/lib/node/{schema-EERAOETL.cjs → schema-PPJ5BZ3A.cjs} +6 -6
- package/dist/lib/node/{schema-tools-OZS4OC6X.cjs → schema-tools-BLIMOZYY.cjs} +5 -5
- package/dist/lib/node/schema-tools-BLIMOZYY.cjs.map +7 -0
- package/dist/lib/node/{settings-JS6D6VHU.cjs → settings-WVFP2UEP.cjs} +6 -6
- package/dist/lib/node/{spaces-ready-WNOF2MAQ.cjs → spaces-ready-7DNZSUOG.cjs} +15 -15
- package/dist/lib/node/spaces-ready-7DNZSUOG.cjs.map +7 -0
- package/dist/lib/node/{state-AIETH3DE.cjs → state-5KX6WBJH.cjs} +8 -6
- package/dist/lib/node/state-5KX6WBJH.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +12 -12
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-3VUKZI7U.mjs → app-graph-builder-42IGWRPL.mjs} +32 -5
- package/dist/lib/node-esm/app-graph-builder-42IGWRPL.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-serializer-PM4PTZK6.mjs → app-graph-serializer-FXONFKOE.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-YA6FCGDI.mjs → chunk-3ZOUV4DF.mjs} +18 -10
- package/dist/lib/node-esm/{chunk-YA6FCGDI.mjs.map → chunk-3ZOUV4DF.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-5YP3LY6A.mjs → chunk-BEWBZ4Q4.mjs} +849 -583
- package/dist/lib/node-esm/chunk-BEWBZ4Q4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-B6QDEMFR.mjs → chunk-FC4UHDPL.mjs} +10 -4
- package/dist/lib/node-esm/chunk-FC4UHDPL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AJ4IZAKT.mjs → chunk-PIYAWT5N.mjs} +2 -2
- package/dist/lib/node-esm/chunk-PIYAWT5N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-A4XT5SLD.mjs → chunk-ZGLK25WQ.mjs} +44 -12
- package/dist/lib/node-esm/chunk-ZGLK25WQ.mjs.map +7 -0
- package/dist/lib/node-esm/{identity-created-SEMQDDNJ.mjs → identity-created-WJKAS2PV.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +33 -38
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-YMFEX5XN.mjs → intent-resolver-ZFNSA4CM.mjs} +65 -42
- package/dist/lib/node-esm/intent-resolver-ZFNSA4CM.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-root-ROENLKSY.mjs → react-root-PRBJMWLQ.mjs} +5 -5
- package/dist/lib/node-esm/{react-surface-OLDKADHX.mjs → react-surface-RCZG2PNF.mjs} +35 -35
- package/dist/lib/node-esm/react-surface-RCZG2PNF.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-LOOOBN6J.mjs → schema-OUZKVYM5.mjs} +2 -2
- package/dist/lib/node-esm/{schema-tools-KJVXGDBO.mjs → schema-tools-IU7EX5A5.mjs} +3 -3
- package/dist/lib/node-esm/schema-tools-IU7EX5A5.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-B2AS4EGA.mjs → settings-FJZPC2TV.mjs} +2 -2
- package/dist/lib/node-esm/{spaces-ready-2SKD2XCY.mjs → spaces-ready-7X5PGB2V.mjs} +7 -7
- package/dist/lib/node-esm/spaces-ready-7X5PGB2V.mjs.map +7 -0
- package/dist/lib/node-esm/{state-DWUAP6MH.mjs → state-Z6E2YTNC.mjs} +4 -2
- package/dist/lib/node-esm/state-Z6E2YTNC.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +4 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/MembersContainer.d.ts +7 -0
- package/dist/types/src/components/MembersContainer.d.ts.map +1 -0
- package/dist/types/src/components/MembersContainer.stories.d.ts +8 -0
- package/dist/types/src/components/MembersContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettingsContainer/AdvancedObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettingsContainer/BaseObjectSettings.d.ts +8 -0
- package/dist/types/src/components/ObjectSettingsContainer/BaseObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettingsContainer/ForeignKeys.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettingsContainer/ObjectSettingsContainer.d.ts +8 -0
- package/dist/types/src/components/ObjectSettingsContainer/ObjectSettingsContainer.d.ts.map +1 -0
- package/dist/types/src/components/ObjectSettingsContainer/index.d.ts +2 -0
- package/dist/types/src/components/ObjectSettingsContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpacePropertiesForm.d.ts +7 -0
- package/dist/types/src/components/SpaceSettings/SpacePropertiesForm.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpacePropertiesForm.stories.d.ts +7 -0
- package/dist/types/src/components/SpaceSettings/SpacePropertiesForm.stories.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts +9 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsContainer.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/index.d.ts +2 -2
- package/dist/types/src/components/SpaceSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +48 -24
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/thread.d.ts +2 -0
- package/dist/types/src/types/thread.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +8 -0
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +12 -0
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +44 -42
- package/src/SpacePlugin.tsx +6 -10
- package/src/capabilities/app-graph-builder.ts +20 -0
- package/src/capabilities/capabilities.ts +3 -3
- package/src/capabilities/intent-resolver.ts +63 -37
- package/src/capabilities/react-surface.tsx +27 -26
- package/src/capabilities/schema-tools.ts +2 -2
- package/src/capabilities/spaces-ready.ts +3 -3
- package/src/capabilities/state.ts +2 -0
- package/src/components/CreateDialog/CreateObjectPanel.tsx +6 -6
- package/src/components/JoinDialog.tsx +43 -27
- package/src/components/MembersContainer.stories.tsx +34 -0
- package/src/components/MembersContainer.tsx +257 -0
- package/src/components/{AdvancedObjectSettings → ObjectSettingsContainer}/AdvancedObjectSettings.tsx +2 -2
- package/src/components/{BaseObjectSettings.tsx → ObjectSettingsContainer/BaseObjectSettings.tsx} +16 -11
- package/src/components/ObjectSettingsContainer/ObjectSettingsContainer.tsx +36 -0
- package/src/components/ObjectSettingsContainer/index.ts +5 -0
- package/src/components/SpacePresence.tsx +25 -23
- package/src/components/SpaceSettings/{SpaceSettingsPanel.stories.tsx → SpacePropertiesForm.stories.tsx} +6 -6
- package/src/components/SpaceSettings/SpacePropertiesForm.tsx +136 -0
- package/src/components/SpaceSettings/SpaceSettingsContainer.tsx +63 -0
- package/src/components/SpaceSettings/index.ts +2 -2
- package/src/components/SyncStatus/SyncStatus.tsx +1 -1
- package/src/components/SyncStatus/save-tracker.ts +5 -5
- package/src/components/index.ts +2 -2
- package/src/events.ts +2 -2
- package/src/translations.ts +19 -8
- package/src/types/types.ts +12 -6
- package/src/util.tsx +29 -7
- package/dist/lib/browser/app-graph-builder-VHO33TWC.mjs.map +0 -7
- package/dist/lib/browser/chunk-3UOTYBKX.mjs.map +0 -7
- package/dist/lib/browser/chunk-4CTAR2NQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-HSC56GUH.mjs.map +0 -7
- package/dist/lib/browser/chunk-O7LODPTY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-OQ243G6B.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SEBYKQD5.mjs.map +0 -7
- package/dist/lib/browser/schema-tools-6J5ZEDBC.mjs.map +0 -7
- package/dist/lib/browser/spaces-ready-EWHXCOBW.mjs.map +0 -7
- package/dist/lib/browser/state-BUM7SQUV.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-DFCMCAMT.cjs.map +0 -7
- package/dist/lib/node/chunk-GRM6AGWI.cjs.map +0 -7
- package/dist/lib/node/chunk-K3HRT4CT.cjs.map +0 -7
- package/dist/lib/node/chunk-LRW6ZBDX.cjs.map +0 -7
- package/dist/lib/node/chunk-MFVXBJQJ.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-G5CNUJCN.cjs.map +0 -7
- package/dist/lib/node/react-surface-NDV3KMWF.cjs.map +0 -7
- package/dist/lib/node/schema-tools-OZS4OC6X.cjs.map +0 -7
- package/dist/lib/node/spaces-ready-WNOF2MAQ.cjs.map +0 -7
- package/dist/lib/node/state-AIETH3DE.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3VUKZI7U.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5YP3LY6A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-A4XT5SLD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AJ4IZAKT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-B6QDEMFR.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YMFEX5XN.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-OLDKADHX.mjs.map +0 -7
- package/dist/lib/node-esm/schema-tools-KJVXGDBO.mjs.map +0 -7
- package/dist/lib/node-esm/spaces-ready-2SKD2XCY.mjs.map +0 -7
- package/dist/lib/node-esm/state-DWUAP6MH.mjs.map +0 -7
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts.map +0 -1
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts +0 -2
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/BaseObjectSettings.d.ts +0 -7
- package/dist/types/src/components/BaseObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +0 -11
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts +0 -7
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts +0 -7
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts +0 -7
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts.map +0 -1
- package/src/components/AdvancedObjectSettings/index.ts +0 -5
- package/src/components/SpaceSettings/SpaceSettingsDialog.stories.tsx +0 -43
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +0 -120
- package/src/components/SpaceSettings/SpaceSettingsPanel.tsx +0 -83
- /package/dist/lib/browser/{app-graph-serializer-F3ASSBHI.mjs.map → app-graph-serializer-DSF2U3A5.mjs.map} +0 -0
- /package/dist/lib/browser/{identity-created-YSJQAFUZ.mjs.map → identity-created-JR7BNXFH.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-5CIQKAFC.mjs.map → react-root-6H7NX2M2.mjs.map} +0 -0
- /package/dist/lib/browser/{schema-UOCBWGA4.mjs.map → schema-FHTA26SW.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-C4ZEZTJF.mjs.map → settings-PJPTJUPE.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-serializer-7O35O6SV.cjs.map → app-graph-serializer-JELGJUAY.cjs.map} +0 -0
- /package/dist/lib/node/{identity-created-YNPY3SHI.cjs.map → identity-created-XU4HFV2T.cjs.map} +0 -0
- /package/dist/lib/node/{react-root-GUOHMGWR.cjs.map → react-root-TEL5RW3N.cjs.map} +0 -0
- /package/dist/lib/node/{schema-EERAOETL.cjs.map → schema-PPJ5BZ3A.cjs.map} +0 -0
- /package/dist/lib/node/{settings-JS6D6VHU.cjs.map → settings-WVFP2UEP.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-serializer-PM4PTZK6.mjs.map → app-graph-serializer-FXONFKOE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{identity-created-SEMQDDNJ.mjs.map → identity-created-WJKAS2PV.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-ROENLKSY.mjs.map → react-root-PRBJMWLQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{schema-LOOOBN6J.mjs.map → schema-OUZKVYM5.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-B2AS4EGA.mjs.map → settings-FJZPC2TV.mjs.map} +0 -0
- /package/dist/types/src/components/{AdvancedObjectSettings → ObjectSettingsContainer}/AdvancedObjectSettings.d.ts +0 -0
- /package/dist/types/src/components/{AdvancedObjectSettings → ObjectSettingsContainer}/ForeignKeys.d.ts +0 -0
- /package/src/components/{AdvancedObjectSettings → ObjectSettingsContainer}/ForeignKeys.tsx +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Check, X } from '@phosphor-icons/react';
|
|
6
|
+
import React, { type Dispatch, type SetStateAction, useMemo, useState } from 'react';
|
|
7
|
+
import { QR } from 'react-qr-rounded';
|
|
8
|
+
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { useConfig } from '@dxos/react-client';
|
|
11
|
+
import { fullyQualifiedId, useSpaceInvitations, type Space } from '@dxos/react-client/echo';
|
|
12
|
+
import { type CancellableInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
13
|
+
import { Button, Clipboard, Icon, useId, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { ControlSection, ControlFrame, ControlFrameItem } from '@dxos/react-ui-form';
|
|
15
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
16
|
+
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
17
|
+
import {
|
|
18
|
+
type ActionMenuItem,
|
|
19
|
+
AuthCode,
|
|
20
|
+
BifurcatedAction,
|
|
21
|
+
Centered,
|
|
22
|
+
Emoji,
|
|
23
|
+
InvitationList,
|
|
24
|
+
SpaceMemberList,
|
|
25
|
+
Viewport,
|
|
26
|
+
} from '@dxos/shell/react';
|
|
27
|
+
import { hexToEmoji } from '@dxos/util';
|
|
28
|
+
|
|
29
|
+
import { SPACE_PLUGIN } from '../meta';
|
|
30
|
+
import { CollectionType } from '../types';
|
|
31
|
+
|
|
32
|
+
// TODO(wittjosiah): Copied from Shell.
|
|
33
|
+
const activeActionKey = 'dxos:react-shell/space-manager/active-action';
|
|
34
|
+
|
|
35
|
+
const handleInvitationEvent = (invitation: Invitation, subscription: ZenObservable.Subscription) => {
|
|
36
|
+
const invitationCode = InvitationEncoder.encode(invitation);
|
|
37
|
+
if (invitation.state === Invitation.State.CONNECTING) {
|
|
38
|
+
log.info(JSON.stringify({ invitationCode, authCode: invitation.authCode }));
|
|
39
|
+
subscription.unsubscribe();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const MembersContainer = ({
|
|
44
|
+
space,
|
|
45
|
+
createInvitationUrl,
|
|
46
|
+
}: {
|
|
47
|
+
space: Space;
|
|
48
|
+
createInvitationUrl: (invitationCode: string) => string;
|
|
49
|
+
}) => {
|
|
50
|
+
const { t } = useTranslation('os');
|
|
51
|
+
const config = useConfig();
|
|
52
|
+
const invitations = useSpaceInvitations(space.key);
|
|
53
|
+
const visibleInvitations = invitations?.filter(
|
|
54
|
+
(invitation) => ![Invitation.State.CANCELLED].includes(invitation.get().state),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const [activeAction, setInternalActiveAction] = useState(localStorage.getItem(activeActionKey) ?? 'inviteMany');
|
|
58
|
+
|
|
59
|
+
const setActiveAction = (nextAction: string) => {
|
|
60
|
+
setInternalActiveAction(nextAction);
|
|
61
|
+
localStorage.setItem(activeActionKey, nextAction);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// TODO(wittjosiah): Track which was the most recently viewed object.
|
|
65
|
+
const target = space.properties[CollectionType.typename]?.target?.objects[0]?.target;
|
|
66
|
+
|
|
67
|
+
const inviteActions = useMemo(
|
|
68
|
+
(): Record<string, ActionMenuItem> => ({
|
|
69
|
+
inviteOne: {
|
|
70
|
+
label: t('invite one label'),
|
|
71
|
+
description: t('invite one description'),
|
|
72
|
+
icon: () => <Icon icon='ph--user-plus--regular' size={5} />,
|
|
73
|
+
testId: 'membersContainer.inviteOne',
|
|
74
|
+
onClick: () => {
|
|
75
|
+
const invitation = space.share?.({
|
|
76
|
+
type: Invitation.Type.INTERACTIVE,
|
|
77
|
+
authMethod: Invitation.AuthMethod.SHARED_SECRET,
|
|
78
|
+
multiUse: false,
|
|
79
|
+
target: target && fullyQualifiedId(target),
|
|
80
|
+
});
|
|
81
|
+
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
|
|
82
|
+
const subscription: ZenObservable.Subscription = invitation.subscribe((invitation) =>
|
|
83
|
+
handleInvitationEvent(invitation, subscription),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
inviteMany: {
|
|
89
|
+
label: t('invite many label'),
|
|
90
|
+
description: t('invite many description'),
|
|
91
|
+
icon: () => <Icon icon='ph--users-three--regular' size={5} />,
|
|
92
|
+
testId: 'membersContainer.inviteMany',
|
|
93
|
+
onClick: () => {
|
|
94
|
+
const invitation = space.share?.({
|
|
95
|
+
type: Invitation.Type.DELEGATED,
|
|
96
|
+
authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
|
|
97
|
+
multiUse: true,
|
|
98
|
+
target: target && fullyQualifiedId(target),
|
|
99
|
+
});
|
|
100
|
+
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
|
|
101
|
+
const subscription: ZenObservable.Subscription = invitation.subscribe((invitation) =>
|
|
102
|
+
handleInvitationEvent(invitation, subscription),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
[t, space, target],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const [selectedInvitation, setSelectedInvitation] = useState<CancellableInvitationObservable | null>(null);
|
|
112
|
+
const handleSend = (event: { type: 'selectInvitation'; invitation: CancellableInvitationObservable }) => {
|
|
113
|
+
setSelectedInvitation(event.invitation);
|
|
114
|
+
};
|
|
115
|
+
const handleBack = () => {
|
|
116
|
+
setSelectedInvitation(null);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<Clipboard.Provider>
|
|
121
|
+
<StackItem.Content classNames='p-2 block overflow-y-auto'>
|
|
122
|
+
<ControlSection
|
|
123
|
+
title={t('members verbose label', { ns: SPACE_PLUGIN })}
|
|
124
|
+
description={t('members description', { ns: SPACE_PLUGIN })}
|
|
125
|
+
>
|
|
126
|
+
<ControlFrame>
|
|
127
|
+
<ControlFrameItem title={t('members label', { ns: SPACE_PLUGIN })}>
|
|
128
|
+
<SpaceMemberList spaceKey={space.key} includeSelf />
|
|
129
|
+
</ControlFrameItem>
|
|
130
|
+
<ControlFrameItem title={t('invitations label', { ns: SPACE_PLUGIN })}>
|
|
131
|
+
{selectedInvitation && <InvitationSection {...selectedInvitation} onBack={handleBack} />}
|
|
132
|
+
{!selectedInvitation && (
|
|
133
|
+
<>
|
|
134
|
+
<p className='text-description mbe-2'>{t('space invitation description', { ns: SPACE_PLUGIN })}</p>
|
|
135
|
+
<InvitationList
|
|
136
|
+
className='mb-2'
|
|
137
|
+
send={handleSend}
|
|
138
|
+
invitations={visibleInvitations ?? []}
|
|
139
|
+
onClickRemove={(invitation) => invitation.cancel()}
|
|
140
|
+
createInvitationUrl={createInvitationUrl}
|
|
141
|
+
/>
|
|
142
|
+
<BifurcatedAction
|
|
143
|
+
actions={inviteActions}
|
|
144
|
+
activeAction={activeAction}
|
|
145
|
+
onChangeActiveAction={setActiveAction as Dispatch<SetStateAction<string>>}
|
|
146
|
+
data-testid='membersContainer.createInvitation'
|
|
147
|
+
/>
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
150
|
+
</ControlFrameItem>
|
|
151
|
+
</ControlFrame>
|
|
152
|
+
</ControlSection>
|
|
153
|
+
</StackItem.Content>
|
|
154
|
+
</Clipboard.Provider>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// TODO(wittjosiah): Reconcile the below components with DevicesContainer in @dxos/plugin-client.
|
|
159
|
+
|
|
160
|
+
type InvitationComponentProps = Partial<
|
|
161
|
+
Pick<Invitation, 'authCode' | 'invitationId'> & {
|
|
162
|
+
state: Invitation.State;
|
|
163
|
+
url: string;
|
|
164
|
+
onBack: () => void;
|
|
165
|
+
}
|
|
166
|
+
>;
|
|
167
|
+
|
|
168
|
+
const InvitationSection = ({
|
|
169
|
+
state = Invitation.State.INIT,
|
|
170
|
+
authCode,
|
|
171
|
+
invitationId = 'never',
|
|
172
|
+
url = 'never',
|
|
173
|
+
onBack,
|
|
174
|
+
}: InvitationComponentProps) => {
|
|
175
|
+
const activeView =
|
|
176
|
+
state < 0
|
|
177
|
+
? 'init'
|
|
178
|
+
: state >= Invitation.State.CANCELLED
|
|
179
|
+
? 'complete'
|
|
180
|
+
: state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode
|
|
181
|
+
? 'auth-code'
|
|
182
|
+
: 'qr-code';
|
|
183
|
+
return (
|
|
184
|
+
<Viewport.Root activeView={activeView}>
|
|
185
|
+
<Viewport.Views>
|
|
186
|
+
<Viewport.View id='init'>
|
|
187
|
+
{/* This view intentionally left blank while conditionally rendering the viewport. */}
|
|
188
|
+
</Viewport.View>
|
|
189
|
+
<Viewport.View id='complete'>
|
|
190
|
+
<InvitationComplete statusValue={state} />
|
|
191
|
+
</Viewport.View>
|
|
192
|
+
<Viewport.View id='auth-code'>
|
|
193
|
+
<InvitationAuthCode id={invitationId} code={authCode ?? 'never'} onCancel={onBack} />
|
|
194
|
+
</Viewport.View>
|
|
195
|
+
<Viewport.View id='qr-code'>
|
|
196
|
+
<InvitationQR id={invitationId} url={url} onCancel={onBack} />
|
|
197
|
+
</Viewport.View>
|
|
198
|
+
</Viewport.Views>
|
|
199
|
+
</Viewport.Root>
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const InvitationQR = ({ id, url, onCancel }: { id: string; url: string; onCancel?: () => void }) => {
|
|
204
|
+
const { t } = useTranslation('os');
|
|
205
|
+
const qrLabel = useId('members-container__qr-code');
|
|
206
|
+
const emoji = hexToEmoji(id);
|
|
207
|
+
return (
|
|
208
|
+
<>
|
|
209
|
+
<p className='text-description'>{t('qr code description', { ns: SPACE_PLUGIN })}</p>
|
|
210
|
+
<div role='group' className='grid grid-cols-[1fr_min-content] mlb-2 gap-2'>
|
|
211
|
+
<div role='none' className='is-full aspect-square relative text-description'>
|
|
212
|
+
<QR
|
|
213
|
+
rounding={100}
|
|
214
|
+
backgroundColor='transparent'
|
|
215
|
+
color='currentColor'
|
|
216
|
+
aria-labelledby={qrLabel}
|
|
217
|
+
errorCorrectionLevel='Q'
|
|
218
|
+
cutout={true}
|
|
219
|
+
>
|
|
220
|
+
{url ?? 'never'}
|
|
221
|
+
</QR>
|
|
222
|
+
<Centered>
|
|
223
|
+
<Emoji text={emoji} />
|
|
224
|
+
</Centered>
|
|
225
|
+
</div>
|
|
226
|
+
<span id={qrLabel} className='sr-only'>
|
|
227
|
+
{t('qr label')}
|
|
228
|
+
</span>
|
|
229
|
+
<Clipboard.Button value={url ?? 'never'} />
|
|
230
|
+
</div>
|
|
231
|
+
<Button variant='ghost' onClick={onCancel}>
|
|
232
|
+
{t('cancel label')}
|
|
233
|
+
</Button>
|
|
234
|
+
</>
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const InvitationAuthCode = ({ id, code, onCancel }: { id: string; code: string; onCancel?: () => void }) => {
|
|
239
|
+
const { t } = useTranslation('os');
|
|
240
|
+
const emoji = hexToEmoji(id);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<>
|
|
244
|
+
<p className='text-description'>{t('auth other device emoji message')}</p>
|
|
245
|
+
{emoji && <Emoji text={emoji} className='mli-auto mlb-2 text-center' />}
|
|
246
|
+
<p className='text-description'>{t('auth code message')}</p>
|
|
247
|
+
<AuthCode code={code} large classNames='mli-auto mlb-2 text-center grow' />
|
|
248
|
+
<Button variant='ghost' onClick={onCancel}>
|
|
249
|
+
{t('cancel label')}
|
|
250
|
+
</Button>
|
|
251
|
+
</>
|
|
252
|
+
);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const InvitationComplete = ({ statusValue }: { statusValue: number }) => {
|
|
256
|
+
return statusValue > 0 ? <Check className={mx('m-1.5', getSize(6))} /> : <X className={mx('m-1.5', getSize(6))} />;
|
|
257
|
+
};
|
package/src/components/{AdvancedObjectSettings → ObjectSettingsContainer}/AdvancedObjectSettings.tsx
RENAMED
|
@@ -6,7 +6,7 @@ import React, { useCallback, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type ForeignKey, ForeignKeySchema } from '@dxos/echo-schema';
|
|
8
8
|
import { getMeta, type ReactiveEchoObject } from '@dxos/react-client/echo';
|
|
9
|
-
import { IconButton, useTranslation
|
|
9
|
+
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
12
|
import { ForeignKeys } from './ForeignKeys';
|
|
@@ -51,7 +51,6 @@ export const AdvancedObjectSettings = ({ object }: AdvancedObjectSettingsProps)
|
|
|
51
51
|
// TODO(wittjosiah): This should be wrapped in an "Advanced" accordion.
|
|
52
52
|
return (
|
|
53
53
|
<>
|
|
54
|
-
<Separator />
|
|
55
54
|
<div className='p-2 flex flex-col gap-4'>
|
|
56
55
|
<h2>{t('advanced settings label')}</h2>
|
|
57
56
|
<div className='flex items-center'>
|
|
@@ -66,6 +65,7 @@ export const AdvancedObjectSettings = ({ object }: AdvancedObjectSettingsProps)
|
|
|
66
65
|
</div>
|
|
67
66
|
{!adding && <ForeignKeys keys={keys} onDelete={handleDelete} />}
|
|
68
67
|
</div>
|
|
68
|
+
|
|
69
69
|
{adding && <Form schema={ForeignKeySchema} values={initialValues} onSave={handleSave} onCancel={handleCancel} />}
|
|
70
70
|
</>
|
|
71
71
|
);
|
package/src/components/{BaseObjectSettings.tsx → ObjectSettingsContainer/BaseObjectSettings.tsx}
RENAMED
|
@@ -2,25 +2,29 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type PropsWithChildren, useRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ReactiveEchoObject } from '@dxos/react-client/echo';
|
|
8
|
-
import { Input, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Input, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
+
import { meta } from '../../meta';
|
|
11
12
|
|
|
12
|
-
export type BaseObjectSettingsProps =
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export type BaseObjectSettingsProps = ThemedClassName<
|
|
14
|
+
PropsWithChildren<{
|
|
15
|
+
object: ReactiveEchoObject<any>;
|
|
16
|
+
}>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export const BaseObjectSettings = ({ classNames, children, object }: BaseObjectSettingsProps) => {
|
|
20
|
+
const { t } = useTranslation(meta.id);
|
|
21
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
15
22
|
|
|
16
|
-
export const BaseObjectSettings = ({ object }: BaseObjectSettingsProps) => {
|
|
17
|
-
const { t } = useTranslation(SPACE_PLUGIN);
|
|
18
|
-
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
19
23
|
// TODO(wittjosiah): This should be a form based on the schema of the object.
|
|
20
24
|
// The form should only include fields with a specific settings annotation.
|
|
21
25
|
// Perhaps also including the field of the title annotation as well.
|
|
22
26
|
return (
|
|
23
|
-
<
|
|
27
|
+
<form className={mx('flex flex-col p-2 gap-2', classNames)}>
|
|
24
28
|
<Input.Root>
|
|
25
29
|
<Input.Label>{t('name label')}</Input.Label>
|
|
26
30
|
<Input.TextInput
|
|
@@ -37,6 +41,7 @@ export const BaseObjectSettings = ({ object }: BaseObjectSettingsProps) => {
|
|
|
37
41
|
}}
|
|
38
42
|
/>
|
|
39
43
|
</Input.Root>
|
|
40
|
-
|
|
44
|
+
{children}
|
|
45
|
+
</form>
|
|
41
46
|
);
|
|
42
47
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { type ReactiveEchoObject } from '@dxos/react-client/echo';
|
|
9
|
+
import { Clipboard } from '@dxos/react-ui';
|
|
10
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
11
|
+
|
|
12
|
+
import { AdvancedObjectSettings } from './AdvancedObjectSettings';
|
|
13
|
+
import { BaseObjectSettings } from './BaseObjectSettings';
|
|
14
|
+
|
|
15
|
+
export type ObjectSettingsContainerProps = {
|
|
16
|
+
object: ReactiveEchoObject<any>;
|
|
17
|
+
role: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const ObjectSettingsContainer = ({ object, role }: ObjectSettingsContainerProps) => {
|
|
21
|
+
const data = useMemo(() => ({ subject: object }), [object]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Clipboard.Provider>
|
|
25
|
+
<StackItem.Content toolbar={false} role={role}>
|
|
26
|
+
<div className='flex flex-col overflow-y-auto divide-y divide-separator'>
|
|
27
|
+
<BaseObjectSettings object={object}>
|
|
28
|
+
<Surface role='base-object-settings' data={data} />
|
|
29
|
+
</BaseObjectSettings>
|
|
30
|
+
<Surface role='object-settings' data={data} />
|
|
31
|
+
<AdvancedObjectSettings object={object} />
|
|
32
|
+
</div>
|
|
33
|
+
</StackItem.Content>
|
|
34
|
+
</Clipboard.Provider>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -12,8 +12,7 @@ import { getSpace, useMembers, type SpaceMember, fullyQualifiedId } from '@dxos/
|
|
|
12
12
|
import { type Identity, useIdentity } from '@dxos/react-client/halo';
|
|
13
13
|
import {
|
|
14
14
|
Avatar,
|
|
15
|
-
|
|
16
|
-
AvatarGroupItem,
|
|
15
|
+
type AvatarContentProps,
|
|
17
16
|
type Size,
|
|
18
17
|
type ThemedClassName,
|
|
19
18
|
Tooltip,
|
|
@@ -113,16 +112,16 @@ export const FullPresence = (props: MemberPresenceProps) => {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
return (
|
|
116
|
-
<
|
|
115
|
+
<div className='dx-avatar-group' data-testid='spacePlugin.presence'>
|
|
117
116
|
{members.slice(0, 3).map((member, i) => (
|
|
118
117
|
<Tooltip.Root key={member.identity.identityKey.toHex()}>
|
|
119
118
|
<Tooltip.Trigger>
|
|
120
119
|
<PrensenceAvatar
|
|
121
120
|
identity={member.identity}
|
|
122
|
-
group
|
|
123
121
|
match={member.currentlyAttended} // TODO(Zan): Match always true now we're showing 'members viewing current object'.
|
|
124
122
|
index={members.length - i}
|
|
125
123
|
onClick={() => onMemberClick?.(member)}
|
|
124
|
+
size={size}
|
|
126
125
|
/>
|
|
127
126
|
</Tooltip.Trigger>
|
|
128
127
|
<Tooltip.Portal>
|
|
@@ -137,12 +136,14 @@ export const FullPresence = (props: MemberPresenceProps) => {
|
|
|
137
136
|
{members.length > 3 && (
|
|
138
137
|
<Tooltip.Root>
|
|
139
138
|
<Tooltip.Trigger>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
<Avatar.Root>
|
|
140
|
+
{/* TODO(wittjosiah): Make text fit. */}
|
|
141
|
+
<Avatar.Content
|
|
142
|
+
status='inactive'
|
|
143
|
+
style={{ zIndex: members.length - 4 }}
|
|
144
|
+
fallback={`+${members.length - 3}`}
|
|
145
|
+
/>
|
|
146
|
+
</Avatar.Root>
|
|
146
147
|
</Tooltip.Trigger>
|
|
147
148
|
<Tooltip.Portal>
|
|
148
149
|
<Tooltip.Content side='bottom'>
|
|
@@ -156,7 +157,7 @@ export const FullPresence = (props: MemberPresenceProps) => {
|
|
|
156
157
|
data-testid='identity-list-item'
|
|
157
158
|
>
|
|
158
159
|
{/* TODO(Zan): Match always true now we're showing 'members viewing current object'. */}
|
|
159
|
-
<PrensenceAvatar identity={member.identity} showName match={member.currentlyAttended} />
|
|
160
|
+
<PrensenceAvatar identity={member.identity} size={size} showName match={member.currentlyAttended} />
|
|
160
161
|
</ListItem.Root>
|
|
161
162
|
))}
|
|
162
163
|
</List>
|
|
@@ -164,35 +165,36 @@ export const FullPresence = (props: MemberPresenceProps) => {
|
|
|
164
165
|
</Tooltip.Portal>
|
|
165
166
|
</Tooltip.Root>
|
|
166
167
|
)}
|
|
167
|
-
</
|
|
168
|
+
</div>
|
|
168
169
|
);
|
|
169
170
|
};
|
|
170
171
|
|
|
171
|
-
type PresenceAvatarProps = {
|
|
172
|
+
type PresenceAvatarProps = Pick<AvatarContentProps, 'size'> & {
|
|
172
173
|
identity: Identity;
|
|
173
174
|
showName?: boolean;
|
|
174
175
|
match?: boolean;
|
|
175
|
-
group?: boolean;
|
|
176
176
|
index?: number;
|
|
177
177
|
onClick?: () => void;
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
const PrensenceAvatar = ({ identity, showName, match,
|
|
181
|
-
const Root = group ? AvatarGroupItem.Root : Avatar.Root;
|
|
180
|
+
const PrensenceAvatar = ({ identity, showName, match, index, onClick, size }: PresenceAvatarProps) => {
|
|
182
181
|
const status = match ? 'current' : 'active';
|
|
183
182
|
const fallbackValue = keyToFallback(identity.identityKey);
|
|
184
183
|
return (
|
|
185
|
-
<Root
|
|
186
|
-
<Avatar.
|
|
184
|
+
<Avatar.Root>
|
|
185
|
+
<Avatar.Content
|
|
186
|
+
status={status}
|
|
187
|
+
hue={identity.profile?.data?.hue || fallbackValue.hue}
|
|
187
188
|
data-testid='spacePlugin.presence.member'
|
|
188
189
|
data-status={status}
|
|
190
|
+
size={size}
|
|
191
|
+
classNames='mbs-2 mie-4'
|
|
189
192
|
{...(index ? { style: { zIndex: index } } : {})}
|
|
190
193
|
onClick={() => onClick?.()}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
</Avatar.
|
|
194
|
-
|
|
195
|
-
</Root>
|
|
194
|
+
fallback={identity.profile?.data?.emoji || fallbackValue.emoji}
|
|
195
|
+
/>
|
|
196
|
+
<Avatar.Label classNames={showName ? 'text-sm truncate pli-2' : 'sr-only'}>{getName(identity)}</Avatar.Label>
|
|
197
|
+
</Avatar.Root>
|
|
196
198
|
);
|
|
197
199
|
};
|
|
198
200
|
|
|
@@ -10,21 +10,21 @@ import React from 'react';
|
|
|
10
10
|
import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
11
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { SpacePropertiesForm, type SpacePropertiesFormProps } from './SpacePropertiesForm';
|
|
14
14
|
import translations from '../../translations';
|
|
15
15
|
|
|
16
|
-
const Story = (args: Partial<
|
|
16
|
+
const Story = (args: Partial<SpacePropertiesFormProps>) => {
|
|
17
17
|
const { space } = useClientProvider();
|
|
18
18
|
return (
|
|
19
19
|
<div role='none' className='p-2 border border-primary-500 rounded'>
|
|
20
|
-
<
|
|
20
|
+
<SpacePropertiesForm {...args} space={space!} />
|
|
21
21
|
</div>
|
|
22
22
|
);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const meta: Meta = {
|
|
26
|
-
title: 'plugins/plugin-space/
|
|
27
|
-
component:
|
|
26
|
+
title: 'plugins/plugin-space/SpacePropertiesForm',
|
|
27
|
+
component: SpacePropertiesForm,
|
|
28
28
|
render: Story,
|
|
29
29
|
decorators: [withClientProvider({ createIdentity: true, createSpace: true }), withTheme],
|
|
30
30
|
parameters: {
|
|
@@ -35,4 +35,4 @@ const meta: Meta = {
|
|
|
35
35
|
|
|
36
36
|
export default meta;
|
|
37
37
|
|
|
38
|
-
export const Default: StoryObj<typeof
|
|
38
|
+
export const Default: StoryObj<typeof SpacePropertiesForm> = {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Schema as S } from 'effect';
|
|
6
|
+
import React, { type ChangeEvent, useCallback, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { log } from '@dxos/log';
|
|
9
|
+
import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
10
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Form, type InputComponent, ControlItem, ControlItemInput } from '@dxos/react-ui-form';
|
|
13
|
+
import { HuePicker, IconPicker } from '@dxos/react-ui-pickers';
|
|
14
|
+
|
|
15
|
+
import { SPACE_PLUGIN } from '../../meta';
|
|
16
|
+
import { SpaceForm } from '../../types';
|
|
17
|
+
|
|
18
|
+
export type SpacePropertiesFormProps = {
|
|
19
|
+
space: Space;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const SpacePropertiesForm = ({ space }: SpacePropertiesFormProps) => {
|
|
23
|
+
const { t } = useTranslation(SPACE_PLUGIN);
|
|
24
|
+
|
|
25
|
+
const [edgeReplication, setEdgeReplication] = useState(
|
|
26
|
+
space.internal.data.edgeReplication === EdgeReplicationSetting.ENABLED,
|
|
27
|
+
);
|
|
28
|
+
const toggleEdgeReplication = useCallback(
|
|
29
|
+
async (next: boolean) => {
|
|
30
|
+
setEdgeReplication(next);
|
|
31
|
+
await space?.internal
|
|
32
|
+
.setEdgeReplicationPreference(next ? EdgeReplicationSetting.ENABLED : EdgeReplicationSetting.DISABLED)
|
|
33
|
+
.catch((err: unknown) => {
|
|
34
|
+
log.catch(err);
|
|
35
|
+
setEdgeReplication(!next);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
[space],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const handleSave = useCallback(
|
|
42
|
+
(properties: S.Schema.Type<typeof SpaceForm>) => {
|
|
43
|
+
void toggleEdgeReplication(properties.edgeReplication);
|
|
44
|
+
if (properties.name !== space.properties.name) {
|
|
45
|
+
space.properties.name = properties.name;
|
|
46
|
+
}
|
|
47
|
+
if (properties.icon !== space.properties.icon) {
|
|
48
|
+
space.properties.icon = properties.icon;
|
|
49
|
+
}
|
|
50
|
+
if (properties.hue !== space.properties.hue) {
|
|
51
|
+
space.properties.hue = properties.hue;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
[space, toggleEdgeReplication],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const values = useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
name: space.properties.name,
|
|
60
|
+
icon: space.properties.icon,
|
|
61
|
+
hue: space.properties.hue,
|
|
62
|
+
edgeReplication,
|
|
63
|
+
}),
|
|
64
|
+
[space.properties.name, space.properties.icon, space.properties.hue, edgeReplication],
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const customElements: Partial<Record<string, InputComponent>> = useMemo(
|
|
68
|
+
() => ({
|
|
69
|
+
name: ({ type, label, getValue, onValueChange }) => {
|
|
70
|
+
const handleChange = useCallback(
|
|
71
|
+
({ target: { value } }: ChangeEvent<HTMLInputElement>) => onValueChange(type, value),
|
|
72
|
+
[onValueChange, type],
|
|
73
|
+
);
|
|
74
|
+
return (
|
|
75
|
+
<ControlItemInput title={label} description={t('display name description')}>
|
|
76
|
+
<Input.TextInput
|
|
77
|
+
value={getValue()}
|
|
78
|
+
onChange={handleChange}
|
|
79
|
+
placeholder={t('display name input placeholder')}
|
|
80
|
+
classNames='min-is-64'
|
|
81
|
+
/>
|
|
82
|
+
</ControlItemInput>
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
icon: ({ type, label, getValue, onValueChange }) => {
|
|
86
|
+
const handleChange = useCallback((nextEmoji: string) => onValueChange(type, nextEmoji), [onValueChange, type]);
|
|
87
|
+
const handleEmojiReset = useCallback(() => onValueChange(type, undefined), [onValueChange, type]);
|
|
88
|
+
return (
|
|
89
|
+
<ControlItem title={label} description={t('icon description')}>
|
|
90
|
+
<IconPicker
|
|
91
|
+
value={getValue()}
|
|
92
|
+
onChange={handleChange}
|
|
93
|
+
onReset={handleEmojiReset}
|
|
94
|
+
classNames='justify-self-end'
|
|
95
|
+
iconSize={5}
|
|
96
|
+
/>
|
|
97
|
+
</ControlItem>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
hue: ({ type, label, getValue, onValueChange }) => {
|
|
101
|
+
const handleChange = useCallback((nextHue: string) => onValueChange(type, nextHue), [onValueChange, type]);
|
|
102
|
+
const handleHueReset = useCallback(() => onValueChange(type, undefined), [onValueChange, type]);
|
|
103
|
+
return (
|
|
104
|
+
<ControlItem title={label} description={t('hue description')}>
|
|
105
|
+
<HuePicker
|
|
106
|
+
value={getValue()}
|
|
107
|
+
onChange={handleChange}
|
|
108
|
+
onReset={handleHueReset}
|
|
109
|
+
classNames='[--hue-preview-size:1.25rem] justify-self-end'
|
|
110
|
+
/>
|
|
111
|
+
</ControlItem>
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
edgeReplication: ({ type, label, getValue, onValueChange }) => {
|
|
115
|
+
const handleChange = useCallback((checked: boolean) => onValueChange(type, checked), [onValueChange, type]);
|
|
116
|
+
return (
|
|
117
|
+
<ControlItemInput title={label} description={t('edge replication description')}>
|
|
118
|
+
<Input.Switch checked={getValue()} onCheckedChange={handleChange} classNames='justify-self-end' />
|
|
119
|
+
</ControlItemInput>
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
}),
|
|
123
|
+
[t],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<Form
|
|
128
|
+
schema={SpaceForm}
|
|
129
|
+
values={values}
|
|
130
|
+
autoSave
|
|
131
|
+
onSave={handleSave}
|
|
132
|
+
Custom={customElements}
|
|
133
|
+
classNames='p-0 container-max-width [&_[role="form"]]:grid [&_[role="form"]]:grid-cols-1 md:[&_[role="form"]]:grid-cols-[1fr_min-content] [&_[role="form"]]:gap-4'
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
};
|