@dxos/plugin-space 0.7.4 → 0.7.5-feature-compute.4d9d99a
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-5D2QB43K.mjs +365 -0
- package/dist/lib/browser/app-graph-builder-5D2QB43K.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-VNWPLPDF.mjs +80 -0
- package/dist/lib/browser/app-graph-serializer-VNWPLPDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-5TBRONF6.mjs +133 -0
- package/dist/lib/browser/chunk-5TBRONF6.mjs.map +7 -0
- package/dist/lib/browser/chunk-6SWQRWOD.mjs +1672 -0
- package/dist/lib/browser/chunk-6SWQRWOD.mjs.map +7 -0
- package/dist/lib/browser/chunk-HCXWKGTE.mjs +316 -0
- package/dist/lib/browser/chunk-HCXWKGTE.mjs.map +7 -0
- package/dist/lib/browser/chunk-SOXNANA6.mjs +12 -0
- package/dist/lib/browser/chunk-SOXNANA6.mjs.map +7 -0
- package/dist/lib/browser/chunk-UH5P4UL3.mjs +21 -0
- package/dist/lib/browser/chunk-UH5P4UL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZBKFJNHH.mjs +523 -0
- package/dist/lib/browser/chunk-ZBKFJNHH.mjs.map +7 -0
- package/dist/lib/browser/identity-created-EC5FOCX2.mjs +28 -0
- package/dist/lib/browser/identity-created-EC5FOCX2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +192 -3521
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-VBL572N7.mjs +459 -0
- package/dist/lib/browser/intent-resolver-VBL572N7.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-root-AZJFNTKK.mjs +28 -0
- package/dist/lib/browser/react-root-AZJFNTKK.mjs.map +7 -0
- package/dist/lib/browser/react-surface-E2VSYVNZ.mjs +238 -0
- package/dist/lib/browser/react-surface-E2VSYVNZ.mjs.map +7 -0
- package/dist/lib/browser/settings-ASFF5BZL.mjs +24 -0
- package/dist/lib/browser/settings-ASFF5BZL.mjs.map +7 -0
- package/dist/lib/browser/spaces-ready-4SFNS5JQ.mjs +200 -0
- package/dist/lib/browser/spaces-ready-4SFNS5JQ.mjs.map +7 -0
- package/dist/lib/browser/state-MS4KYJWI.mjs +47 -0
- package/dist/lib/browser/state-MS4KYJWI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -5
- package/dist/lib/node/app-graph-builder-ZQ5S62YR.cjs +368 -0
- package/dist/lib/node/app-graph-builder-ZQ5S62YR.cjs.map +7 -0
- package/dist/lib/node/app-graph-serializer-72S7P33H.cjs +88 -0
- package/dist/lib/node/app-graph-serializer-72S7P33H.cjs.map +7 -0
- package/dist/lib/node/chunk-56NGXG2A.cjs +41 -0
- package/dist/lib/node/chunk-56NGXG2A.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-AO4EW2RX.cjs} +12 -13
- package/dist/lib/node/chunk-AO4EW2RX.cjs.map +7 -0
- package/dist/lib/node/chunk-BQRNTKSQ.cjs +150 -0
- package/dist/lib/node/chunk-BQRNTKSQ.cjs.map +7 -0
- package/dist/lib/node/chunk-DDZYVNVP.cjs +345 -0
- package/dist/lib/node/chunk-DDZYVNVP.cjs.map +7 -0
- package/dist/lib/node/chunk-M64YG2FY.cjs +1669 -0
- package/dist/lib/node/chunk-M64YG2FY.cjs.map +7 -0
- package/dist/lib/node/chunk-Z34MTEU7.cjs +551 -0
- package/dist/lib/node/chunk-Z34MTEU7.cjs.map +7 -0
- package/dist/lib/node/identity-created-IMDS4A6A.cjs +44 -0
- package/dist/lib/node/identity-created-IMDS4A6A.cjs.map +7 -0
- package/dist/lib/node/index.cjs +175 -3506
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-S4HZABYI.cjs +458 -0
- package/dist/lib/node/intent-resolver-S4HZABYI.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-root-RB3OM3QG.cjs +50 -0
- package/dist/lib/node/react-root-RB3OM3QG.cjs.map +7 -0
- package/dist/lib/node/react-surface-TLKQEHHT.cjs +233 -0
- package/dist/lib/node/react-surface-TLKQEHHT.cjs.map +7 -0
- package/dist/lib/node/settings-QLCKAUHK.cjs +38 -0
- package/dist/lib/node/settings-QLCKAUHK.cjs.map +7 -0
- package/dist/lib/node/spaces-ready-RZTKEXOL.cjs +211 -0
- package/dist/lib/node/spaces-ready-RZTKEXOL.cjs.map +7 -0
- package/dist/lib/node/state-4UIOUKLJ.cjs +61 -0
- package/dist/lib/node/state-4UIOUKLJ.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +23 -14
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/app-graph-builder-CD6IYPSS.mjs +366 -0
- package/dist/lib/node-esm/app-graph-builder-CD6IYPSS.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-CFXS6ZE2.mjs +81 -0
- package/dist/lib/node-esm/app-graph-serializer-CFXS6ZE2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-375RB3CZ.mjs +22 -0
- package/dist/lib/node-esm/chunk-375RB3CZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7FUVU45N.mjs +14 -0
- package/dist/lib/node-esm/chunk-7FUVU45N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CLGCKZ2D.mjs +317 -0
- package/dist/lib/node-esm/chunk-CLGCKZ2D.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CMKML5IN.mjs +1673 -0
- package/dist/lib/node-esm/chunk-CMKML5IN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FUMGYUD3.mjs +524 -0
- package/dist/lib/node-esm/chunk-FUMGYUD3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M4XTHK35.mjs +134 -0
- package/dist/lib/node-esm/chunk-M4XTHK35.mjs.map +7 -0
- package/dist/lib/node-esm/identity-created-SJYZZ7Q3.mjs +29 -0
- package/dist/lib/node-esm/identity-created-SJYZZ7Q3.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +192 -3521
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-OIQH7HN7.mjs +460 -0
- package/dist/lib/node-esm/intent-resolver-OIQH7HN7.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-root-WKJWCHXR.mjs +29 -0
- package/dist/lib/node-esm/react-root-WKJWCHXR.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-RVEHOSAD.mjs +239 -0
- package/dist/lib/node-esm/react-surface-RVEHOSAD.mjs.map +7 -0
- package/dist/lib/node-esm/settings-WLVEO4JM.mjs +25 -0
- package/dist/lib/node-esm/settings-WLVEO4JM.mjs.map +7 -0
- package/dist/lib/node-esm/spaces-ready-ITGYYT5A.mjs +201 -0
- package/dist/lib/node-esm/spaces-ready-ITGYYT5A.mjs.map +7 -0
- package/dist/lib/node-esm/state-BMISGQ2O.mjs +48 -0
- package/dist/lib/node-esm/state-BMISGQ2O.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +14 -5
- package/dist/types/src/SpacePlugin.d.ts +1 -24
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +4 -0
- package/dist/types/src/capabilities/app-graph-serializer.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/identity-created.d.ts +4 -0
- package/dist/types/src/capabilities/identity-created.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +195 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +8 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +7 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -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/spaces-ready.d.ts +4 -0
- package/dist/types/src/capabilities/spaces-ready.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +5 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts +7 -0
- package/dist/types/src/components/AdvancedObjectSettings/AdvancedObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts +8 -0
- package/dist/types/src/components/AdvancedObjectSettings/ForeignKeys.d.ts.map +1 -0
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts +2 -0
- package/dist/types/src/components/AdvancedObjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/AwaitingObject.d.ts.map +1 -1
- package/dist/types/src/components/BaseObjectSettings.d.ts +7 -0
- package/dist/types/src/components/BaseObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts +5 -4
- package/dist/types/src/components/CreateDialog/CreateObjectDialog.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts +5 -6
- package/dist/types/src/components/CreateDialog/CreateObjectPanel.d.ts.map +1 -1
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts +1 -0
- package/dist/types/src/components/CreateDialog/CreateSpaceDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameObject.d.ts +1 -0
- package/dist/types/src/components/PopoverRenameObject.d.ts.map +1 -1
- package/dist/types/src/components/PopoverRenameSpace.d.ts +1 -0
- package/dist/types/src/components/PopoverRenameSpace.d.ts.map +1 -1
- package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -1
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.d.ts +9 -6
- package/dist/types/src/components/SpacePresence.d.ts.map +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts +1 -1
- package/dist/types/src/components/SpacePresence.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts +4 -3
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts.map +1 -1
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts +3 -3
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts +2 -2
- package/dist/types/src/components/SyncStatus/SyncStatusDetail.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +5 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/usePath.d.ts +11 -0
- package/dist/types/src/hooks/usePath.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -27
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +18 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/collection.d.ts +8 -12
- package/dist/types/src/types/collection.d.ts.map +1 -1
- package/dist/types/src/types/thread.d.ts +180 -186
- package/dist/types/src/types/thread.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +228 -16
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +9 -8
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +38 -46
- package/src/SpacePlugin.tsx +119 -1541
- package/src/capabilities/app-graph-builder.ts +392 -0
- package/src/capabilities/app-graph-serializer.ts +73 -0
- package/src/capabilities/capabilities.ts +23 -0
- package/src/capabilities/identity-created.ts +26 -0
- package/src/capabilities/index.ts +17 -0
- package/src/capabilities/intent-resolver.ts +420 -0
- package/src/capabilities/react-root.tsx +20 -0
- package/src/capabilities/react-surface.tsx +234 -0
- package/src/capabilities/settings.ts +17 -0
- package/src/capabilities/spaces-ready.ts +231 -0
- package/src/capabilities/state.ts +45 -0
- package/src/components/AdvancedObjectSettings/AdvancedObjectSettings.tsx +72 -0
- package/src/components/AdvancedObjectSettings/ForeignKeys.tsx +51 -0
- package/src/components/AdvancedObjectSettings/index.ts +5 -0
- package/src/components/AwaitingObject.tsx +15 -19
- package/src/components/{DefaultObjectSettings.tsx → BaseObjectSettings.tsx} +2 -2
- package/src/components/CreateDialog/CreateObjectDialog.tsx +36 -25
- package/src/components/CreateDialog/CreateObjectPanel.tsx +61 -24
- package/src/components/CreateDialog/CreateSpaceDialog.tsx +10 -14
- package/src/components/JoinDialog.tsx +18 -34
- package/src/components/PersistenceStatus.tsx +1 -1
- package/src/components/PopoverRenameObject.tsx +2 -0
- package/src/components/PopoverRenameSpace.tsx +2 -0
- package/src/components/ShareSpaceButton.tsx +5 -4
- package/src/components/SpacePluginSettings.tsx +2 -13
- package/src/components/SpacePresence.stories.tsx +25 -17
- package/src/components/SpacePresence.tsx +42 -21
- package/src/components/SpaceSettings/SpaceSettingsDialog.stories.tsx +2 -3
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +3 -1
- package/src/components/SpaceSettings/SpaceSettingsPanel.stories.tsx +7 -5
- package/src/components/SpaceSettings/SpaceSettingsPanel.tsx +6 -5
- package/src/components/SyncStatus/InlineSyncStatus.tsx +37 -27
- package/src/components/SyncStatus/SyncStatusDetail.stories.tsx +55 -51
- package/src/components/index.ts +2 -1
- package/src/events.ts +12 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/usePath.ts +44 -0
- package/src/index.ts +3 -7
- package/src/meta.ts +1 -29
- package/src/translations.ts +7 -2
- package/src/types/collection.ts +3 -3
- package/src/types/thread.ts +6 -6
- package/src/types/types.ts +177 -42
- package/src/util.tsx +77 -64
- package/dist/lib/browser/chunk-FTKV32QZ.mjs +0 -43
- package/dist/lib/browser/chunk-FTKV32QZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-MWKXNS5S.mjs +0 -124
- package/dist/lib/browser/chunk-MWKXNS5S.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -15
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/chunk-6SNOZF7Y.cjs +0 -152
- package/dist/lib/node/chunk-6SNOZF7Y.cjs.map +0 -7
- package/dist/lib/node/chunk-QNVEU2UD.cjs +0 -69
- package/dist/lib/node/chunk-QNVEU2UD.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-OHEAWSCA.mjs +0 -126
- package/dist/lib/node-esm/chunk-OHEAWSCA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMV7XREB.mjs +0 -45
- package/dist/lib/node-esm/chunk-UMV7XREB.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -16
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/components/DefaultObjectSettings.d.ts +0 -7
- package/dist/types/src/components/DefaultObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts +0 -6
- package/dist/types/src/components/SyncStatus/InlineSyncStatus.stories.d.ts.map +0 -1
- package/src/components/SyncStatus/InlineSyncStatus.stories.tsx +0 -57
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type
|
|
7
|
+
import { Surface, isSurfaceAvailable, usePluginManager } from '@dxos/app-framework';
|
|
8
|
+
import { type TypedObject, getObjectAnnotation, S } from '@dxos/echo-schema';
|
|
9
9
|
import { type SpaceId, type Space, isSpace } from '@dxos/react-client/echo';
|
|
10
10
|
import { Icon, IconButton, Input, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { Form, InputHeader } from '@dxos/react-ui-form';
|
|
11
|
+
import { Form, InputHeader, type InputProps } from '@dxos/react-ui-form';
|
|
12
12
|
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
13
13
|
import { nonNullable, type MaybePromise } from '@dxos/util';
|
|
14
14
|
|
|
@@ -17,20 +17,43 @@ import { type CollectionType } from '../../types';
|
|
|
17
17
|
import { getSpaceDisplayName } from '../../util';
|
|
18
18
|
|
|
19
19
|
export type CreateObjectPanelProps = {
|
|
20
|
-
schemas:
|
|
20
|
+
schemas: TypedObject[];
|
|
21
21
|
spaces: Space[];
|
|
22
22
|
typename?: string;
|
|
23
23
|
target?: Space | CollectionType;
|
|
24
24
|
name?: string;
|
|
25
25
|
defaultSpaceId?: SpaceId;
|
|
26
|
-
resolve?:
|
|
26
|
+
resolve?: (typename: string) => Record<string, any>;
|
|
27
27
|
onCreateObject?: (params: {
|
|
28
|
-
schema:
|
|
28
|
+
schema: TypedObject;
|
|
29
29
|
target: Space | CollectionType;
|
|
30
|
-
|
|
30
|
+
data: Record<string, any>;
|
|
31
31
|
}) => MaybePromise<void>;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// TODO(ZaymonFC): Move this if you find yourself needing it elsewhere.
|
|
35
|
+
/**
|
|
36
|
+
* Creates a surface input component based on plugin context.
|
|
37
|
+
* @param baseData Additional data that will be merged with form data and passed to the surface.
|
|
38
|
+
* This allows providing more context to the surface than what's available from the form itself.
|
|
39
|
+
*/
|
|
40
|
+
const useInputSurfaceLookup = (baseData?: Record<string, any>) => {
|
|
41
|
+
const pluginManager = usePluginManager();
|
|
42
|
+
|
|
43
|
+
return useCallback(
|
|
44
|
+
({ prop, schema, inputProps }: { prop: string; schema: S.Schema<any>; inputProps: InputProps<any> }) => {
|
|
45
|
+
const composedData = { prop, schema, ...baseData };
|
|
46
|
+
|
|
47
|
+
if (!isSurfaceAvailable(pluginManager.context, { role: 'form-input', data: composedData })) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return <Surface role='form-input' data={composedData} {...inputProps} />;
|
|
52
|
+
},
|
|
53
|
+
[pluginManager, baseData],
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
34
57
|
export const CreateObjectPanel = ({
|
|
35
58
|
schemas,
|
|
36
59
|
spaces,
|
|
@@ -51,19 +74,25 @@ export const CreateObjectPanel = ({
|
|
|
51
74
|
const handleClearTarget = useCallback(() => setTarget(undefined), []);
|
|
52
75
|
|
|
53
76
|
const handleCreateObject = useCallback(
|
|
54
|
-
async (
|
|
77
|
+
async (props: Record<string, any>) => {
|
|
55
78
|
if (!schema || !target) {
|
|
56
79
|
return;
|
|
57
80
|
}
|
|
58
|
-
|
|
59
|
-
await onCreateObject?.({ schema, target, name });
|
|
81
|
+
await onCreateObject?.({ schema, target, data: props });
|
|
60
82
|
},
|
|
61
83
|
[onCreateObject, schema, target],
|
|
62
84
|
);
|
|
63
85
|
|
|
86
|
+
const metadata = useMemo(() => {
|
|
87
|
+
if (!typename) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
return resolve?.(typename);
|
|
91
|
+
}, [resolve, typename]);
|
|
92
|
+
|
|
64
93
|
// TODO(wittjosiah): All of these inputs should be rolled into a `Form` once it supports the necessary variants.
|
|
65
94
|
const schemaInput = (
|
|
66
|
-
<SearchList.Root label={t('schema input label')} classNames='flex flex-col grow overflow-hidden
|
|
95
|
+
<SearchList.Root label={t('schema input label')} classNames='flex flex-col grow overflow-hidden'>
|
|
67
96
|
<SearchList.Input
|
|
68
97
|
autoFocus
|
|
69
98
|
data-testid='create-object-form.schema-input'
|
|
@@ -89,7 +118,7 @@ export const CreateObjectPanel = ({
|
|
|
89
118
|
);
|
|
90
119
|
|
|
91
120
|
const spaceInput = (
|
|
92
|
-
<SearchList.Root label={t('space input label')} classNames='flex flex-col grow overflow-hidden
|
|
121
|
+
<SearchList.Root label={t('space input label')} classNames='flex flex-col grow overflow-hidden'>
|
|
93
122
|
<SearchList.Input
|
|
94
123
|
autoFocus
|
|
95
124
|
data-testid='create-object-form.space-input'
|
|
@@ -113,20 +142,28 @@ export const CreateObjectPanel = ({
|
|
|
113
142
|
</SearchList.Root>
|
|
114
143
|
);
|
|
115
144
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
145
|
+
const inputSurfaceLookup = useInputSurfaceLookup({ target });
|
|
146
|
+
|
|
147
|
+
const form = useMemo(() => {
|
|
148
|
+
// TODO(ZaymonFC): Move this default object creation schema somewhere?
|
|
149
|
+
const schema = (metadata?.creationSchema ?? S.Struct({ name: S.optional(S.String) })) as S.Schema<any>;
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Form
|
|
153
|
+
autoFocus
|
|
154
|
+
values={{ name: initialName }}
|
|
155
|
+
schema={schema}
|
|
156
|
+
testId='create-object-form'
|
|
157
|
+
onSave={handleCreateObject}
|
|
158
|
+
lookupComponent={inputSurfaceLookup}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}, [initialName, handleCreateObject, metadata]);
|
|
125
162
|
|
|
126
163
|
return (
|
|
127
164
|
<div role='form' className='flex flex-col gap-2'>
|
|
128
165
|
{target && (
|
|
129
|
-
<div role='none'
|
|
166
|
+
<div role='none'>
|
|
130
167
|
<Input.Root>
|
|
131
168
|
<InputHeader>
|
|
132
169
|
<Input.Label>
|
|
@@ -148,7 +185,7 @@ export const CreateObjectPanel = ({
|
|
|
148
185
|
</div>
|
|
149
186
|
)}
|
|
150
187
|
{schema && (
|
|
151
|
-
<div role='none'
|
|
188
|
+
<div role='none'>
|
|
152
189
|
<Input.Root>
|
|
153
190
|
<InputHeader>
|
|
154
191
|
<Input.Label>{t('creating object type label')}</Input.Label>
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
7
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { type S } from '@dxos/echo-schema';
|
|
9
9
|
import { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { Form } from '@dxos/react-ui-form';
|
|
11
11
|
|
|
12
|
-
import { SPACE_PLUGIN
|
|
13
|
-
import { SpaceForm } from '../../types';
|
|
12
|
+
import { SPACE_PLUGIN } from '../../meta';
|
|
13
|
+
import { SpaceAction, SpaceForm } from '../../types';
|
|
14
|
+
|
|
15
|
+
export const CREATE_SPACE_DIALOG = `${SPACE_PLUGIN}/CreateSpaceDialog`;
|
|
14
16
|
|
|
15
17
|
type FormValues = S.Schema.Type<typeof SpaceForm>;
|
|
16
18
|
const initialValues: FormValues = { edgeReplication: true };
|
|
@@ -18,20 +20,14 @@ const initialValues: FormValues = { edgeReplication: true };
|
|
|
18
20
|
export const CreateSpaceDialog = () => {
|
|
19
21
|
const closeRef = useRef<HTMLButtonElement | null>(null);
|
|
20
22
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
21
|
-
const dispatch = useIntentDispatcher();
|
|
23
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
24
|
|
|
23
25
|
const handleCreateSpace = useCallback(
|
|
24
26
|
async (data: FormValues) => {
|
|
25
|
-
const result = await dispatch(
|
|
26
|
-
|
|
27
|
-
data,
|
|
28
|
-
});
|
|
29
|
-
const target = result?.data.space;
|
|
27
|
+
const result = await dispatch(createIntent(SpaceAction.Create, data));
|
|
28
|
+
const target = result.data?.space;
|
|
30
29
|
if (target) {
|
|
31
|
-
await dispatch({
|
|
32
|
-
action: SpaceAction.OPEN_CREATE_OBJECT,
|
|
33
|
-
data: { target },
|
|
34
|
-
});
|
|
30
|
+
await dispatch(createIntent(SpaceAction.OpenCreateObject, { target }));
|
|
35
31
|
}
|
|
36
32
|
},
|
|
37
33
|
[dispatch],
|
|
@@ -41,7 +37,7 @@ export const CreateSpaceDialog = () => {
|
|
|
41
37
|
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
42
38
|
// Consider factoring it out to the tabs package.
|
|
43
39
|
<Dialog.Content classNames='p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>
|
|
44
|
-
<div role='none' className='flex justify-between pbs-
|
|
40
|
+
<div role='none' className='flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4'>
|
|
45
41
|
<Dialog.Title>{t('create space dialog title')}</Dialog.Title>
|
|
46
42
|
<Dialog.Close asChild>
|
|
47
43
|
<Button ref={closeRef} density='fine' variant='ghost' autoFocus>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { LayoutAction, NavigationAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
7
|
+
import { createIntent, LayoutAction, NavigationAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { useGraph } from '@dxos/plugin-graph';
|
|
9
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/
|
|
9
|
+
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
10
10
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
11
11
|
import { type InvitationResult } from '@dxos/react-client/invitations';
|
|
12
12
|
import { Dialog, useTranslation } from '@dxos/react-ui';
|
|
@@ -14,13 +14,15 @@ import { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';
|
|
|
14
14
|
|
|
15
15
|
import { SPACE_PLUGIN } from '../meta';
|
|
16
16
|
|
|
17
|
+
export const JOIN_DIALOG = `${SPACE_PLUGIN}/JoinDialog`;
|
|
18
|
+
|
|
17
19
|
export type JoinDialogProps = JoinPanelProps & {
|
|
18
20
|
navigableCollections?: boolean;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const JoinDialog = ({ navigableCollections, onDone, ...props }: JoinDialogProps) => {
|
|
22
24
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
23
|
-
const dispatch = useIntentDispatcher();
|
|
25
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
24
26
|
const spaces = useSpaces();
|
|
25
27
|
const { graph } = useGraph();
|
|
26
28
|
|
|
@@ -28,9 +30,8 @@ export const JoinDialog = ({ navigableCollections, onDone, ...props }: JoinDialo
|
|
|
28
30
|
async (result: InvitationResult | null) => {
|
|
29
31
|
if (result?.spaceKey) {
|
|
30
32
|
await Promise.all([
|
|
31
|
-
dispatch(
|
|
32
|
-
|
|
33
|
-
data: {
|
|
33
|
+
dispatch(
|
|
34
|
+
createIntent(LayoutAction.SetLayout, {
|
|
34
35
|
element: 'toast',
|
|
35
36
|
subject: {
|
|
36
37
|
id: `${SPACE_PLUGIN}/join-success`,
|
|
@@ -38,15 +39,14 @@ export const JoinDialog = ({ navigableCollections, onDone, ...props }: JoinDialo
|
|
|
38
39
|
title: t('join success label'),
|
|
39
40
|
closeLabel: t('dismiss label'),
|
|
40
41
|
},
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
dispatch(
|
|
44
|
-
|
|
45
|
-
data: {
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
44
|
+
dispatch(
|
|
45
|
+
createIntent(LayoutAction.SetLayout, {
|
|
46
46
|
element: 'dialog',
|
|
47
47
|
state: false,
|
|
48
|
-
},
|
|
49
|
-
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
50
|
]);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -60,33 +60,17 @@ export const JoinDialog = ({ navigableCollections, onDone, ...props }: JoinDialo
|
|
|
60
60
|
// If the target has not yet replicated, this will trigger a loading toast.
|
|
61
61
|
await graph.waitForPath({ target }).catch(() => {});
|
|
62
62
|
await Promise.all([
|
|
63
|
-
dispatch({
|
|
64
|
-
|
|
65
|
-
data: {
|
|
66
|
-
activeParts: { main: [target] },
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
dispatch({
|
|
70
|
-
action: NavigationAction.EXPOSE,
|
|
71
|
-
data: {
|
|
72
|
-
id: target,
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
63
|
+
dispatch(createIntent(NavigationAction.Open, { activeParts: { main: [target] } })),
|
|
64
|
+
dispatch(createIntent(NavigationAction.Expose, { id: target })),
|
|
75
65
|
]);
|
|
76
66
|
}
|
|
77
67
|
|
|
78
68
|
await onDone?.(result);
|
|
79
69
|
|
|
80
70
|
if (space) {
|
|
81
|
-
await dispatch(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
name: 'space.join',
|
|
85
|
-
properties: {
|
|
86
|
-
spaceId: space.id,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
});
|
|
71
|
+
await dispatch(
|
|
72
|
+
createIntent(ObservabilityAction.SendEvent, { name: 'space.join', properties: { spaceId: space.id } }),
|
|
73
|
+
);
|
|
90
74
|
}
|
|
91
75
|
},
|
|
92
76
|
[dispatch, spaces],
|
|
@@ -10,6 +10,8 @@ import { Button, Input, Popover, useTranslation } from '@dxos/react-ui';
|
|
|
10
10
|
|
|
11
11
|
import { SPACE_PLUGIN } from '../meta';
|
|
12
12
|
|
|
13
|
+
export const POPOVER_RENAME_OBJECT = `${SPACE_PLUGIN}/PopoverRenameObject`;
|
|
14
|
+
|
|
13
15
|
export const PopoverRenameObject = ({ object: obj }: { object: ReactiveObject<any> }) => {
|
|
14
16
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
15
17
|
const doneButton = useRef<HTMLButtonElement>(null);
|
|
@@ -9,6 +9,8 @@ import { Button, Input, Popover, useTranslation } from '@dxos/react-ui';
|
|
|
9
9
|
|
|
10
10
|
import { SPACE_PLUGIN } from '../meta';
|
|
11
11
|
|
|
12
|
+
export const POPOVER_RENAME_SPACE = `${SPACE_PLUGIN}/PopoverRenameSpace`;
|
|
13
|
+
|
|
12
14
|
export const PopoverRenameSpace = ({ space }: { space: Space }) => {
|
|
13
15
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
14
16
|
const doneButton = useRef<HTMLButtonElement>(null);
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
7
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { type Space } from '@dxos/react-client/echo';
|
|
9
9
|
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
|
-
import { SPACE_PLUGIN
|
|
11
|
+
import { SPACE_PLUGIN } from '../meta';
|
|
12
|
+
import { SpaceAction } from '../types';
|
|
12
13
|
|
|
13
14
|
export const ShareSpaceButton = ({ space }: { space: Space }) => {
|
|
14
|
-
const dispatch = useIntentDispatcher();
|
|
15
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
15
16
|
|
|
16
|
-
return <ShareSpaceButtonImpl onClick={() => dispatch(
|
|
17
|
+
return <ShareSpaceButtonImpl onClick={() => dispatch(createIntent(SpaceAction.Share, { space }))} />;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
// TODO(wittjosiah): Better way to name pure/impure components?
|
|
@@ -4,30 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
8
7
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
9
8
|
import { DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
10
9
|
|
|
11
|
-
import {
|
|
10
|
+
import { SPACE_PLUGIN } from '../meta';
|
|
12
11
|
import { type SpaceSettingsProps } from '../types';
|
|
13
12
|
|
|
14
13
|
export const SpacePluginSettings = ({ settings }: { settings: SpaceSettingsProps }) => {
|
|
15
14
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
16
|
-
const dispatch = useIntentDispatcher();
|
|
17
15
|
|
|
18
16
|
return (
|
|
19
17
|
<>
|
|
20
18
|
<DeprecatedFormInput label={t('show hidden spaces label')}>
|
|
21
|
-
<Input.Switch
|
|
22
|
-
checked={settings.showHidden}
|
|
23
|
-
onCheckedChange={(checked) =>
|
|
24
|
-
dispatch({
|
|
25
|
-
plugin: SPACE_PLUGIN,
|
|
26
|
-
action: SpaceAction.TOGGLE_HIDDEN,
|
|
27
|
-
data: { state: !!checked },
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
/>
|
|
19
|
+
<Input.Switch checked={settings.showHidden} onCheckedChange={(checked) => (settings.showHidden = !!checked)} />
|
|
31
20
|
</DeprecatedFormInput>
|
|
32
21
|
</>
|
|
33
22
|
);
|
|
@@ -61,30 +61,38 @@ export const Full = (props: MemberPresenceProps) => {
|
|
|
61
61
|
);
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
export const Small = (
|
|
65
|
-
const p: MemberPresenceProps = {
|
|
66
|
-
...props,
|
|
67
|
-
};
|
|
68
|
-
|
|
64
|
+
export const Small = () => {
|
|
69
65
|
return (
|
|
70
66
|
<div className='p-4'>
|
|
71
|
-
<div className='p-3'>
|
|
72
|
-
<SmallPresence count={0}
|
|
67
|
+
<div className='flex gap-3 p-3'>
|
|
68
|
+
<SmallPresence count={0} />
|
|
69
|
+
<SmallPresence count={0} attended />
|
|
70
|
+
<SmallPresence count={0} containsAttended />
|
|
73
71
|
</div>
|
|
74
|
-
<div className='p-3'>
|
|
75
|
-
<SmallPresence count={1}
|
|
72
|
+
<div className='flex gap-3 p-3'>
|
|
73
|
+
<SmallPresence count={1} />
|
|
74
|
+
<SmallPresence count={1} attended />
|
|
75
|
+
<SmallPresence count={1} containsAttended />
|
|
76
76
|
</div>
|
|
77
|
-
<div className='p-3'>
|
|
78
|
-
<SmallPresence count={2}
|
|
77
|
+
<div className='flex gap-3 p-3'>
|
|
78
|
+
<SmallPresence count={2} />
|
|
79
|
+
<SmallPresence count={2} attended />
|
|
80
|
+
<SmallPresence count={2} containsAttended />
|
|
79
81
|
</div>
|
|
80
|
-
<div className='p-3'>
|
|
81
|
-
<SmallPresence count={3}
|
|
82
|
+
<div className='flex gap-3 p-3'>
|
|
83
|
+
<SmallPresence count={3} />
|
|
84
|
+
<SmallPresence count={3} attended />
|
|
85
|
+
<SmallPresence count={3} containsAttended />
|
|
82
86
|
</div>
|
|
83
|
-
<div className='p-3'>
|
|
84
|
-
<SmallPresence count={4}
|
|
87
|
+
<div className='flex gap-3 p-3'>
|
|
88
|
+
<SmallPresence count={4} />
|
|
89
|
+
<SmallPresence count={4} attended />
|
|
90
|
+
<SmallPresence count={4} containsAttended />
|
|
85
91
|
</div>
|
|
86
|
-
<div className='p-3'>
|
|
87
|
-
<SmallPresence count={5}
|
|
92
|
+
<div className='flex gap-3 p-3'>
|
|
93
|
+
<SmallPresence count={5} />
|
|
94
|
+
<SmallPresence count={5} attended />
|
|
95
|
+
<SmallPresence count={5} containsAttended />
|
|
88
96
|
</div>
|
|
89
97
|
</div>
|
|
90
98
|
);
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { generateName } from '@dxos/display-name';
|
|
9
9
|
import { type Expando } from '@dxos/echo-schema';
|
|
10
|
+
import { useGraph } from '@dxos/plugin-graph';
|
|
10
11
|
import { PublicKey, useClient } from '@dxos/react-client';
|
|
11
12
|
import { getSpace, useMembers, type SpaceMember, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
12
13
|
import { type Identity, useIdentity } from '@dxos/react-client/halo';
|
|
@@ -22,11 +23,13 @@ import {
|
|
|
22
23
|
ListItem,
|
|
23
24
|
useDefaultValue,
|
|
24
25
|
} from '@dxos/react-ui';
|
|
25
|
-
import { AttentionGlyph, useAttention } from '@dxos/react-ui-attention';
|
|
26
|
+
import { AttentionGlyph, useAttended, useAttention, type AttentionGlyphProps } from '@dxos/react-ui-attention';
|
|
26
27
|
import { ComplexMap, keyToFallback } from '@dxos/util';
|
|
27
28
|
|
|
29
|
+
import { SpaceCapabilities } from '../capabilities';
|
|
30
|
+
import { usePath } from '../hooks';
|
|
28
31
|
import { SPACE_PLUGIN } from '../meta';
|
|
29
|
-
import type { ObjectViewerProps
|
|
32
|
+
import type { ObjectViewerProps } from '../types';
|
|
30
33
|
|
|
31
34
|
// TODO(thure): Get/derive these values from protocol
|
|
32
35
|
const REFRESH_INTERVAL = 5000;
|
|
@@ -39,7 +42,8 @@ const noViewers = new ComplexMap<PublicKey, ObjectViewerProps>(PublicKey.hash);
|
|
|
39
42
|
const getName = (identity: Identity) => identity.profile?.displayName ?? generateName(identity.identityKey.toHex());
|
|
40
43
|
|
|
41
44
|
export const SpacePresence = ({ object, spaceKey }: { object: Expando; spaceKey?: PublicKey }) => {
|
|
42
|
-
|
|
45
|
+
// TODO(wittjosiah): Doesn't need to be mutable but readonly type messes with ComplexMap.
|
|
46
|
+
const spaceState = useCapability(SpaceCapabilities.MutableState);
|
|
43
47
|
const client = useClient();
|
|
44
48
|
const identity = useIdentity();
|
|
45
49
|
const space = spaceKey ? client.spaces.get(spaceKey) : getSpace(object);
|
|
@@ -61,11 +65,10 @@ export const SpacePresence = ({ object, spaceKey }: { object: Expando; spaceKey?
|
|
|
61
65
|
|
|
62
66
|
// TODO(thure): Could it be a smell to return early when there are interactions with `deepSignal` later, since it
|
|
63
67
|
// prevents reactivity?
|
|
64
|
-
if (!identity || !
|
|
68
|
+
if (!identity || !spaceState || !space) {
|
|
65
69
|
return null;
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
const spaceState = spacePlugin.provides.space;
|
|
69
72
|
const currentObjectViewers = spaceState.viewersByObject[fullyQualifiedId(object)] ?? noViewers;
|
|
70
73
|
|
|
71
74
|
const membersForObject = spaceMembers
|
|
@@ -194,16 +197,30 @@ const PrensenceAvatar = ({ identity, showName, match, group, index, onClick }: P
|
|
|
194
197
|
);
|
|
195
198
|
};
|
|
196
199
|
|
|
197
|
-
export
|
|
198
|
-
id,
|
|
199
|
-
viewers,
|
|
200
|
-
}: {
|
|
200
|
+
export type SmallPresenceLiveProps = {
|
|
201
201
|
id?: string;
|
|
202
|
+
open?: boolean;
|
|
202
203
|
viewers?: ComplexMap<PublicKey, ObjectViewerProps>;
|
|
203
|
-
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const SmallPresenceLive = ({ id, open, viewers }: SmallPresenceLiveProps) => {
|
|
207
|
+
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
208
|
+
const isAttended = hasAttention || isAncestor || isRelated;
|
|
209
|
+
|
|
210
|
+
// TODO(wittjosiah): If the attended node is deep in the graph and the graph is not fully loaded
|
|
211
|
+
// this will result in an empty path until the graph is connected.
|
|
212
|
+
// TODO(wittjosiah): Consider using this indicator for all open nodes instead of just attended.
|
|
213
|
+
const { graph } = useGraph();
|
|
214
|
+
const attended = useAttended();
|
|
215
|
+
const startOfAttention = attended.at(-1);
|
|
216
|
+
const path = usePath(graph, startOfAttention);
|
|
217
|
+
const containsAttended = !open && !isAttended && id && path ? path.includes(id) : false;
|
|
218
|
+
|
|
204
219
|
const getActiveViewers = (viewers: ComplexMap<PublicKey, ObjectViewerProps>): ObjectViewerProps[] => {
|
|
205
220
|
const moment = Date.now();
|
|
206
|
-
return Array.from(viewers.values()).filter(
|
|
221
|
+
return Array.from<ObjectViewerProps>(viewers.values()).filter(
|
|
222
|
+
(viewer) => moment - viewer.lastSeen < ACTIVITY_DURATION,
|
|
223
|
+
);
|
|
207
224
|
};
|
|
208
225
|
|
|
209
226
|
const [activeViewers, setActiveViewers] = useState(viewers ? getActiveViewers(viewers) : []);
|
|
@@ -218,24 +235,28 @@ export const SmallPresenceLive = ({
|
|
|
218
235
|
}
|
|
219
236
|
}, [viewers]);
|
|
220
237
|
|
|
221
|
-
return <SmallPresence
|
|
238
|
+
return <SmallPresence count={activeViewers.length} attended={isAttended} containsAttended={containsAttended} />;
|
|
222
239
|
};
|
|
223
240
|
|
|
224
|
-
export
|
|
241
|
+
export type SmallPresenceProps = {
|
|
242
|
+
count?: number;
|
|
243
|
+
} & Pick<AttentionGlyphProps, 'attended' | 'containsAttended'>;
|
|
244
|
+
|
|
245
|
+
export const SmallPresence = ({ count = 0, attended, containsAttended }: SmallPresenceProps) => {
|
|
225
246
|
const { t } = useTranslation(SPACE_PLUGIN);
|
|
226
|
-
const { hasAttention, isAncestor, isRelated } = useAttention(id);
|
|
227
|
-
const attention = hasAttention || isAncestor || isRelated;
|
|
228
247
|
|
|
229
248
|
return (
|
|
230
249
|
<Tooltip.Root>
|
|
231
250
|
<Tooltip.Trigger asChild>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
251
|
+
<AttentionGlyph
|
|
252
|
+
attended={attended}
|
|
253
|
+
containsAttended={containsAttended}
|
|
254
|
+
presence={count > 1 ? 'many' : count === 1 ? 'one' : 'none'}
|
|
255
|
+
classNames='self-center mie-1'
|
|
256
|
+
/>
|
|
236
257
|
</Tooltip.Trigger>
|
|
237
258
|
<Tooltip.Portal>
|
|
238
|
-
<Tooltip.Content side='bottom'
|
|
259
|
+
<Tooltip.Content side='bottom'>
|
|
239
260
|
<span>{t('presence label', { count })}</span>
|
|
240
261
|
<Tooltip.Arrow />
|
|
241
262
|
</Tooltip.Content>
|
|
@@ -7,7 +7,7 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
11
11
|
import { Dialog } from '@dxos/react-ui';
|
|
12
12
|
import { osTranslations } from '@dxos/shell/react';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -16,8 +16,7 @@ import { SpaceSettingsDialog, type SpaceSettingsDialogProps } from './SpaceSetti
|
|
|
16
16
|
import translations from '../../translations';
|
|
17
17
|
|
|
18
18
|
const Story = (args: Partial<SpaceSettingsDialogProps>) => {
|
|
19
|
-
const { space } =
|
|
20
|
-
|
|
19
|
+
const { space } = useClientProvider();
|
|
21
20
|
return (
|
|
22
21
|
<Dialog.Root open>
|
|
23
22
|
<Dialog.Overlay blockAlign='start'>
|
|
@@ -13,6 +13,8 @@ import { SpaceSettingsPanel, type SpaceSettingsPanelProps } from './SpaceSetting
|
|
|
13
13
|
import { SPACE_PLUGIN } from '../../meta';
|
|
14
14
|
import { COMPOSER_SPACE_LOCK, getSpaceDisplayName } from '../../util';
|
|
15
15
|
|
|
16
|
+
export const SPACE_SETTINGS_DIALOG = `${SPACE_PLUGIN}/SpaceSettingsDialog`;
|
|
17
|
+
|
|
16
18
|
export type SpaceSettingsTab = 'members' | 'settings';
|
|
17
19
|
|
|
18
20
|
export type SpaceSettingsDialogProps = {
|
|
@@ -39,7 +41,7 @@ export const SpaceSettingsDialog = ({
|
|
|
39
41
|
// TODO(wittjosiah): The tablist dialog pattern is copied from @dxos/plugin-manager.
|
|
40
42
|
// Consider factoring it out to the tabs package.
|
|
41
43
|
<Dialog.Content classNames='p-0 bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>
|
|
42
|
-
<div role='none' className='flex justify-between pbs-
|
|
44
|
+
<div role='none' className='flex justify-between pbs-2 pis-2 pie-2 @md:pbs-4 @md:pis-4 @md:pie-4'>
|
|
43
45
|
<Dialog.Title
|
|
44
46
|
onClick={() => setTabsActivePart('list')}
|
|
45
47
|
aria-description={t('click to return to tablist description')}
|
|
@@ -7,16 +7,15 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
|
|
11
11
|
import { withTheme } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
13
13
|
import { SpaceSettingsPanel, type SpaceSettingsPanelProps } from './SpaceSettingsPanel';
|
|
14
14
|
import translations from '../../translations';
|
|
15
15
|
|
|
16
16
|
const Story = (args: Partial<SpaceSettingsPanelProps>) => {
|
|
17
|
-
const { space } =
|
|
18
|
-
|
|
19
|
-
return <SpaceSettingsPanel {...args} space={space!} />;
|
|
17
|
+
const { space } = useClientProvider();
|
|
18
|
+
return <SpaceSettingsPanel {...args} space={space!} classNames='p-2 border border-primary-500 rounded' />;
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
const meta: Meta = {
|
|
@@ -24,7 +23,10 @@ const meta: Meta = {
|
|
|
24
23
|
component: SpaceSettingsPanel,
|
|
25
24
|
render: Story,
|
|
26
25
|
decorators: [withClientProvider({ createIdentity: true, createSpace: true }), withTheme],
|
|
27
|
-
parameters: {
|
|
26
|
+
parameters: {
|
|
27
|
+
translations,
|
|
28
|
+
layout: 'centered',
|
|
29
|
+
},
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
export default meta;
|