11import { store } from "@/plugins/store" ;
22import type { Mode } from "@/types/store" ;
3+ import { TOUR_COPY } from "@adr-manager/core" ;
34
45export interface TourStep {
56 id : string ;
@@ -14,15 +15,49 @@ export interface TourStep {
1415
1516let modeBeforeToggleStep : Mode | undefined ;
1617let modeBeforeFieldVisibilityStep : Mode | undefined ;
18+ let demonstratedFilter : HTMLButtonElement | undefined ;
19+
20+ function setFilterPanelOpen ( open : boolean ) : void {
21+ const button = document . querySelector < HTMLButtonElement > ( '[data-cy="adr-filter-toggle"]' ) ;
22+ if ( button && ( button . getAttribute ( "aria-expanded" ) === "true" ) !== open ) {
23+ button . click ( ) ;
24+ }
25+ }
26+
27+ function setExampleFilterActive ( active : boolean ) : void {
28+ if ( active ) {
29+ setFilterPanelOpen ( true ) ;
30+ demonstratedFilter =
31+ document . querySelector < HTMLButtonElement > ( ".filter-panel .filter-chip:not(.tags-more-btn):not(.active)" ) ??
32+ undefined ;
33+ demonstratedFilter ?. click ( ) ;
34+ return ;
35+ }
36+ if ( demonstratedFilter ?. getAttribute ( "aria-pressed" ) === "true" ) {
37+ demonstratedFilter . click ( ) ;
38+ }
39+ demonstratedFilter = undefined ;
40+ setFilterPanelOpen ( false ) ;
41+ }
42+
43+ function setTemplateVersionMenuOpen ( open : boolean ) : void {
44+ const wrap = document . querySelector < HTMLElement > ( '[data-tour="template-version"]' ) ;
45+ wrap ?. dispatchEvent ( new CustomEvent < boolean > ( "tour-version-menu" , { detail : open } ) ) ;
46+ }
47+
48+ export function resetTourFilterDemonstration ( ) : void {
49+ setExampleFilterActive ( false ) ;
50+ setFilterPanelOpen ( false ) ;
51+ setTemplateVersionMenuOpen ( false ) ;
52+ }
1753
1854export const tourSteps : TourStep [ ] = [
1955 {
2056 id : "intro" ,
2157 title : "Architectural Decision Records" ,
2258 body :
23- "An ADR is a short Markdown document that captures one architectural decision, the context behind it, " +
24- "the options that were considered and the outcome. ADR Manager lets you create, edit and commit ADRs " +
25- "in the MADR format directly in your Git repositories."
59+ TOUR_COPY . adrDefinition +
60+ " ADR Manager lets you create, edit and commit ADRs in the MADR format directly in your Git repositories."
2661 } ,
2762 {
2863 id : "explorer" ,
@@ -37,10 +72,25 @@ export const tourSteps: TourStep[] = [
3772 id : "adr-search" ,
3873 target : '[data-tour="adr-search"]' ,
3974 placement : "right" ,
40- title : "Search and filter ADRs" ,
41- body :
42- "Type in the search bar to find ADRs by title across all your repositories. Use the filter button " +
43- "to narrow down decisions by status, tags, or other criteria."
75+ title : "Search ADRs" ,
76+ body : TOUR_COPY . search
77+ } ,
78+ {
79+ id : "adr-filter" ,
80+ target : '[data-cy="adr-filter-toggle"]' ,
81+ placement : "right" ,
82+ title : "Filter ADRs" ,
83+ body : TOUR_COPY . filter ,
84+ onEnter : ( ) => setFilterPanelOpen ( true )
85+ } ,
86+ {
87+ id : "adr-filter-example" ,
88+ target : ( ) => document . querySelector ( ".filter-panel .filter-chip:not(.tags-more-btn)" ) ,
89+ placement : "right" ,
90+ title : "Apply a filter" ,
91+ body : "Selecting a status or tag immediately narrows the ADR list. Select it again to remove the filter." ,
92+ onEnter : ( ) => setExampleFilterActive ( true ) ,
93+ onExit : ( ) => setExampleFilterActive ( false )
4494 } ,
4595 {
4696 id : "switch-repository" ,
@@ -52,43 +102,47 @@ export const tourSteps: TourStep[] = [
52102 "Click a repository to expand it and make it active. You can keep several repositories open " +
53103 "and switch between them at any time."
54104 } ,
105+ {
106+ id : "delete-adr" ,
107+ target : '[data-cy="deleteAdrBtn"]' ,
108+ placement : "right" ,
109+ title : "Delete an ADR" ,
110+ body :
111+ "Hover an ADR in the explorer and click the trash icon to delete it. The deletion is staged " +
112+ "locally and only applied to the repository when you commit."
113+ } ,
55114 {
56115 id : "create-adr" ,
57116 target : '[data-cy="newADR"]' ,
58117 placement : "right" ,
59118 title : "Create a new ADR" ,
60119 body :
61120 "New ADR adds a numbered Markdown file based on the MADR template to the repository's " +
62- "ADR directory and opens it in the editor."
121+ "ADR directory and opens it in the editor. New setups default to docs/decisions; the status bar " +
122+ "shows the full path and active branch."
123+ } ,
124+ {
125+ id : "template-version" ,
126+ target : '[data-tour="template-version"]' ,
127+ placement : "bottom" ,
128+ title : "Choose the MADR version" ,
129+ body : TOUR_COPY . templateVersion ,
130+ onEnter : ( ) => setTemplateVersionMenuOpen ( true ) ,
131+ onExit : ( ) => setTemplateVersionMenuOpen ( false )
63132 } ,
64133 {
65134 id : "edit-adr" ,
66135 target : '[data-tour="editor"]' ,
67136 placement : "over" ,
68137 title : "Edit with structured fields" ,
69- body :
70- "The editor turns the MADR template into a form with fields like title, context, considered options " +
71- "and decision outcome. Everything you type is converted to Markdown as you go, and the title also " +
72- "becomes the file name."
73- } ,
74- {
75- id : "preview" ,
76- target : '[data-tour="preview"]' ,
77- placement : "left" ,
78- title : "Live Markdown preview" ,
79- body :
80- "This pane shows the generated Markdown in real time. You can also edit the raw Markdown here, " +
81- "the form and the source stay in sync."
138+ body : TOUR_COPY . editorIntro
82139 } ,
83140 {
84141 id : "toggle-fields" ,
85142 target : '[data-tour="mode-toggle"]' ,
86143 placement : "bottom" ,
87144 title : "Toggle optional fields" ,
88- body :
89- "This switch toggles the optional MADR fields. Professional mode reveals decision drivers, pros and " +
90- "cons per option and detailed consequences, while Basic keeps only the essentials. Hidden fields are " +
91- "kept in the file." ,
145+ body : TOUR_COPY . modeToggle ,
92146 onEnter : ( ) => {
93147 modeBeforeToggleStep = store . mode ;
94148 // Direct assignment so the demonstration does not persist a mode change.
@@ -106,7 +160,7 @@ export const tourSteps: TourStep[] = [
106160 target : '[data-tour="field-visibility"]' ,
107161 placement : "bottom" ,
108162 title : "Customize visible fields" ,
109- body : "The Fields button is a Professional mode feature that lets you toggle individual Professional mode sections on or off to match your personal preferences." ,
163+ body : TOUR_COPY . fieldVisibility ,
110164 onEnter : ( ) => {
111165 modeBeforeFieldVisibilityStep = store . mode ;
112166 store . mode = "professional" ;
@@ -119,23 +173,13 @@ export const tourSteps: TourStep[] = [
119173 }
120174 } ,
121175 {
122- id : "delete-adr" ,
123- target : '[data-cy="deleteAdrBtn"]' ,
124- placement : "right" ,
125- title : "Delete an ADR" ,
126- body :
127- "Hover an ADR in the explorer and click the trash icon to delete it. The deletion is staged " +
128- "locally and only applied to the repository when you commit."
129- } ,
130- {
131- id : "adr-directory" ,
132- target : '[data-tour="adr-path"]' ,
133- placement : "top" ,
134- title : "The ADR directory" ,
176+ id : "preview" ,
177+ target : '[data-tour="preview"]' ,
178+ placement : "left" ,
179+ title : "Live Markdown preview" ,
135180 body :
136- "Each repository keeps its ADRs in one directory, which ADR Manager detects automatically " +
137- "(new setups default to docs/decisions). The status bar shows the full path of the open ADR " +
138- "and the branch you are working on."
181+ "This pane shows the generated Markdown in real time. You can also edit the raw Markdown here, " +
182+ "the form and the source stay in sync."
139183 } ,
140184 {
141185 id : "commit" ,
0 commit comments