@dxos/plugin-space 0.6.14-main.8b352a0 → 0.6.14-staging.3e2eaca
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/{chunk-AVLRQF6L.mjs → chunk-DJE2HYFV.mjs} +3 -2
- package/dist/lib/browser/{chunk-AVLRQF6L.mjs.map → chunk-DJE2HYFV.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-FOI7DAUV.mjs → chunk-OWZKSWMX.mjs} +1 -1
- package/dist/lib/browser/{chunk-FOI7DAUV.mjs.map → chunk-OWZKSWMX.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +817 -762
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-OTDRTHT4.cjs → chunk-FYWGZYJB.cjs} +4 -4
- package/dist/lib/node/{chunk-OTDRTHT4.cjs.map → chunk-FYWGZYJB.cjs.map} +2 -2
- package/dist/lib/node/{chunk-P4XUXM7Y.cjs → chunk-JFDDZI4Y.cjs} +6 -5
- package/dist/lib/node/{chunk-P4XUXM7Y.cjs.map → chunk-JFDDZI4Y.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +1009 -957
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +5 -5
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +11 -11
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-YPQGKWHJ.mjs → chunk-DVUZ7A7G.mjs} +3 -2
- package/dist/lib/node-esm/{chunk-YPQGKWHJ.mjs.map → chunk-DVUZ7A7G.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-FYDGMPSC.mjs → chunk-MCEAI4CV.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-FYDGMPSC.mjs.map → chunk-MCEAI4CV.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +817 -762
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/SpacePlugin.d.ts +9 -1
- package/dist/types/src/SpacePlugin.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +7 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -0
- package/dist/types/src/components/ShareSpaceButton.d.ts +3 -2
- package/dist/types/src/components/ShareSpaceButton.d.ts.map +1 -1
- package/dist/types/src/components/{SpaceSettings.d.ts → SpacePluginSettings.d.ts} +2 -2
- package/dist/types/src/components/SpacePluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts +10 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts +7 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts +7 -0
- package/dist/types/src/components/SpaceSettings/SpaceSettingsPanel.stories.d.ts.map +1 -0
- package/dist/types/src/components/SpaceSettings/index.d.ts +3 -0
- package/dist/types/src/components/SpaceSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/Space.d.ts +8 -0
- package/dist/types/src/components/SyncStatus/Space.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts +3 -2
- package/dist/types/src/components/SyncStatus/SyncStatus.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts +5 -20
- package/dist/types/src/components/SyncStatus/SyncStatus.stories.d.ts.map +1 -1
- package/dist/types/src/components/SyncStatus/save-tracker.d.ts +3 -0
- package/dist/types/src/components/SyncStatus/save-tracker.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/status.d.ts +9 -0
- package/dist/types/src/components/SyncStatus/status.d.ts.map +1 -0
- package/dist/types/src/components/SyncStatus/{types.d.ts → sync-state.d.ts} +1 -1
- package/dist/types/src/components/SyncStatus/sync-state.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +7 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +8 -4
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +35 -33
- package/src/SpacePlugin.tsx +279 -175
- package/src/components/AwaitingObject.tsx +1 -1
- package/src/components/JoinDialog.tsx +100 -0
- package/src/components/ShareSpaceButton.tsx +10 -6
- package/src/components/{SpaceSettings.tsx → SpacePluginSettings.tsx} +6 -6
- package/src/components/SpaceSettings/SpaceSettingsDialog.stories.tsx +44 -0
- package/src/components/SpaceSettings/SpaceSettingsDialog.tsx +103 -0
- package/src/components/SpaceSettings/SpaceSettingsPanel.stories.tsx +32 -0
- package/src/components/{SpaceSettingsPanel.tsx → SpaceSettings/SpaceSettingsPanel.tsx} +25 -20
- package/src/components/SpaceSettings/index.ts +6 -0
- package/src/components/SyncStatus/Space.tsx +109 -0
- package/src/components/SyncStatus/SyncStatus.stories.tsx +13 -4
- package/src/components/SyncStatus/SyncStatus.tsx +43 -129
- package/src/components/{SaveStatus.tsx → SyncStatus/save-tracker.ts} +1 -25
- package/src/components/SyncStatus/status.ts +44 -0
- package/src/components/index.ts +2 -4
- package/src/meta.ts +2 -1
- package/src/translations.ts +10 -0
- package/src/types/types.ts +9 -1
- package/src/util.tsx +51 -23
- package/dist/types/src/components/MissingObject.d.ts +0 -5
- package/dist/types/src/components/MissingObject.d.ts.map +0 -1
- package/dist/types/src/components/SaveStatus.d.ts +0 -3
- package/dist/types/src/components/SaveStatus.d.ts.map +0 -1
- package/dist/types/src/components/SpaceMain/SpaceMain.d.ts +0 -10
- package/dist/types/src/components/SpaceMain/SpaceMain.d.ts.map +0 -1
- package/dist/types/src/components/SpaceMain/SpaceMembersSection.d.ts +0 -6
- package/dist/types/src/components/SpaceMain/SpaceMembersSection.d.ts.map +0 -1
- package/dist/types/src/components/SpaceMain/index.d.ts +0 -2
- package/dist/types/src/components/SpaceMain/index.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettings.d.ts.map +0 -1
- package/dist/types/src/components/SpaceSettingsPanel.d.ts.map +0 -1
- package/dist/types/src/components/SyncStatus/types.d.ts.map +0 -1
- package/src/components/MissingObject.tsx +0 -54
- package/src/components/SpaceMain/SpaceMain.tsx +0 -60
- package/src/components/SpaceMain/SpaceMembersSection.tsx +0 -205
- package/src/components/SpaceMain/index.ts +0 -5
- /package/dist/types/src/components/{SpaceSettingsPanel.d.ts → SpaceSettings/SpaceSettingsPanel.d.ts} +0 -0
- /package/src/components/SyncStatus/{types.ts → sync-state.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpaceSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/SpaceSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEzE,eAAO,MAAM,aAAa,iBAAkB;IAAE,QAAQ,EAAE,kBAAkB,CAAA;CAAE,sBAiD3E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpaceSettingsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/SpaceSettingsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAKrD,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,kBAAkB,cAAe,uBAAuB,sBAyCpE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/SyncStatus/types.ts"],"names":[],"mappings":"AAMA,OAAO,EAAc,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKlF,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAErE,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAE/D,eAAO,MAAM,wBAAwB,QAAO,aAM1C,CAAC;AAEH,eAAO,MAAM,cAAc,YAAa,iBAAiB,KAAG,aAS3D,CAAC;AAKF;;GAEG;AACH,eAAO,MAAM,YAAY,QAAO,iBAkC/B,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { parseIntentPlugin, useResolvePlugin } from '@dxos/app-framework';
|
|
8
|
-
import { Status, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { baseSurface, descriptionText, mx } from '@dxos/react-ui-theme';
|
|
10
|
-
|
|
11
|
-
import { SpaceAction, SPACE_PLUGIN } from '../meta';
|
|
12
|
-
|
|
13
|
-
const WAIT_FOR_OBJECT_TIMEOUT = 1_000;
|
|
14
|
-
|
|
15
|
-
export const MissingObject = ({ id }: { id: string }) => {
|
|
16
|
-
const { t } = useTranslation(SPACE_PLUGIN);
|
|
17
|
-
const [waiting, setWaiting] = useState(false);
|
|
18
|
-
const intentPlugin = useResolvePlugin(parseIntentPlugin);
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!intentPlugin) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const timeout = setTimeout(async () => {
|
|
26
|
-
setWaiting(true);
|
|
27
|
-
await intentPlugin.provides.intent.dispatch({
|
|
28
|
-
plugin: SPACE_PLUGIN,
|
|
29
|
-
action: SpaceAction.WAIT_FOR_OBJECT,
|
|
30
|
-
data: { id },
|
|
31
|
-
});
|
|
32
|
-
}, WAIT_FOR_OBJECT_TIMEOUT);
|
|
33
|
-
|
|
34
|
-
return () => clearTimeout(timeout);
|
|
35
|
-
}, [intentPlugin, id]);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div role='none' className={mx(baseSurface, 'min-bs-screen is-full flex items-center justify-center p-8')}>
|
|
39
|
-
{waiting ? (
|
|
40
|
-
<p
|
|
41
|
-
role='alert'
|
|
42
|
-
className={mx(
|
|
43
|
-
descriptionText,
|
|
44
|
-
'border border-dashed border-neutral-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg',
|
|
45
|
-
)}
|
|
46
|
-
>
|
|
47
|
-
{t('missing object message')}
|
|
48
|
-
</p>
|
|
49
|
-
) : (
|
|
50
|
-
<Status indeterminate aria-label='Initializing' />
|
|
51
|
-
)}
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Command } from '@phosphor-icons/react';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { Surface } from '@dxos/app-framework';
|
|
9
|
-
import { SpaceState, type Space } from '@dxos/react-client/echo';
|
|
10
|
-
import { Main, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { getSize, mx, topbarBlockPaddingStart } from '@dxos/react-ui-theme';
|
|
12
|
-
import { ClipboardProvider } from '@dxos/shell/react';
|
|
13
|
-
|
|
14
|
-
import { SpaceMembersSection } from './SpaceMembersSection';
|
|
15
|
-
import { SPACE_PLUGIN } from '../../meta';
|
|
16
|
-
|
|
17
|
-
const KeyShortcuts = () => {
|
|
18
|
-
const { t } = useTranslation(SPACE_PLUGIN);
|
|
19
|
-
return (
|
|
20
|
-
<section className='mbe-4 col-span-4 md:col-start-5 md:col-end-7 grid grid-cols-subgrid gap-y-2 auto-rows-min'>
|
|
21
|
-
<h2 className='contents'>
|
|
22
|
-
<Command weight='duotone' className={mx(getSize(5), 'place-self-center')} />
|
|
23
|
-
<span className='text-lg col-span-2 md:col-span-1'>{t('keyshortcuts label')}</span>
|
|
24
|
-
</h2>
|
|
25
|
-
<div role='none' className='col-start-2 col-end-4 md:col-end-5 pie-2'>
|
|
26
|
-
<Surface role='keyshortcuts' />
|
|
27
|
-
</div>
|
|
28
|
-
</section>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const spaceMainLayout =
|
|
33
|
-
'grid gap-y-2 auto-rows-min before:bs-2 before:col-span-5 grid-cols-[var(--rail-size)_var(--rail-size)_1fr_var(--rail-size)] md:grid-cols-[var(--rail-size)_var(--rail-size)_minmax(max-content,1fr)_var(--rail-size)_var(--rail-size)_minmax(max-content,2fr)_var(--rail-size)]';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated
|
|
37
|
-
*/
|
|
38
|
-
// TODO(wittjosiah): Remove this and re-use space members section as a deck column.
|
|
39
|
-
export const SpaceMain = ({ space, role }: { space: Space; role: 'main' | 'article' }) => {
|
|
40
|
-
// const { graph } = useGraph();
|
|
41
|
-
// const _actionsMap = graph.findNode(space.key.toHex())?.actionsMap;
|
|
42
|
-
const state = space.state.get();
|
|
43
|
-
const ready = state === SpaceState.SPACE_READY;
|
|
44
|
-
const Root = role === 'main' ? Main.Content : 'div';
|
|
45
|
-
return (
|
|
46
|
-
<ClipboardProvider>
|
|
47
|
-
<Root
|
|
48
|
-
{...(role === 'main'
|
|
49
|
-
? { classNames: [topbarBlockPaddingStart, 'min-bs-dvh', spaceMainLayout] }
|
|
50
|
-
: { role: 'none', className: mx(topbarBlockPaddingStart, 'row-span-2', spaceMainLayout) })}
|
|
51
|
-
data-testid={`spacePlugin.${role}`}
|
|
52
|
-
data-isready={ready ? 'true' : 'false'}
|
|
53
|
-
>
|
|
54
|
-
{/* {actionsMap && <InFlowSpaceActions actionsMap={actionsMap} />} */}
|
|
55
|
-
{ready && <SpaceMembersSection space={space} />}
|
|
56
|
-
<KeyShortcuts />
|
|
57
|
-
</Root>
|
|
58
|
-
</ClipboardProvider>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { CaretDown, Check, UserPlus, UsersThree } from '@phosphor-icons/react';
|
|
6
|
-
import React, { useCallback, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { LayoutAction, useIntent } from '@dxos/app-framework';
|
|
9
|
-
import { type Space, useMembers, SpaceMember, useSpaceInvitations } from '@dxos/react-client/echo';
|
|
10
|
-
import { type CancellableInvitationObservable, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
11
|
-
import { Invitation } from '@dxos/react-client/invitations';
|
|
12
|
-
import { Button, ButtonGroup, DropdownMenu, List, useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { descriptionText, getSize, mx } from '@dxos/react-ui-theme';
|
|
14
|
-
import { InvitationListItem, IdentityListItem } from '@dxos/shell/react';
|
|
15
|
-
|
|
16
|
-
import { SPACE_PLUGIN } from '../../meta';
|
|
17
|
-
|
|
18
|
-
// TODO(thure): Sync with shell?
|
|
19
|
-
const activeActionKeyStorageKey = 'dxos:react-shell/space-manager/active-action';
|
|
20
|
-
|
|
21
|
-
const Presence = SpaceMember.PresenceState;
|
|
22
|
-
|
|
23
|
-
const handleCreateInvitationUrl = (invitationCode: string) => `${origin}?spaceInvitationCode=${invitationCode}`;
|
|
24
|
-
|
|
25
|
-
const SpaceMemberList = ({ members }: { members: SpaceMember[] }) => {
|
|
26
|
-
return members.length > 0 ? (
|
|
27
|
-
<List classNames='col-start-2 col-end-5 gap-y-1 grid grid-cols-subgrid items-center'>
|
|
28
|
-
{members.map((member) => (
|
|
29
|
-
<IdentityListItem
|
|
30
|
-
classNames='contents'
|
|
31
|
-
key={member.identity.identityKey.toHex()}
|
|
32
|
-
identity={member.identity}
|
|
33
|
-
presence={member.presence}
|
|
34
|
-
/>
|
|
35
|
-
))}
|
|
36
|
-
</List>
|
|
37
|
-
) : null;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const SpaceMembersSection = ({ space }: { space: Space }) => {
|
|
41
|
-
const { t } = useTranslation(SPACE_PLUGIN);
|
|
42
|
-
const invitations = useSpaceInvitations(space.key);
|
|
43
|
-
const { dispatch } = useIntent();
|
|
44
|
-
|
|
45
|
-
const handleCloseDialog = () =>
|
|
46
|
-
dispatch({
|
|
47
|
-
action: LayoutAction.SET_LAYOUT,
|
|
48
|
-
data: { element: 'dialog', state: false },
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const handleInvitationSelect = ({
|
|
52
|
-
invitation: invitationObservable,
|
|
53
|
-
}: {
|
|
54
|
-
invitation: CancellableInvitationObservable;
|
|
55
|
-
}) => {
|
|
56
|
-
const invitation = invitationObservable.get();
|
|
57
|
-
void dispatch({
|
|
58
|
-
action: LayoutAction.SET_LAYOUT,
|
|
59
|
-
data: {
|
|
60
|
-
element: 'dialog',
|
|
61
|
-
component: 'dxos.org/plugin/space/InvitationManagerDialog',
|
|
62
|
-
subject: {
|
|
63
|
-
invitationUrl: handleCreateInvitationUrl(InvitationEncoder.encode(invitation)),
|
|
64
|
-
send: handleCloseDialog,
|
|
65
|
-
status: invitation.state,
|
|
66
|
-
type: invitation.type,
|
|
67
|
-
authCode: invitation.authCode,
|
|
68
|
-
id: invitation.invitationId,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const inviteActions = {
|
|
75
|
-
inviteOne: {
|
|
76
|
-
label: t('invite one label', { ns: 'os' }),
|
|
77
|
-
description: t('invite one description', { ns: 'os' }),
|
|
78
|
-
icon: UserPlus,
|
|
79
|
-
onClick: useCallback(() => {
|
|
80
|
-
space.share?.({
|
|
81
|
-
type: Invitation.Type.INTERACTIVE,
|
|
82
|
-
authMethod: Invitation.AuthMethod.SHARED_SECRET,
|
|
83
|
-
});
|
|
84
|
-
}, [space]),
|
|
85
|
-
},
|
|
86
|
-
inviteMany: {
|
|
87
|
-
label: t('invite many label', { ns: 'os' }),
|
|
88
|
-
description: t('invite many description', { ns: 'os' }),
|
|
89
|
-
icon: UsersThree,
|
|
90
|
-
onClick: useCallback(() => {
|
|
91
|
-
space.share?.({
|
|
92
|
-
type: Invitation.Type.INTERACTIVE,
|
|
93
|
-
authMethod: Invitation.AuthMethod.NONE,
|
|
94
|
-
multiUse: true,
|
|
95
|
-
});
|
|
96
|
-
}, [space]),
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const [activeActionKey, setInternalActiveActionKey] = useState<keyof typeof inviteActions>(
|
|
101
|
-
(localStorage.getItem(activeActionKeyStorageKey) as keyof typeof inviteActions) ?? 'inviteOne',
|
|
102
|
-
);
|
|
103
|
-
const setActiveActionKey = (nextKey: keyof typeof inviteActions) => {
|
|
104
|
-
setInternalActiveActionKey(nextKey);
|
|
105
|
-
localStorage.setItem(activeActionKeyStorageKey, nextKey);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const activeAction = inviteActions[activeActionKey as keyof typeof inviteActions] ?? {};
|
|
109
|
-
|
|
110
|
-
// TODO(thure): Simplify when Object.groupBy() is supported by Safari
|
|
111
|
-
// https://caniuse.com/mdn-javascript_builtins_object_groupby
|
|
112
|
-
const members = useMembers(space.key).reduce(
|
|
113
|
-
(acc: Record<SpaceMember.PresenceState, SpaceMember[]>, member) => {
|
|
114
|
-
acc[member.presence].push(member);
|
|
115
|
-
return acc;
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
[Presence.ONLINE]: [],
|
|
119
|
-
[Presence.OFFLINE]: [],
|
|
120
|
-
},
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<section className='mbe-4 col-span-3 grid gap-y-2 grid-cols-subgrid auto-rows-min'>
|
|
125
|
-
<h2 className='contents'>
|
|
126
|
-
<UsersThree weight='duotone' className={mx(getSize(5), 'place-self-center')} />
|
|
127
|
-
<span className='text-lg col-span-2'>{t('space members label')}</span>
|
|
128
|
-
</h2>
|
|
129
|
-
<h3 className='col-start-2 col-span-3 text-sm italic text-description'>{t('invitations heading')}</h3>
|
|
130
|
-
{invitations.length > 0 && (
|
|
131
|
-
<List classNames='col-start-2 col-span-2 gap-y-2 grid grid-cols-[var(--rail-size)_1fr_var(--rail-action)_var(--rail-action)]'>
|
|
132
|
-
{invitations.map((invitation) => (
|
|
133
|
-
<InvitationListItem
|
|
134
|
-
reverseEffects
|
|
135
|
-
classNames='pis-0 pie-0 gap-0 col-span-4 grid grid-cols-subgrid'
|
|
136
|
-
key={invitation.get().invitationId}
|
|
137
|
-
invitation={invitation}
|
|
138
|
-
send={handleInvitationSelect}
|
|
139
|
-
createInvitationUrl={handleCreateInvitationUrl}
|
|
140
|
-
/>
|
|
141
|
-
))}
|
|
142
|
-
</List>
|
|
143
|
-
)}
|
|
144
|
-
<ButtonGroup classNames='col-start-2 col-end-4 grid grid-cols-[1fr_var(--rail-action)] place-self-grow gap-px'>
|
|
145
|
-
<Button classNames='gap-2' onClick={activeAction.onClick}>
|
|
146
|
-
<activeAction.icon className={getSize(5)} />
|
|
147
|
-
<span>{t(activeAction.label, { ns: 'os' })}</span>
|
|
148
|
-
</Button>
|
|
149
|
-
<DropdownMenu.Root>
|
|
150
|
-
<DropdownMenu.Trigger asChild>
|
|
151
|
-
<Button classNames='pli-0'>
|
|
152
|
-
<CaretDown className={getSize(4)} />
|
|
153
|
-
</Button>
|
|
154
|
-
</DropdownMenu.Trigger>
|
|
155
|
-
<DropdownMenu.Content>
|
|
156
|
-
<DropdownMenu.Viewport>
|
|
157
|
-
{Object.entries(inviteActions).map(([id, action]) => {
|
|
158
|
-
return (
|
|
159
|
-
<DropdownMenu.CheckboxItem
|
|
160
|
-
key={id}
|
|
161
|
-
aria-labelledby={`${id}__label`}
|
|
162
|
-
aria-describedby={`${id}__description`}
|
|
163
|
-
checked={activeActionKey === id}
|
|
164
|
-
onCheckedChange={(checked) => checked && setActiveActionKey(id as keyof typeof inviteActions)}
|
|
165
|
-
classNames='gap-2'
|
|
166
|
-
>
|
|
167
|
-
{action.icon && <action.icon className={getSize(5)} />}
|
|
168
|
-
<div role='none' className='flex-1 min-is-0 space-b-1'>
|
|
169
|
-
<p id={`${id}__label`}>{t(action.label, { ns: 'os' })}</p>
|
|
170
|
-
{action.description && (
|
|
171
|
-
<p id={`${id}__description`} className={descriptionText}>
|
|
172
|
-
{t(action.description, { ns: 'os' })}
|
|
173
|
-
</p>
|
|
174
|
-
)}
|
|
175
|
-
</div>
|
|
176
|
-
<DropdownMenu.ItemIndicator asChild>
|
|
177
|
-
<Check className={getSize(4)} />
|
|
178
|
-
</DropdownMenu.ItemIndicator>
|
|
179
|
-
</DropdownMenu.CheckboxItem>
|
|
180
|
-
);
|
|
181
|
-
})}
|
|
182
|
-
</DropdownMenu.Viewport>
|
|
183
|
-
<DropdownMenu.Arrow />
|
|
184
|
-
</DropdownMenu.Content>
|
|
185
|
-
</DropdownMenu.Root>
|
|
186
|
-
</ButtonGroup>
|
|
187
|
-
{members[Presence.ONLINE].length + members[Presence.OFFLINE].length < 1 ? (
|
|
188
|
-
<p className={mx(descriptionText, 'text-center is-full mlb-2')}>
|
|
189
|
-
{t('empty space members message', { ns: 'os' })}
|
|
190
|
-
</p>
|
|
191
|
-
) : (
|
|
192
|
-
<>
|
|
193
|
-
<h3 className='col-start-2 col-end-5 text-sm italic text-description'>
|
|
194
|
-
{t('active space members heading', { count: members[Presence.ONLINE].length })}
|
|
195
|
-
</h3>
|
|
196
|
-
<SpaceMemberList members={members[Presence.ONLINE]} />
|
|
197
|
-
<h3 className='col-start-2 col-end-5 text-sm italic text-description'>
|
|
198
|
-
{t('inactive space members heading', { count: members[Presence.OFFLINE].length })}
|
|
199
|
-
</h3>
|
|
200
|
-
<SpaceMemberList members={members[Presence.OFFLINE]} />
|
|
201
|
-
</>
|
|
202
|
-
)}
|
|
203
|
-
</section>
|
|
204
|
-
);
|
|
205
|
-
};
|
/package/dist/types/src/components/{SpaceSettingsPanel.d.ts → SpaceSettings/SpaceSettingsPanel.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|