@@ -4,14 +4,17 @@ class KitchenTutorialStepsComponent < ApplicationComponent
44 def initialize ( tutorial_steps :, completed_steps :, current_user :)
55 @tutorial_steps = tutorial_steps
66 @completed_steps = completed_steps
7- @current_user = current_user
87 end
98
109 def view_template
11- div ( class : "tutorial-steps" ) do
12- div ( class : "tutorial-steps__header" ) do
10+ details ( class : "tutorial-steps" , open : !all_completed? ) do
11+ summary ( class : "tutorial-steps__header" ) do
12+ span ( class : "tutorial-steps__toggle-icon" ) do
13+ raw helpers . inline_svg_tag ( "icons/chevron-down.svg" , alt : "" )
14+ end
15+ span ( class : "tutorial-steps__title" ) { "Tutorial" }
1316 div ( class : "tutorial-steps__progress" ) do
14- span ( class : "tutorial-steps__progress-text" ) { "#{ completed_count } of #{ total_count } completed " }
17+ span ( class : "tutorial-steps__progress-text" ) { "#{ completed_count } of #{ total_count } " }
1518 div ( class : "tutorial-steps__progress-bar" ) do
1619 div ( class : "tutorial-steps__progress-fill" , style : "width: #{ progress_percentage } %" )
1720 end
@@ -26,6 +29,8 @@ def view_template
2629 end
2730 end
2831
32+ def all_completed? = completed_count == total_count
33+
2934 private
3035
3136 def render_step_card ( step )
@@ -60,9 +65,16 @@ def render_cta(step, completed, deps_ok, verb)
6065 return unless link
6166
6267 div ( class : "state-card__cta" ) do
63- button_to link , method : verb , form_class : "btn btn--borderless btn--bg_yellow" , data : { turbo : false } do
64- span { "Start" }
65- raw helpers . inline_svg_tag ( "icons/right-arrow.svg" )
68+ if verb == :get
69+ a ( href : link , class : "btn btn--borderless btn--bg_yellow" , data : { turbo : false } ) do
70+ span { "Start" }
71+ raw helpers . inline_svg_tag ( "icons/right-arrow.svg" )
72+ end
73+ else
74+ button_to link , method : verb , form_class : "btn btn--borderless btn--bg_yellow" , data : { turbo : false } do
75+ span { "Start" }
76+ raw helpers . inline_svg_tag ( "icons/right-arrow.svg" )
77+ end
6678 end
6779 end
6880 elsif !deps_ok
0 commit comments