Skip to content

Commit

Permalink
Update copy on DonationStep (#7083)
Browse files Browse the repository at this point in the history
* Update copy on `DonationStep`

* Remove old `DonationStep`

* Adjust test
  • Loading branch information
dem4ron authored Oct 10, 2024
1 parent 9f005d1 commit 8d9217c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
4 changes: 4 additions & 0 deletions app/helpers/react_components/student/mentoring_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def to_h
videos:,
donation: {
show_donation_modal:,
previous_donor:,
request: {
endpoint: Exercism::Routes.current_api_payments_subscriptions_url,
options: {
Expand Down Expand Up @@ -111,6 +112,9 @@ def iterations
SerializeIterations.(solution.iterations, comment_counts:)
end

memoize
def previous_donor = current_user.total_donated_in_dollars.positive?

def show_donation_modal
return false if current_user.insider?
return false if current_user.donated_in_last_35_days?
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/components/modals/BegModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default function ({
)
}

function PreviousDonorContent() {
export function PreviousDonorContent() {
return (
<>
<p className="text-p-large mb-12">
Expand All @@ -184,7 +184,7 @@ function PreviousDonorContent() {
)
}

function NonDonorContent() {
export function NonDonorContent() {
return (
<>
<p className="text-p-large mb-12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MentoringSessionDonation } from '@/components/types'
import currency from 'currency.js'
import { DiscussionActionsLinks } from '@/components/student/mentoring-session/DiscussionActions'
import { PaymentIntentType } from '@/components/donations/stripe-form/useStripeForm'
import { PreviousDonorContent, NonDonorContent } from '../../BegModal'
const Form = lazy(() => import('@/components/donations/Form'))

export function DonationStep({
Expand All @@ -17,19 +18,31 @@ export function DonationStep({
return (
<div id="a11y-finish-mentor-discussion" className="flex flex-row">
<div className="mr-64 max-w-[700px]">
<h3 className="text-h4 mb-4 text-lightBlue">One more request…</h3>
<h1 className="text-h1 mb-12">
We need your help to keep Exercism alive.
</h1>
<p className="text-p-large mb-12">
Exercism relies on donations from wonderful people like you to keep us
financially alive. Currently, not enough people are donating to
Exercism and we may have to shut down the site. With your help, we can
keep the lights on, and also grow and expand our work.{' '}
<strong className="font-medium">
Please take one minute to watch this video and see how your donation
will help 👇
</strong>
<h3 className="text-h4 mb-4 text-prominentLinkColor">
One more request…
</h3>
<h1 className="text-h1 mb-12">Are you finding Exercism helpful?</h1>

<div className="mb-20 pb-20 border-b-1 border-borderColor7">
{!donation.previousDonor ? (
<PreviousDonorContent />
) : (
<NonDonorContent />
)}
</div>

<h3 className="text-h4 mb-6">Can't afford it?</h3>
<p className="text-p-large mb-20">
If you can&apos;t afford to donate, but would like to help in some
other way, please share Exercism with your friends and colleagues, and
shout about us on social media. The more people that use us, the more
donations we get!
</p>

<h3 className="text-h4 mb-6">Want to know more?</h3>
<p className="text-p-large mb-20">
I put together a short video that explains why we need donations and
how we use them 👇
</p>

<div className="c-youtube-container mb-32">
Expand All @@ -44,17 +57,6 @@ export function DonationStep({
<script src="https://player.vimeo.com/api/player.js" />
</div>

<h3 className="text-h3 mb-6">Want to help?</h3>
<p className="text-p-large mb-6">
If you can&apos;t afford to donate, please don&apos;t feel bad.
Exercism is free exactly so that people in your situation can learn.
Please just go and enjoy the platform! 🙂
</p>
<p className="text-p-large mb-16">
However, if you can spare a few dollars, please use the form to the
right to support us. Every little helps. Thank you! 💙
</p>

<div className="flex">
<a
href={links.exercise}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ export type MentoredTrackExercise = {

export type MentoringSessionDonation = {
showDonationModal: boolean
previousDonor: boolean
request: {
endpoint: string
options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class ReactComponents::Student::MentoringSessionTest < ReactComponentTestCase
videos: [],
donation: {
show_donation_modal: true,
previous_donor: false,
request: {
endpoint: Exercism::Routes.current_api_payments_subscriptions_url,
options: {
Expand Down Expand Up @@ -112,6 +113,7 @@ class ReactComponents::Student::MentoringSessionTest < ReactComponentTestCase
],
donation: {
show_donation_modal: true,
previous_donor: false,
request: {
endpoint: Exercism::Routes.current_api_payments_subscriptions_url,
options: {
Expand Down

0 comments on commit 8d9217c

Please sign in to comment.