@dxos/react-ui 0.1.31 → 0.1.32-next.86f5578
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/index.mjs +1018 -870
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +64 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +2 -5
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts +4 -6
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +3 -1
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/toEmoji.d.ts +2 -0
- package/dist/types/src/util/toEmoji.d.ts.map +1 -0
- package/package.json +18 -14
- package/src/components/IdentityList/SpaceMemberListContainer.tsx +6 -2
- package/src/components/InvitationList/InvitationList.stories.tsx +1 -1
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +4 -2
- package/src/composites/Shell/Shell.stories.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +1 -1
- package/src/panels/JoinPanel/JoinHeading.tsx +42 -40
- package/src/panels/JoinPanel/JoinPanel.tsx +140 -218
- package/src/panels/JoinPanel/JoinPanelProps.ts +1 -1
- package/src/panels/JoinPanel/joinMachine.ts +418 -0
- package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +9 -21
- package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +6 -6
- package/src/panels/JoinPanel/view-states/IdentityInput.tsx +4 -4
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +22 -18
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +37 -28
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +21 -21
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +58 -41
- package/src/panels/JoinPanel/view-states/ViewState.tsx +11 -62
- package/src/panels/JoinPanel/view-states/index.ts +0 -1
- package/src/playwright/invitations-manager.ts +6 -2
- package/src/playwright/invitations.spec.ts +14 -5
- package/src/stories/Invitations.stories.tsx +2 -2
- package/src/translations/locales/en-US.ts +6 -4
- package/src/util/index.ts +1 -0
- package/src/util/toEmoji.ts +22 -0
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +0 -7
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +0 -1
- package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +0 -100
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewState.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/view-states/ViewState.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,cAAc,EAAE,wBAAwB,EAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewState.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/view-states/ViewState.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,cAAc,EAAE,wBAAwB,EAAsB,MAAM,OAAO,CAAC;AAS5F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAID,eAAO,MAAM,gBAAgB,sCAAuC,yBAAyB,IAAI,CAAC,gBAMjG,CAAC;AA4GF,eAAO,MAAM,SAAS,mEAAoE,cAAc,gBAcvG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/view-states/index.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/view-states/index.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAC;AACzC,cA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AAI,EAAE,QAAQ,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBrG,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM;IAUzE,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7E,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO;IAO5D,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKxC,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,kBAAkB,EAAE,MAAM;IAOvF,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO;IAO5D,eAAe,CAAC,EAAE,EAAE,MAAM;IAO1B,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO;IASzD,OAAO,CAAC,KAAK;YAIC,iBAAiB;CAUhC"}
|
|
@@ -4,7 +4,7 @@ export declare const os: {
|
|
|
4
4
|
'sidebar label': string;
|
|
5
5
|
'copy invitation code label': string;
|
|
6
6
|
'open share panel label': string;
|
|
7
|
-
'joining heading': string;
|
|
7
|
+
'joining space heading': string;
|
|
8
8
|
'join space heading': string;
|
|
9
9
|
'halo heading': string;
|
|
10
10
|
'exit label': string;
|
|
@@ -59,5 +59,7 @@ export declare const os: {
|
|
|
59
59
|
'toggle sidebar label': string;
|
|
60
60
|
'open sidebar label': string;
|
|
61
61
|
'close sidebar label': string;
|
|
62
|
+
'welcome message': string;
|
|
63
|
+
'selecting identity heading': string;
|
|
62
64
|
};
|
|
63
65
|
//# sourceMappingURL=en-US.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../../../../src/translations/locales/en-US.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../../../../src/translations/locales/en-US.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Dd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toEmoji.d.ts","sourceRoot":"","sources":["../../../../src/util/toEmoji.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,OAAO,aAAc,MAAM,WAAiD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32-next.86f5578",
|
|
4
4
|
"description": "A React component library for DXOS’s OS experiences",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -19,32 +19,36 @@
|
|
|
19
19
|
"@radix-ui/react-dialog": "^1.0.3",
|
|
20
20
|
"@radix-ui/react-radio-group": "^1.1.2",
|
|
21
21
|
"@react-hook/async": "^3.1.1",
|
|
22
|
+
"@xstate/react": "^3.2.1",
|
|
22
23
|
"debug": "^4.3.3",
|
|
24
|
+
"lodash.toarray": "^4.4.0",
|
|
23
25
|
"qrcode.react": "^3.1.0",
|
|
24
26
|
"url-join": "^5.0.0",
|
|
25
|
-
"
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/react-
|
|
32
|
-
"@dxos/
|
|
27
|
+
"xstate": "^4.37.0",
|
|
28
|
+
"@dxos/client": "0.1.32-next.86f5578",
|
|
29
|
+
"@dxos/config": "0.1.32-next.86f5578",
|
|
30
|
+
"@dxos/debug": "0.1.32-next.86f5578",
|
|
31
|
+
"@dxos/keys": "0.1.32-next.86f5578",
|
|
32
|
+
"@dxos/protocols": "0.1.32-next.86f5578",
|
|
33
|
+
"@dxos/react-client": "0.1.32-next.86f5578",
|
|
34
|
+
"@dxos/react-components": "0.1.32-next.86f5578",
|
|
35
|
+
"@dxos/util": "0.1.32-next.86f5578"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
38
|
"@faker-js/faker": "^7.6.0",
|
|
36
39
|
"@phosphor-icons/react": "^2.0.5",
|
|
37
40
|
"@types/debug": "^4.1.7",
|
|
41
|
+
"@types/lodash.toarray": "^4.4.7",
|
|
38
42
|
"@types/react": "^18.0.21",
|
|
39
43
|
"@types/react-dom": "^18.0.6",
|
|
40
44
|
"@vitejs/plugin-react": "^3.0.1",
|
|
41
45
|
"react": "^18.2.0",
|
|
42
46
|
"react-dom": "^18.2.0",
|
|
43
|
-
"vite": "4.0
|
|
44
|
-
"@dxos/async": "0.1.
|
|
45
|
-
"@dxos/client-services": "0.1.
|
|
46
|
-
"@dxos/log": "0.1.
|
|
47
|
-
"@dxos/react-async": "0.1.
|
|
47
|
+
"vite": "^4.2.0",
|
|
48
|
+
"@dxos/async": "0.1.32-next.86f5578",
|
|
49
|
+
"@dxos/client-services": "0.1.32-next.86f5578",
|
|
50
|
+
"@dxos/log": "0.1.32-next.86f5578",
|
|
51
|
+
"@dxos/react-async": "0.1.32-next.86f5578"
|
|
48
52
|
},
|
|
49
53
|
"peerDependencies": {
|
|
50
54
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -20,8 +20,12 @@ export const SpaceMemberListContainer = ({ spaceKey, includeSelf, onSelect }: Sp
|
|
|
20
20
|
const members = useMemo(
|
|
21
21
|
() =>
|
|
22
22
|
includeSelf
|
|
23
|
-
? allUnsortedMembers.sort((a) =>
|
|
24
|
-
|
|
23
|
+
? allUnsortedMembers.sort((a) =>
|
|
24
|
+
a.identity.identityKey.equals(client.halo.identity.get()!.identityKey) ? -1 : 1
|
|
25
|
+
)
|
|
26
|
+
: allUnsortedMembers.filter(
|
|
27
|
+
(member) => !member.identity.identityKey.equals(client.halo.identity.get()!.identityKey)
|
|
28
|
+
),
|
|
25
29
|
[allUnsortedMembers]
|
|
26
30
|
);
|
|
27
31
|
return <SpaceMemberList members={members} onSelect={onSelect} />;
|
|
@@ -37,7 +37,7 @@ export const Default = {
|
|
|
37
37
|
|
|
38
38
|
await clients[0].halo.createIdentity({ displayName: 'Os Mutantes' });
|
|
39
39
|
|
|
40
|
-
const space = await clients[0].
|
|
40
|
+
const space = await clients[0].createSpace();
|
|
41
41
|
log.info('[space created]', space);
|
|
42
42
|
space.properties.name = 'Q3 2022 Planning';
|
|
43
43
|
log.info('[space title set]', space?.properties.name);
|
|
@@ -35,6 +35,9 @@ const JoinClientDecorator = (Story: StoryFn, { args }: StoryContext) => {
|
|
|
35
35
|
log.info('[next invitation code]', { nextInvitationCode });
|
|
36
36
|
setInvitationCode(nextInvitationCode);
|
|
37
37
|
}
|
|
38
|
+
if (invitation.authenticationCode) {
|
|
39
|
+
log.info('[verification code]', invitation.authenticationCode);
|
|
40
|
+
}
|
|
38
41
|
}, []);
|
|
39
42
|
|
|
40
43
|
useAsyncEffect(async () => {
|
|
@@ -43,12 +46,11 @@ const JoinClientDecorator = (Story: StoryFn, { args }: StoryContext) => {
|
|
|
43
46
|
|
|
44
47
|
await clients[0].halo.createIdentity({ displayName: 'Os Mutantes' });
|
|
45
48
|
|
|
46
|
-
const space = await clients[0].
|
|
49
|
+
const space = await clients[0].createSpace();
|
|
47
50
|
log.info('[space created]', space);
|
|
48
51
|
space.properties.name = 'Q3 2022 Planning';
|
|
49
52
|
|
|
50
53
|
const invitation = space.createInvitation({ type: Invitation.Type.INTERACTIVE });
|
|
51
|
-
log.info('[invitation created]', invitation);
|
|
52
54
|
|
|
53
55
|
invitation.subscribe({
|
|
54
56
|
onAuthenticating: onInvitationEvent,
|
|
@@ -45,7 +45,7 @@ const ShellControls = () => {
|
|
|
45
45
|
<TooltipRoot>
|
|
46
46
|
<TooltipContent>Create Space</TooltipContent>
|
|
47
47
|
<TooltipTrigger asChild>
|
|
48
|
-
<Button onClick={() => client.
|
|
48
|
+
<Button onClick={() => client.createSpace({ name: faker.animal.bird() })}>
|
|
49
49
|
<PlusCircle weight='fill' className={getSize(6)} />
|
|
50
50
|
</Button>
|
|
51
51
|
</TooltipTrigger>
|
|
@@ -49,7 +49,7 @@ export const Shell = ({ runtime, origin }: { runtime: ShellRuntime; origin: stri
|
|
|
49
49
|
initialInvitationCode={invitationCode}
|
|
50
50
|
onDone={async () => {
|
|
51
51
|
// TODO(wittjosiah): Is this app-specific?
|
|
52
|
-
spaces.length > 0 || (await client.
|
|
52
|
+
spaces.length > 0 || (await client.createSpace());
|
|
53
53
|
await runtime.setAppContext({ display: ShellDisplay.NONE });
|
|
54
54
|
runtime.setLayout(ShellLayout.DEFAULT);
|
|
55
55
|
}}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
|
-
import {
|
|
4
|
+
import { X } from '@phosphor-icons/react';
|
|
5
5
|
import React, { cloneElement, ForwardedRef, forwardRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import { AuthenticatingInvitationObservable } from '@dxos/client';
|
|
8
7
|
import { useSpace } from '@dxos/react-client';
|
|
9
|
-
import {
|
|
8
|
+
import { Button, defaultDescription, getSize, Heading, mx, useId, useTranslation } from '@dxos/react-components';
|
|
10
9
|
|
|
11
|
-
import {
|
|
10
|
+
import { defaultSurface } from '../../styles';
|
|
11
|
+
import { toEmoji } from '../../util';
|
|
12
12
|
import { JoinPanelMode } from './JoinPanelProps';
|
|
13
|
+
import { JoinState } from './joinMachine';
|
|
13
14
|
|
|
14
15
|
export interface JoinSpaceHeadingProps {
|
|
15
16
|
mode?: JoinPanelMode;
|
|
16
17
|
titleId: string;
|
|
17
|
-
|
|
18
|
+
joinState?: JoinState;
|
|
18
19
|
onExit?: () => void;
|
|
19
20
|
exitActionParent?: Parameters<typeof cloneElement>[0];
|
|
20
21
|
preventExit?: boolean;
|
|
@@ -23,56 +24,57 @@ export interface JoinSpaceHeadingProps {
|
|
|
23
24
|
// TODO(wittjosiah): Accesses the space properties directly which will trigger ECHO warnings without observer.
|
|
24
25
|
export const JoinHeading = forwardRef(
|
|
25
26
|
(
|
|
26
|
-
{ mode, titleId,
|
|
27
|
+
{ mode, titleId, joinState, onExit, exitActionParent, preventExit }: JoinSpaceHeadingProps,
|
|
27
28
|
ref: ForwardedRef<HTMLDivElement>
|
|
28
29
|
) => {
|
|
29
30
|
const { t } = useTranslation('os');
|
|
30
31
|
|
|
31
|
-
const space = useSpace(
|
|
32
|
-
const name =
|
|
32
|
+
const space = useSpace(joinState?.context.space.invitation?.spaceKey);
|
|
33
|
+
const name = space?.properties.name;
|
|
33
34
|
const nameId = useId(mode === 'halo-only' ? 'identityDisplayName' : 'spaceDisplayName');
|
|
34
35
|
|
|
35
|
-
const invitationKey =
|
|
36
|
-
|
|
37
|
-
? invitation?.invitation?.identityKey?.toHex()
|
|
38
|
-
: invitation?.invitation?.identityKey?.toHex();
|
|
36
|
+
const invitationKey = joinState?.context[mode === 'halo-only' ? 'halo' : 'space'].invitation?.invitationId;
|
|
37
|
+
const invitationEmoji = invitationKey && toEmoji(invitationKey);
|
|
39
38
|
|
|
40
39
|
const exitButton = (
|
|
41
|
-
<Button
|
|
42
|
-
|
|
40
|
+
<Button
|
|
41
|
+
variant='ghost'
|
|
42
|
+
{...(onExit && { onClick: onExit })}
|
|
43
|
+
className={mx(defaultDescription, 'plb-0 pli-2 absolute block-start-1.5 inline-end-2 z-[1]')}
|
|
44
|
+
data-testid='join-exit'
|
|
45
|
+
>
|
|
46
|
+
<X weight='bold' className={getSize(4)} />
|
|
43
47
|
<span className='sr-only'>{t('exit label')}</span>
|
|
44
48
|
</Button>
|
|
45
49
|
);
|
|
46
50
|
|
|
47
51
|
return (
|
|
48
|
-
<div role='none' className={mx(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
<div role='none' className={mx(defaultSurface, 'pbs-3 pbe-1 rounded-bs-md relative')} ref={ref}>
|
|
53
|
+
{!preventExit &&
|
|
54
|
+
mode !== 'halo-only' &&
|
|
55
|
+
(exitActionParent ? cloneElement(exitActionParent, {}, exitButton) : exitButton)}
|
|
56
|
+
<Heading
|
|
57
|
+
level={1}
|
|
58
|
+
className={mx(
|
|
59
|
+
defaultDescription,
|
|
60
|
+
'font-body font-system-normal text-center text-sm grow pbe-2',
|
|
61
|
+
mode === 'halo-only' && (preventExit ? 'sr-only' : 'opacity-0')
|
|
54
62
|
)}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
) : (
|
|
68
|
-
<span className='block leading-none font-system-medium text-sm'>
|
|
69
|
-
{mode === 'halo-only' ? t('halo heading') : t('join space heading')}
|
|
70
|
-
</span>
|
|
63
|
+
id={titleId}
|
|
64
|
+
>
|
|
65
|
+
{t(mode === 'halo-only' ? 'selecting identity heading' : 'joining space heading')}
|
|
66
|
+
</Heading>
|
|
67
|
+
<div role='group' className='flex items-center justify-center gap-2'>
|
|
68
|
+
<span
|
|
69
|
+
role='none'
|
|
70
|
+
className={mx(
|
|
71
|
+
getSize(12),
|
|
72
|
+
'bg-neutral-300 dark:bg-neutral-700 rounded-full text-center text-4xl leading-[3rem]'
|
|
71
73
|
)}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
>
|
|
75
|
+
{invitationEmoji}
|
|
76
|
+
</span>
|
|
77
|
+
{name && <p id={nameId}>{name}</p>}
|
|
76
78
|
</div>
|
|
77
79
|
</div>
|
|
78
80
|
);
|