mirror of
https://github.com/strapi/strapi.git
synced 2025-10-13 09:03:25 +00:00
future: update guided tour got it button and when conditions (#23922)
This commit is contained in:
parent
6258973711
commit
e50ef5e2ea
@ -1,8 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { Box, Popover, Portal, Flex, LinkButton } from '@strapi/design-system';
|
import { Box, Popover, Portal, Flex, Button } from '@strapi/design-system';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { NavLink } from 'react-router-dom';
|
|
||||||
import { styled } from 'styled-components';
|
import { styled } from 'styled-components';
|
||||||
|
|
||||||
import { useGetGuidedTourMetaQuery } from '../../services/admin';
|
import { useGetGuidedTourMetaQuery } from '../../services/admin';
|
||||||
@ -20,6 +19,16 @@ import { Step, createStepComponents } from './Step';
|
|||||||
* Tours
|
* Tours
|
||||||
* -----------------------------------------------------------------------------------------------*/
|
* -----------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
const GotItAction = ({ onClick }: { onClick: () => void }) => {
|
||||||
|
return (
|
||||||
|
<Flex justifyContent="end" width="100%">
|
||||||
|
<Button onClick={onClick}>
|
||||||
|
<FormattedMessage id="tours.gotIt" defaultMessage="Got it" />
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const tours = {
|
const tours = {
|
||||||
contentTypeBuilder: createTour('contentTypeBuilder', [
|
contentTypeBuilder: createTour('contentTypeBuilder', [
|
||||||
{
|
{
|
||||||
@ -72,14 +81,18 @@ const tours = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Components',
|
name: 'Components',
|
||||||
content: (Step) => (
|
content: (Step, { dispatch }) => (
|
||||||
<Step.Root side="right" sideOffset={16}>
|
<Step.Root side="right" sideOffset={16}>
|
||||||
<Step.Title id="tours.contentTypeBuilder.Components.title" defaultMessage="Components" />
|
<Step.Title id="tours.contentTypeBuilder.Components.title" defaultMessage="Components" />
|
||||||
<Step.Content
|
<Step.Content
|
||||||
id="tours.contentTypeBuilder.Components.content"
|
id="tours.contentTypeBuilder.Components.content"
|
||||||
defaultMessage="A reusable content structure that can be used across multiple content types, such as buttons, sliders or cards."
|
defaultMessage="A reusable content structure that can be used across multiple content types, such as buttons, sliders or cards."
|
||||||
/>
|
/>
|
||||||
<Step.Actions />
|
<Step.Actions>
|
||||||
|
<GotItAction
|
||||||
|
onClick={() => dispatch({ type: 'next_step', payload: 'contentTypeBuilder' })}
|
||||||
|
/>
|
||||||
|
</Step.Actions>
|
||||||
</Step.Root>
|
</Step.Root>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -104,6 +117,9 @@ const tours = {
|
|||||||
contentManager: createTour('contentManager', [
|
contentManager: createTour('contentManager', [
|
||||||
{
|
{
|
||||||
name: 'Introduction',
|
name: 'Introduction',
|
||||||
|
when: (completedActions) =>
|
||||||
|
completedActions.includes('didCreateContentTypeSchema') &&
|
||||||
|
!completedActions.includes('didCreateContent'),
|
||||||
content: (Step) => (
|
content: (Step) => (
|
||||||
<Step.Root side="top" withArrow={false}>
|
<Step.Root side="top" withArrow={false}>
|
||||||
<Step.Title
|
<Step.Title
|
||||||
@ -133,14 +149,18 @@ const tours = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Publish',
|
name: 'Publish',
|
||||||
content: (Step) => (
|
content: (Step, { dispatch }) => (
|
||||||
<Step.Root side="left" align="center">
|
<Step.Root side="left" align="center">
|
||||||
<Step.Title id="tours.contentManager.Publish.title" defaultMessage="Publish" />
|
<Step.Title id="tours.contentManager.Publish.title" defaultMessage="Publish" />
|
||||||
<Step.Content
|
<Step.Content
|
||||||
id="tours.contentManager.Publish.content"
|
id="tours.contentManager.Publish.content"
|
||||||
defaultMessage="Publish entries to make their content available through the Document Service API."
|
defaultMessage="Publish entries to make their content available through the Document Service API."
|
||||||
/>
|
/>
|
||||||
<Step.Actions />
|
<Step.Actions>
|
||||||
|
<GotItAction
|
||||||
|
onClick={() => dispatch({ type: 'next_step', payload: 'contentManager' })}
|
||||||
|
/>
|
||||||
|
</Step.Actions>
|
||||||
</Step.Root>
|
</Step.Root>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -165,6 +185,7 @@ const tours = {
|
|||||||
apiTokens: createTour('apiTokens', [
|
apiTokens: createTour('apiTokens', [
|
||||||
{
|
{
|
||||||
name: 'Introduction',
|
name: 'Introduction',
|
||||||
|
when: (completedActions) => !completedActions.includes('didCreateApiToken'),
|
||||||
content: (Step) => (
|
content: (Step) => (
|
||||||
<Step.Root sideOffset={-36} withArrow={false}>
|
<Step.Root sideOffset={-36} withArrow={false}>
|
||||||
<Step.Title id="tours.apiTokens.Introduction.title" defaultMessage="API tokens" />
|
<Step.Title id="tours.apiTokens.Introduction.title" defaultMessage="API tokens" />
|
||||||
@ -194,7 +215,7 @@ const tours = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'CopyAPIToken',
|
name: 'CopyAPIToken',
|
||||||
content: (Step) => (
|
content: (Step, { dispatch }) => (
|
||||||
<Step.Root side="bottom" align="start" sideOffset={-5}>
|
<Step.Root side="bottom" align="start" sideOffset={-5}>
|
||||||
<Step.Title
|
<Step.Title
|
||||||
id="tours.apiTokens.CopyAPIToken.title"
|
id="tours.apiTokens.CopyAPIToken.title"
|
||||||
@ -204,41 +225,28 @@ const tours = {
|
|||||||
id="tours.apiTokens.CopyAPIToken.content"
|
id="tours.apiTokens.CopyAPIToken.content"
|
||||||
defaultMessage="Make sure to do it now, you won’t be able to see it again. You’ll need to generate a new one if you lose it."
|
defaultMessage="Make sure to do it now, you won’t be able to see it again. You’ll need to generate a new one if you lose it."
|
||||||
/>
|
/>
|
||||||
<Step.Actions />
|
<Step.Actions>
|
||||||
|
<GotItAction onClick={() => dispatch({ type: 'next_step', payload: 'apiTokens' })} />
|
||||||
|
</Step.Actions>
|
||||||
</Step.Root>
|
</Step.Root>
|
||||||
),
|
),
|
||||||
when: (completedActions) => completedActions.includes('didCreateApiToken'),
|
when: (completedActions) => completedActions.includes('didCreateApiToken'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Finish',
|
name: 'Finish',
|
||||||
content: (Step) => {
|
content: (Step) => (
|
||||||
const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);
|
<Step.Root side="right" align="start">
|
||||||
return (
|
<Step.Title
|
||||||
<Step.Root side="right" align="start">
|
id="tours.apiTokens.FinalStep.title"
|
||||||
<Step.Title
|
defaultMessage="It’s time to deploy your application!"
|
||||||
id="tours.apiTokens.FinalStep.title"
|
/>
|
||||||
defaultMessage="It’s time to deploy your application!"
|
<Step.Content
|
||||||
/>
|
id="tours.apiTokens.FinalStep.content"
|
||||||
<Step.Content
|
defaultMessage="Your application is ready to be deployed and its content to be shared with the world!"
|
||||||
id="tours.apiTokens.FinalStep.content"
|
/>
|
||||||
defaultMessage="Your application is ready to be deployed and its content to be shared with the world!"
|
<Step.Actions showStepCount={false} to="/" />
|
||||||
/>
|
</Step.Root>
|
||||||
<Step.Actions showStepCount={false}>
|
),
|
||||||
<Flex justifyContent="end" width={'100%'}>
|
|
||||||
<LinkButton
|
|
||||||
onClick={() => {
|
|
||||||
dispatch({ type: 'next_step', payload: 'apiTokens' });
|
|
||||||
}}
|
|
||||||
tag={NavLink}
|
|
||||||
to="/"
|
|
||||||
>
|
|
||||||
<FormattedMessage id="tours.gotIt" defaultMessage="Got it" />
|
|
||||||
</LinkButton>
|
|
||||||
</Flex>
|
|
||||||
</Step.Actions>
|
|
||||||
</Step.Root>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
when: (completedActions) => completedActions.includes('didCopyApiToken'),
|
when: (completedActions) => completedActions.includes('didCopyApiToken'),
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user