Skip to content

Commit

Permalink
JS-4422: shared space onboarding tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3orblade committed Apr 20, 2024
1 parent 991bc1b commit 4d0e0ef
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 40 deletions.
Binary file added dist/img/help/onboarding/share-space.mp4
Binary file not shown.
3 changes: 3 additions & 0 deletions src/json/text.json
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,9 @@
"onboardingQuickCaptureTitle": "Create Object by Selecting Type",
"onboardingQuickCaptureDescription": "<p>Pin favorite types, install from Anytype Library, or create new ones from the menu.</p><p>Customize your experience by adjusting click options at Settings > Preferences > Show quick capture menu on.</p>",

"onboardingShareSpaceTitle": "Introducing shared spaces",
"onboardingShareSpaceDescription": "Click on the space widget to open space settings. Here you can share the space and invite members to collaborate!",

"libDataviewRelations": "Relations",
"libDataviewGroups": "Groups",
"libDataviewView": "View",
Expand Down
2 changes: 2 additions & 0 deletions src/scss/menu/onboarding.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
.confettiCanvas { position: absolute; pointer-events: none; width: 100%; height: 100%; left: 0; top: 0; }

.bottom { display: flex; flex-direction: row; align-items: center; justify-content: space-between; margin-top: 20px; }
.bottom:empty { display: none; }

.bottom {
.round {
display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
Expand Down
2 changes: 1 addition & 1 deletion src/ts/component/list/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const ListWidget = observer(class ListWidget extends React.Component<Props, Stat
cacheKey="firstTarget"
>
<Widget
block={new M.Block({ id: 'widget-space', type: I.BlockType.Widget, content: { layout: I.WidgetLayout.Space } })}
block={new M.Block({ id: 'space', type: I.BlockType.Widget, content: { layout: I.WidgetLayout.Space } })}
disableContextMenu={true}
onDragStart={this.onDragStart}
onDragOver={this.onDragOver}
Expand Down
59 changes: 26 additions & 33 deletions src/ts/component/menu/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,37 +61,6 @@ const MenuOnboarding = observer(class MenuSelect extends React.Component<I.Menu,

buttons = buttons.filter(it => it);

const Steps = () => (
<div className="steps">
{l > 1 ? (
<React.Fragment>
{[ ...Array(l) ].map((e: number, i: number) => {
const cn = [ 'step' ];
if (i == current) {
cn.push('active');
};

return <div key={i} className={cn.join(' ')} onClick={e => this.onClick(e, i)} />;
})}
</React.Fragment>
) : ''}
</div>
);

const Buttons = () => (
<div className="buttons">
{buttons.map((button, i) => (
<Button
key={i}
text={button.text}
color={(i == buttons.length - 1) ? 'black' : 'blank'}
className="c28"
onClick={e => this.onButton(e, button.action)}
/>
))}
</div>
);

return (
<div
ref={node => this.node = node}
Expand All @@ -105,8 +74,32 @@ const MenuOnboarding = observer(class MenuSelect extends React.Component<I.Menu,
{item.video ? <video ref={node => this.video = node} src={item.video} onClick={(e: any) => this.onVideoClick(e, item.video)} controls={false} autoPlay={true} loop={true} /> : ''}

<div className="bottom">
<Steps />
<Buttons />
{l > 1 ? (
<div className="steps">
{[ ...Array(l) ].map((e: number, i: number) => {
const cn = [ 'step' ];
if (i == current) {
cn.push('active');
};

return <div key={i} className={cn.join(' ')} onClick={e => this.onClick(e, i)} />;
})}
</div>
) : ''}

{buttons.length ? (
<div className="buttons">
{buttons.map((button, i) => (
<Button
key={i}
text={button.text}
color={(i == buttons.length - 1) ? 'black' : 'blank'}
className="c28"
onClick={e => this.onButton(e, button.action)}
/>
))}
</div>
) : ''}
</div>

{showConfetti ? <ReactCanvasConfetti refConfetti={ins => this.confetti = ins} className="confettiCanvas" /> : ''}
Expand Down
2 changes: 1 addition & 1 deletion src/ts/component/widget/space.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import { IconObject, ObjectName } from 'Component';
import { I, C, UtilSpace, UtilCommon, translate } from 'Lib';
import { I, C, UtilSpace, UtilCommon, translate, Onboarding, keyboard } from 'Lib';
import { popupStore, commonStore } from 'Store';

const WidgetSpace = observer(class WidgetSpace extends React.Component<I.WidgetComponent> {
Expand Down
30 changes: 26 additions & 4 deletions src/ts/docs/help/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,25 +213,25 @@ export default {
{
name: translate('onboardingQuickCaptureTitle'),
description: translate('onboardingQuickCaptureDescription'),
noButton: true,
param: {
element: '#navigationPanel #button-navigation-plus',
classNameWrap: 'fixed',
vertical: I.MenuDirection.Top,
horizontal: I.MenuDirection.Center,
offsetY: -24,
noButton: true,
}
},
{
name: translate('onboardingSpaceSelectTitle'),
description: translate('onboardingSpaceSelectDescription'),
noButton: true,
param: {
element: '#navigationPanel #button-navigation-profile',
classNameWrap: 'fixed',
vertical: I.MenuDirection.Top,
horizontal: I.MenuDirection.Center,
offsetY: -24,
noButton: true,
}
},
{
Expand Down Expand Up @@ -295,11 +295,11 @@ export default {
{
name: translate('onboardingTypeDeleted1Title'),
description: translate('onboardingTypeDeleted1Description'),
noButton: true,
param: {
element: '#block-featuredRelations',
offsetY: 10,
},
noButton: true,
buttons: [
{ text: translate('blockFeaturedTypeMenuChangeType'), action: 'changeType' },
],
Expand Down Expand Up @@ -396,16 +396,38 @@ export default {
{
name: translate('onboardingTemplateSelectTitle'),
description: translate('onboardingTemplateSelectDescription'),
noButton: true,
},
],

param: {
element: '#headerBanner',
horizontal: I.MenuDirection.Center,
offsetY: 12,
noButton: true,
},
}
),

space: () => {
const width = 505;
return {
items: [
{
name: translate('onboardingShareSpaceTitle'),
description: translate('onboardingShareSpaceDescription'),
video: './img/help/onboarding/share-space.mp4',
noButton: true,
param: {
element: '#widget-space',
classNameWrap: 'fixed',
vertical: I.MenuDirection.Center,
horizontal: I.MenuDirection.Right,
width,
offsetX: -(width + 10),
}
},
],
};
},

};
8 changes: 7 additions & 1 deletion src/ts/lib/util/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I, C, M, keyboard, translate, UtilCommon, UtilRouter, Storage, analytics, dispatcher, Mark, UtilObject, focus, UtilSpace, Renderer, Action, Survey } from 'Lib';
import { I, C, M, keyboard, translate, UtilCommon, UtilRouter, Storage, analytics, dispatcher, Mark, UtilObject, focus, UtilSpace, Renderer, Action, Survey, Onboarding } from 'Lib';
import { commonStore, blockStore, detailStore, dbStore, authStore, notificationStore, popupStore } from 'Store';
import Constant from 'json/constant.json';
import * as Sentry from '@sentry/browser';
Expand Down Expand Up @@ -216,6 +216,12 @@ class UtilData {
Survey.check(I.SurveyType.Register);
Survey.check(I.SurveyType.Object);

const space = UtilSpace.getSpaceview();

if (!space.isPersonal) {
Onboarding.start('space', keyboard.isPopup(), false);
};

if (callBack) {
callBack();
};
Expand Down

0 comments on commit 4d0e0ef

Please sign in to comment.