Skip to content

Commit 073d4bd

Browse files
committed
finally finished tutorial
1 parent dec1255 commit 073d4bd

2 files changed

Lines changed: 105 additions & 133 deletions

File tree

‎src/components/cards/cards.jsx‎

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ const VideoStep = ({ expanded, video, title }) => {
9494
if (!currentVideo) return;
9595
currentVideo.src = video;
9696

97-
if(!title) {
97+
if (!title) {
9898
currentVideo.controls = true;
9999
currentVideo.autoplay = false;
100-
}else{
100+
} else {
101101
currentVideo.controls = false;
102102
currentVideo.autoplay = true;
103103
currentVideo.muted = true;
@@ -119,7 +119,7 @@ const VideoStep = ({ expanded, video, title }) => {
119119
};
120120
}, [expanded, video]);
121121

122-
if(!title) {
122+
if (!title) {
123123
return (
124124
<div className={styles.stepVideo}>
125125
<video
@@ -128,7 +128,7 @@ const VideoStep = ({ expanded, video, title }) => {
128128
/>
129129
</div>
130130
);
131-
}else{
131+
} else {
132132
return (
133133
<Fragment>
134134
<div className={styles.stepTitle}>
@@ -172,6 +172,20 @@ ImageStep.propTypes = {
172172
title: PropTypes.node.isRequired
173173
};
174174

175+
const HTMLStep = ({ title, html }) => (
176+
<Fragment>
177+
<div dangerouslySetInnerHTML={{ __html: html }} style={{ marginTop: '30px' }} />
178+
<div className={styles.stepTitle} style={{ marginTop: 'auto', marginBottom: 'auto' }}>
179+
{title}
180+
</div>
181+
</Fragment>
182+
);
183+
184+
HTMLStep.propTypes = {
185+
//image: PropTypes.string.isRequired,
186+
title: PropTypes.node.isRequired
187+
};
188+
175189
const NextPrevButtons = ({ isRtl, onNextStep, onPrevStep, expanded }) => (
176190
<Fragment>
177191
{onNextStep ? (
@@ -223,9 +237,9 @@ const PreviewsStep = ({ deckIds, content, onActivateDeckFactory, onShowAll }) =>
223237
<Fragment>
224238
<div className={styles.stepTitle}>
225239
<FormattedMessage
226-
defaultMessage="More things to try!"
227-
description="Title card with more things to try"
228-
id="gui.cards.more-things-to-try"
240+
defaultMessage="Next Steps!"
241+
description="Title card with next steps"
242+
id="gui.cards.next-steps"
229243
/>
230244
</div>
231245
<div className={styles.decks}>
@@ -244,18 +258,6 @@ const PreviewsStep = ({ deckIds, content, onActivateDeckFactory, onShowAll }) =>
244258
</div>
245259
))}
246260
</div>
247-
<div className={styles.seeAll}>
248-
<div
249-
className={styles.seeAllButton}
250-
onClick={onShowAll}
251-
>
252-
<FormattedMessage
253-
defaultMessage="See more"
254-
description="Title for button to see more in how-to library"
255-
id="gui.cards.see-more"
256-
/>
257-
</div>
258-
</div>
259261
</Fragment>
260262
);
261263

@@ -353,37 +355,41 @@ const Cards = props => {
353355
onShrinkExpandCards={onShrinkExpandCards}
354356
/>
355357
<div className={expanded ? styles.stepBody : styles.hidden}>
356-
{steps[step].deckIds ? (
358+
{steps[step].innerHTML ? (
359+
<HTMLStep
360+
html={steps[step].innerHTML}
361+
title={steps[step].title}
362+
/>
363+
) : steps[step].deckIds ? (
357364
<PreviewsStep
358365
content={content}
359366
deckIds={steps[step].deckIds}
360367
onActivateDeckFactory={onActivateDeckFactory}
361368
onShowAll={onShowAll}
362369
/>
363-
) : (
364-
steps[step].video ? (
365-
showVideos ? (
366-
<VideoStep
367-
dragging={dragging}
368-
expanded={expanded}
369-
video={translateVideo(steps[step].video, locale)}
370-
title={steps[step].title}
371-
/>
372-
) : ( // Else show the deck image and title
373-
<ImageStep
374-
image={content[activeDeckId].img}
375-
title={content[activeDeckId].name}
376-
/>
377-
)
370+
) : steps[step].video ? (
371+
showVideos ? (
372+
<VideoStep
373+
dragging={dragging}
374+
expanded={expanded}
375+
video={translateVideo(steps[step].video, locale)}
376+
title={steps[step].title}
377+
/>
378378
) : (
379379
<ImageStep
380-
image={steps[step].img}
381-
title={steps[step].title}
380+
image={content[activeDeckId].img}
381+
title={content[activeDeckId].name}
382382
/>
383383
)
384+
) : (
385+
<ImageStep
386+
image={steps[step].img}
387+
title={steps[step].title}
388+
/>
384389
)}
385390
{steps[step].trackingPixel && steps[step].trackingPixel}
386391
</div>
392+
387393
<NextPrevButtons
388394
expanded={expanded}
389395
isRtl={isRtl}

‎src/lib/libraries/decks/index.jsx‎

Lines changed: 62 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -19,112 +19,78 @@ export const CATEGORIES = {
1919
};
2020

2121
export default {
22-
23-
Torchy: {
22+
UseTorchy: {
2423
name: (
2524
<FormattedMessage
26-
defaultMessage="Using Torchy"
27-
description="Name for the 'Using Torchy' tutorial"
28-
id="gui.howtos.ai-getting-started.name"
25+
defaultMessage="How to use Torchy"
26+
description="Name for the 'Use Torchy' tutorial"
27+
id="gui.gettingStarted.ai-use.name"
2928
/>
3029
),
3130
img: libraryAnimateChar,
3231
category: CATEGORIES.gettingStarted,
3332
steps: [
3433
{
35-
video: AI_HOST + '/opening-popup.mp4',
3634
title: (
3735
<FormattedMessage
38-
defaultMessage="Open the Torchy Popup"
39-
description="Step name for 'Add a Sprite' step"
40-
id="gui.howtos.animate-char.open-torchy"
36+
defaultMessage="Welcome, this tutorial will show you how to use Torchy"
37+
description="Step name for 'Welcome' step"
38+
id="gui.gettingStarted.ai-use.welcome"
39+
/>
40+
),
41+
innerHTML: "<style>@keyframes scaleUpDown{0%,100%{transform:scaleY(1) scaleX(1)}50%,90%{transform:scaleY(1.1)}75%{transform:scaleY(.95)}80%{transform:scaleX(.95)}}@keyframes shake{0%,100%{transform:skewX(0) scale(1)}50%{transform:skewX(5deg) scale(.9)}}@keyframes particleUp{0%{opacity:0}20%{opacity:1}80%{opacity:1}100%{opacity:0;top:-100%;transform:scale(.5)}}@keyframes glow{0%,100%{background-color:#ef5a00}50%{background-color:#ff7800}}.fire{width:60px;height:60px;background-color:transparent;margin-left:8px;margin-top:17px;position:relative;display:block;}.fire-center{position:absolute;height:100%;width:100%;animation:scaleUpDown 3s ease-out;animation-iteration-count:infinite;animation-fill-mode:both}.fire-center .main-fire{position:absolute;width:100%;height:100%;background-image:radial-gradient(farthest-corner at 10px 0,#d43300 0,#ef5a00 95%);transform:scaleX(.8) rotate(45deg);border-radius:0 40% 60% 40%;filter:drop-shadow(0 0 10px #d43322)}.fire-center .particle-fire{position:absolute;top:60%;left:45%;width:2px;height:2px;background-color:#ef5a00;border-radius:50%;filter:drop-shadow(0 0 10px #d43322);animation:particleUp 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-right{height:100%;width:100%;position:absolute;animation:shake 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-right .main-fire{position:absolute;top:15%;right:-25%;width:80%;height:80%;background-color:#ef5a00;transform:scaleX(.8) rotate(45deg);border-radius:0 40% 60% 40%;filter:drop-shadow(0 0 10px #d43322)}.fire-right .particle-fire{position:absolute;top:45%;left:50%;width:3.0303030303030303px;height:3.0303030303030303px;background-color:#ef5a00;transform:scaleX(.8) rotate(45deg);border-radius:50%;filter:drop-shadow(0 0 10px #d43322);animation:particleUp 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-left{position:absolute;height:100%;width:100%;animation:shake 3s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-left .main-fire{position:absolute;top:15%;left:-20%;width:80%;height:80%;background-color:#ef5a00;transform:scaleX(.8) rotate(45deg);border-radius:0 40% 60% 40%;filter:drop-shadow(0 0 10px #d43322)}.fire-left .particle-fire{position:absolute;top:10%;left:20%;width:10%;height:10%;background-color:#ef5a00;border-radius:50%;filter:drop-shadow(0 0 10px #d43322);animation:particleUp 3s infinite ease-out 0;animation-fill-mode:both}.fire-bottom .main-fire{position:absolute;top:30%;left:20%;width:75%;height:75%;background-color:#ff7800;transform:scaleX(.8) rotate(45deg);border-radius:0 40% 100% 40%;filter:blur(10px);animation:glow 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}</style><div class=fire><div class=fire-left><div class=main-fire></div><div class=particle-fire></div></div><div class=fire-center><div class=main-fire></div><div class=particle-fire></div></div><div class=fire-right><div class=main-fire></div><div class=particle-fire></div></div><div class=fire-bottom><div class=main-fire></div></div></div>"
42+
},
43+
{
44+
title: (
45+
<FormattedMessage
46+
defaultMessage="Add your API keys (go to addons page and follow the instructions)"
47+
description="Step name for 'Add your API keys' step"
48+
id="gui.gettingStarted.ai-use.addApiKeys"
49+
/>
50+
),
51+
video: AI_HOST + '/open-addons-tab.mp4',
52+
},
53+
{
54+
title: (
55+
<FormattedMessage
56+
defaultMessage="There are 2 ways to open the Torchy popup"
57+
description="Step name for 'There are 2 ways to open the Torchy popup' step"
58+
id="gui.gettingStarted.ai-use.openPopup"
59+
/>
60+
),
61+
video: AI_HOST + '/open-popup.mp4',
62+
},
63+
{
64+
title: (
65+
<FormattedMessage
66+
defaultMessage="Torchy's UI:"
67+
description="Step name for 'popup User Interface' step"
68+
id="gui.gettingStarted.ai-use.popupUI"
69+
/>
70+
),
71+
img: AI_HOST + '/popup-ui.png',
72+
},
73+
{
74+
title: (
75+
<FormattedMessage
76+
defaultMessage="To insert code into the editor, click the 'Insert' button"
77+
description="Step name for 'Insert code into the editor' step"
78+
id="gui.gettingStarted.ai-use.insertCode"
79+
/>
80+
),
81+
img: AI_HOST + '/insert-code.png',
82+
},
83+
{
84+
title: (
85+
<FormattedMessage
86+
defaultMessage="That's it!"
87+
description="Step name for 'That's it!' step"
88+
id="gui.gettingStarted.ai-use.thatsIt"
4189
/>
4290
),
43-
}
91+
innerHTML: "<style>@keyframes scaleUpDown{0%,100%{transform:scaleY(1) scaleX(1)}50%,90%{transform:scaleY(1.1)}75%{transform:scaleY(.95)}80%{transform:scaleX(.95)}}@keyframes shake{0%,100%{transform:skewX(0) scale(1)}50%{transform:skewX(5deg) scale(.9)}}@keyframes particleUp{0%{opacity:0}20%{opacity:1}80%{opacity:1}100%{opacity:0;top:-100%;transform:scale(.5)}}@keyframes glow{0%,100%{background-color:#ef5a00}50%{background-color:#ff7800}}.fire{width:60px;height:60px;background-color:transparent;margin-left:8px;margin-top:17px;position:relative;display:block;}.fire-center{position:absolute;height:100%;width:100%;animation:scaleUpDown 3s ease-out;animation-iteration-count:infinite;animation-fill-mode:both}.fire-center .main-fire{position:absolute;width:100%;height:100%;background-image:radial-gradient(farthest-corner at 10px 0,#d43300 0,#ef5a00 95%);transform:scaleX(.8) rotate(45deg);border-radius:0 40% 60% 40%;filter:drop-shadow(0 0 10px #d43322)}.fire-center .particle-fire{position:absolute;top:60%;left:45%;width:2px;height:2px;background-color:#ef5a00;border-radius:50%;filter:drop-shadow(0 0 10px #d43322);animation:particleUp 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-right{height:100%;width:100%;position:absolute;animation:shake 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-right .main-fire{position:absolute;top:15%;right:-25%;width:80%;height:80%;background-color:#ef5a00;transform:scaleX(.8) rotate(45deg);border-radius:0 40% 60% 40%;filter:drop-shadow(0 0 10px #d43322)}.fire-right .particle-fire{position:absolute;top:45%;left:50%;width:3.0303030303030303px;height:3.0303030303030303px;background-color:#ef5a00;transform:scaleX(.8) rotate(45deg);border-radius:50%;filter:drop-shadow(0 0 10px #d43322);animation:particleUp 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-left{position:absolute;height:100%;width:100%;animation:shake 3s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}.fire-left .main-fire{position:absolute;top:15%;left:-20%;width:80%;height:80%;background-color:#ef5a00;transform:scaleX(.8) rotate(45deg);border-radius:0 40% 60% 40%;filter:drop-shadow(0 0 10px #d43322)}.fire-left .particle-fire{position:absolute;top:10%;left:20%;width:10%;height:10%;background-color:#ef5a00;border-radius:50%;filter:drop-shadow(0 0 10px #d43322);animation:particleUp 3s infinite ease-out 0;animation-fill-mode:both}.fire-bottom .main-fire{position:absolute;top:30%;left:20%;width:75%;height:75%;background-color:#ff7800;transform:scaleX(.8) rotate(45deg);border-radius:0 40% 100% 40%;filter:blur(10px);animation:glow 2s ease-out 0;animation-iteration-count:infinite;animation-fill-mode:both}</style><div class=fire><div class=fire-left><div class=main-fire></div><div class=particle-fire></div></div><div class=fire-center><div class=main-fire></div><div class=particle-fire></div></div><div class=fire-right><div class=main-fire></div><div class=particle-fire></div></div><div class=fire-bottom><div class=main-fire></div></div></div>"
92+
},
4493
],
45-
urlId: 'torchy'
46-
}
47-
};
48-
49-
50-
/* {
51-
video: 's228u3g5u9'
52-
},
53-
{
54-
title: (
55-
<FormattedMessage
56-
defaultMessage="Add a Backdrop"
57-
description="Step name for 'Add a Backdrop' step"
58-
id="gui.howtos.animate-char.step_addbg"
59-
/>
60-
),
61-
image: 'animateCharPickBackdrop'
62-
}, {
63-
title: (
64-
<FormattedMessage
65-
defaultMessage="Add a Sprite"
66-
description="Step name for 'Add a Sprite' step"
67-
id="gui.howtos.animate-char.step_addsprite"
68-
/>
69-
),
70-
image: 'animateCharPickSprite'
71-
}, {
72-
title: (
73-
<FormattedMessage
74-
defaultMessage="Say Something"
75-
description="Step name for 'Say Something' step"
76-
id="gui.howtos.animate-char.step_saysomething"
77-
/>
78-
),
79-
image: 'animateCharSaySomething'
80-
}, {
81-
title: (
82-
<FormattedMessage
83-
defaultMessage="Add Sound"
84-
description="Step name for 'Add Sound' step"
85-
id="gui.howtos.animate-char.step_addsound"
86-
/>
87-
),
88-
image: 'animateCharAddSound'
89-
}, {
90-
title: (
91-
<FormattedMessage
92-
defaultMessage="Animate Talking"
93-
description="Step name for 'Animate Talking' step"
94-
id="gui.howtos.animate-char.step_animatetalking"
95-
/>
96-
),
97-
image: 'animateCharTalk'
98-
}, {
99-
title: (
100-
<FormattedMessage
101-
defaultMessage="Move Using Arrow Keys"
102-
description="Step name for 'Move Using Arrow Keys' step"
103-
id="gui.howtos.animate-char.step_arrowkeys"
104-
/>
105-
),
106-
image: 'animateCharMove'
107-
}, {
108-
title: (
109-
<FormattedMessage
110-
defaultMessage="Jump"
111-
description="Step name for 'Jump' step"
112-
id="gui.howtos.animate-char.step_jump"
113-
/>
114-
),
115-
image: 'animateCharJump'
116-
}, {
117-
title: (
118-
<FormattedMessage
119-
defaultMessage="Change Color"
120-
description="Step name for 'Change Color' step"
121-
id="gui.howtos.animate-char.step_changecolor"
122-
/>
123-
),
124-
image: 'animateCharChangeColor'
125-
}, {
126-
deckIds: [
127-
'code-cartoon',
128-
'Tell-A-Story'
129-
]
130-
}*/
94+
urlId: 'use-torchy'
95+
},
96+
};

0 commit comments

Comments
 (0)