Skip to content

Commit

Permalink
Post merge tweaks (#7081)
Browse files Browse the repository at this point in the history
* Start work on begging modal

* Add modal, adjust things, add props (#7080)

* Add modal, adjust things, add props

* Add success modal

* Progress further

* Add success + cancel flow

* Change success button close flow

* Fix path and improve tests

---------

Co-authored-by: Jeremy Walker <jez.walker@gmail.com>

* A few minor post-merge tweaks

* Remove default export of DonationStep

* Remove duplicate from dashboard, add modal to track-show

* Fix `mentor_finished_discussion_test`

---------

Co-authored-by: Aron Demeter <66035744+dem4ron@users.noreply.github.com>
Co-authored-by: dem4ron <demaaron88@gmail.com>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 45945bd commit f697edf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions app/helpers/react_components/modals/beg_modal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ def to_s
links: {
settings: Exercism::Routes.donations_settings_url,
success: Exercism::Routes.dashboard_url,
hide_introducer: Exercism::Routes.hide_api_settings_introducer_path(slug)
hide_introducer: Exercism::Routes.hide_api_settings_introducer_path(INTRODUCER_SLUG)
}
})
end

private
memoize
def show_modal?
return false if current_user.current_subscription
return false if current_user.donated_in_last_35_days?
return false unless current_user.solutions.count >= 5

dismissal = current_user.dismissed_introducers.find_by(slug:)
dismissal = current_user.dismissed_introducers.find_by(slug: INTRODUCER_SLUG)
return true unless dismissal

if dismissal.created_at < 1.month.ago
Expand All @@ -40,10 +41,8 @@ def show_modal?
memoize
def previous_donor = current_user.total_donated_in_dollars.positive?

private
def slug
"beg-modal"
end
INTRODUCER_SLUG = "beg-modal".freeze
private_constant :INTRODUCER_SLUG
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,3 @@ export function DonationStep({
</div>
)
}

export default DonationStep
3 changes: 1 addition & 2 deletions app/views/dashboard/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
- require_stylesheet "track"

= render ReactComponents::Modals::BegModal.new

#page-dashboard
= render ReactComponents::Modals::WelcomeModal.new
= render ReactComponents::Modals::BegModal.new

.summary-bar
.lg-container.container
Expand Down
2 changes: 2 additions & 0 deletions app/views/tracks/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#page-track-show
= render ViewComponents::Track::Header.new(@track, :overview)
= render ReactComponents::Modals::TrackWelcomeModal.new(@track)
= render ReactComponents::Modals::BegModal.new

= render "tracks/show/summary_article", track: @track, user_track: @user_track, exercise_statuses: @exercise_statuses, recent_solutions: @recent_solutions, sample_learnt_concepts: @sample_learnt_concepts, sample_mastered_concepts: @sample_mastered_concepts, last_8_weeks_counts: @last_8_weeks_counts, forum_threads: @forum_threads, docs: @docs
= render "tracks/show/mentoring_article", track: @track, user_track: @user_track
= render "tracks/show/updates_article", track: @track, updates: @updates
4 changes: 2 additions & 2 deletions test/system/flows/student/mentor_finished_discussion_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class MentorFinishedDiscussionTest < ApplicationSystemTestCase
assert_css ".m-confirm-finish-student-mentor-discussion"
within(".m-confirm-finish-student-mentor-discussion") { click_on "Review and end discussion" }
click_on "It was good!"
fill_in "Leave #{discussion.mentor.handle} a testimonial (optional)",
with: "I am very satisfied with this mentor. He was amazing."
find("#testimonial").set("I am very satisfied with this mentor. He was amazing.")

click_on "Finish"
click_on "Continue without donating"

Expand Down

0 comments on commit f697edf

Please sign in to comment.