| 1 |
import { __ } from '@wordpress/i18n' |
| 2 |
import type { CalloutContent } from '../../common/demo/DemoCallout' |
| 3 |
import type { DemoStage } from './types' |
| 4 |
|
| 5 |
/** |
| 6 |
* The five steps of the walkthrough, plus its closing note. |
| 7 |
* |
| 8 |
* Several stages share a step: the commentary describes the phase rather than |
| 9 |
* the individual stage, so it stays put while the thread moves underneath it. |
| 10 |
*/ |
| 11 |
const STEPS: Record<string, CalloutContent> = { |
| 12 |
ask: { |
| 13 |
step: __('Step 1 of 5', 'code-snippets'), |
| 14 |
title: __('Ask in plain English', 'code-snippets'), |
| 15 |
body: __('No syntax to learn and no boilerplate to copy — describe what you want the site to do, and the agent works out what that means in code.', 'code-snippets') |
| 16 |
}, |
| 17 |
plan: { |
| 18 |
step: __('Step 2 of 5', 'code-snippets'), |
| 19 |
title: __('Sent for planning', 'code-snippets'), |
| 20 |
body: __('Your request goes to Code Snippets Cloud, which works out what needs building — and whether that is one snippet or several — before writing anything.', 'code-snippets') |
| 21 |
}, |
| 22 |
approve: { |
| 23 |
step: __('Step 3 of 5', 'code-snippets'), |
| 24 |
title: __('You approve the plan', 'code-snippets'), |
| 25 |
body: __('Nothing is written until you accept. Read what it intends to build, send it back for changes, or let it go ahead.', 'code-snippets') |
| 26 |
}, |
| 27 |
build: { |
| 28 |
step: __('Step 4 of 5', 'code-snippets'), |
| 29 |
title: __('Built and added to your site', 'code-snippets'), |
| 30 |
body: __('Each part of the plan becomes a real snippet, written to suit your site rather than pulled from a template. They arrive inactive, so nothing runs until you have read the code and switched them on.', 'code-snippets') |
| 31 |
}, |
| 32 |
refine: { |
| 33 |
step: __('Step 5 of 5', 'code-snippets'), |
| 34 |
title: __('Refine what it built', 'code-snippets'), |
| 35 |
body: __('Not quite right? Say what to change in plain English and it rewrites the snippets in place, keeping the conversation so each refinement builds on the last.', 'code-snippets') |
| 36 |
}, |
| 37 |
done: { |
| 38 |
step: __('Done', 'code-snippets'), |
| 39 |
title: __('Ready to review', 'code-snippets'), |
| 40 |
body: __('The finished snippets are on your site, waiting for you to check them over and activate them.', 'code-snippets') |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
const STAGE_STEPS: Partial<Record<DemoStage, keyof typeof STEPS>> = { |
| 45 |
'typing-prompt': 'ask', |
| 46 |
'prompt-sent': 'plan', |
| 47 |
'planning': 'plan', |
| 48 |
'plan-ready': 'approve', |
| 49 |
'plan-accepted': 'approve', |
| 50 |
'building': 'build', |
| 51 |
'result-ready': 'build', |
| 52 |
'refine-open': 'refine', |
| 53 |
'typing-refinement': 'refine', |
| 54 |
'applying': 'refine', |
| 55 |
'saved': 'done' |
| 56 |
} |
| 57 |
|
| 58 |
export const getCallout = (stage: DemoStage): CalloutContent | undefined => { |
| 59 |
const step = STAGE_STEPS[stage] |
| 60 |
return step ? STEPS[step] : undefined |
| 61 |
} |
| 62 |
|