Skip to content

Commit cc8e8d4

Browse files
committed
refactor(tutorial): simplify hello_inject step
- Highlight inject button instead of entire editor container - Add button-specific pulse animation (background flash) - Remove 'Select Slot' feature item and i18n entries - Use inset box-shadow for highlight (avoids overflow clipping) - Update gate hint to reference flashing button Signed-off-by: VIFEX <vifextech@foxmail.com>
1 parent f583881 commit cc8e8d4

6 files changed

Lines changed: 39 additions & 26 deletions

File tree

Tools/WebServer/static/css/tutorial.css

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,49 @@
4141

4242
/* Highlighted target section */
4343
.tutorial-highlight-target {
44-
outline: 2px solid var(--vscode-focusBorder, #007acc);
45-
outline-offset: -2px;
44+
outline: none;
45+
box-shadow:
46+
inset 0 0 0 3px var(--vscode-focusBorder, #007acc),
47+
inset 0 0 12px rgba(0, 122, 204, 0.3);
4648
border-radius: 4px;
47-
transition: outline-color 0.3s ease;
49+
transition: box-shadow 0.3s ease;
4850
}
4951

5052
.tutorial-highlight-pulse {
5153
animation: tutorial-pulse 2s ease-in-out infinite;
5254
}
5355

56+
/* Button-specific highlight: flash background color */
57+
button.tutorial-highlight-target {
58+
outline: none;
59+
box-shadow: none;
60+
animation: tutorial-btn-pulse 1s ease-in-out infinite;
61+
border-radius: 4px;
62+
}
63+
64+
@keyframes tutorial-btn-pulse {
65+
0%,
66+
100% {
67+
background: var(--vscode-button-bg, #007acc);
68+
filter: brightness(1);
69+
}
70+
50% {
71+
background: var(--vscode-button-bg, #007acc);
72+
filter: brightness(1.6);
73+
}
74+
}
75+
5476
@keyframes tutorial-pulse {
5577
0%,
5678
100% {
57-
outline-color: var(--vscode-focusBorder, #007acc);
79+
box-shadow:
80+
inset 0 0 0 3px var(--vscode-focusBorder, #007acc),
81+
inset 0 0 12px rgba(0, 122, 204, 0.3);
5882
}
5983
50% {
60-
outline-color: rgba(0, 122, 204, 0.4);
84+
box-shadow:
85+
inset 0 0 0 3px rgba(0, 122, 204, 0.5),
86+
inset 0 0 20px rgba(0, 122, 204, 0.15);
6187
}
6288
}
6389

Tools/WebServer/static/js/features/tutorial.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const TUTORIAL_STEPS = [
6666
{
6767
id: 'hello_inject',
6868
sidebar: null,
69-
highlight: '#editorContainer',
69+
highlight: '#injectBtn',
7070
gate: () => {
7171
const slotStates = window.FPBState?.slotStates || [];
7272
return slotStates.some((s) => s && s.occupied);
@@ -861,7 +861,7 @@ const stepRenderers = {
861861
hello_inject() {
862862
const step = TUTORIAL_STEPS.find((s) => s.id === 'hello_inject');
863863
return `
864-
<p>${t('tutorial.hello_inject_desc', 'The generated patch template can be injected directly. Select a slot and click inject.')}</p>
864+
<p>${t('tutorial.hello_inject_desc', 'Edit the patch code, then click the flashing Inject button.')}</p>
865865
<div class="tutorial-feature-list">
866866
<div class="tutorial-feature-item">
867867
<i class="codicon codicon-edit"></i>
@@ -870,18 +870,11 @@ const stepRenderers = {
870870
${t('tutorial.hello_inject_edit_desc', 'Change the <code>fl_println</code> string to your own message.')}
871871
</div>
872872
</div>
873-
<div class="tutorial-feature-item">
874-
<i class="codicon codicon-layers"></i>
875-
<div>
876-
<strong>${t('tutorial.hello_inject_slot', 'Select Slot')}</strong>
877-
${t('tutorial.hello_inject_slot_desc', 'Make sure an available FPB slot is selected in the toolbar.')}
878-
</div>
879-
</div>
880873
<div class="tutorial-feature-item">
881874
<i class="codicon codicon-play"></i>
882875
<div>
883876
<strong>${t('tutorial.hello_inject_run', 'Click Inject')}</strong>
884-
${t('tutorial.hello_inject_run_desc', 'Click the inject button in the toolbar and wait for completion.')}
877+
${t('tutorial.hello_inject_run_desc', 'Click the flashing inject button in the toolbar and wait for completion.')}
885878
</div>
886879
</div>
887880
</div>

Tools/WebServer/static/js/locales/en.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,9 @@ window.i18nResources['en'] = {
586586
hello_inject_desc: 'Modify the code and click inject.',
587587
hello_inject_edit: 'Edit Code',
588588
hello_inject_edit_desc: 'Change the <code>fl_println</code> string',
589-
hello_inject_slot: 'Select Slot',
590-
hello_inject_slot_desc: 'Select an available slot in toolbar',
591589
hello_inject_run: 'Click Inject',
592590
hello_inject_run_desc: 'Toolbar → Inject button',
593-
gate_hello_inject: 'Select slot → click Inject',
591+
gate_hello_inject: 'Click the flashing Inject button',
594592
gate_hello_inject_ok: '✅ Injection successful!',
595593

596594
gate_hello_verify: 'Switch to Serial terminal tab',

Tools/WebServer/static/js/locales/zh-CN.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,9 @@ window.i18nResources['zh-CN'] = {
545545
hello_inject_desc: '修改代码后点击注入。',
546546
hello_inject_edit: '修改代码',
547547
hello_inject_edit_desc: '修改 <code>fl_println</code> 中的字符串',
548-
hello_inject_slot: '选择 Slot',
549-
hello_inject_slot_desc: '工具栏选择可用槽位',
550548
hello_inject_run: '点击「注入」',
551549
hello_inject_run_desc: '工具栏 → 注入按钮',
552-
gate_hello_inject: '选择槽位 → 点击「注入」',
550+
gate_hello_inject: '点击闪烁的「注入」按钮',
553551
gate_hello_inject_ok: '✅ 注入成功!',
554552

555553
gate_hello_verify: '切换到「串口」终端标签页',

Tools/WebServer/static/js/locales/zh-TW.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,9 @@ window.i18nResources['zh-TW'] = {
546546
hello_inject_desc: '修改程式碼後點擊注入。',
547547
hello_inject_edit: '修改程式碼',
548548
hello_inject_edit_desc: '修改 <code>fl_println</code> 中的字串',
549-
hello_inject_slot: '選擇 Slot',
550-
hello_inject_slot_desc: '工具列選擇可用槽位',
551549
hello_inject_run: '點擊「注入」',
552550
hello_inject_run_desc: '工具列 → 注入按鈕',
553-
gate_hello_inject: '選擇槽位 → 點擊「注入」',
551+
gate_hello_inject: '點擊閃爍的「注入」按鈕',
554552
gate_hello_inject_ok: '✅ 注入成功!',
555553

556554
gate_hello_verify: '切換到「串口」終端標籤頁',

Tools/WebServer/tests/js/test_tutorial.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ module.exports = function (w) {
621621
assertTrue(body.innerHTML.includes('Inject'));
622622
});
623623

624-
it('hello_inject step has 3 feature items', () => {
624+
it('hello_inject step has 2 feature items', () => {
625625
resetMocks();
626626
clearTutorialStorage();
627627
setupTutorialDOM();
@@ -630,7 +630,7 @@ module.exports = function (w) {
630630
const body = getElement('tutorialBody');
631631
const count = (body.innerHTML.match(/tutorial-feature-item/g) || [])
632632
.length;
633-
assertEqual(count, 3);
633+
assertEqual(count, 2);
634634
});
635635
});
636636

0 commit comments

Comments
 (0)