Skip to content

Commit

Permalink
Fix up new Use of Funds on Mobile DE banners
Browse files Browse the repository at this point in the history
- Remove unused infographic component
- Tweak styles to make full width work better

Ticket: https://phabricator.wikimedia.org/T381956
  • Loading branch information
Abban committed Feb 19, 2025
1 parent 46249c0 commit ae50baf
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 66 deletions.
15 changes: 2 additions & 13 deletions banners/mobile/C25_WMDE_Mobile_DE_00/components/BannerCtrl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,8 @@
:content="useOfFundsContent"
:visible="isFundsModalVisible"
@hide="onHideFundsModal"
@callToAction="onFundsModalCallToAction"
>
<template #infographic>
<WMDEFundsForwardingDE/>
</template>
</FundsModal>
@callToAction="onHideFundsModal"
/>
</div>
</template>

Expand Down Expand Up @@ -141,7 +137,6 @@ import {
createSubmittableUpgradeToYearly
} from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly';
import MainDonationFormButton from '@src/components/DonationForm/SubComponents/SubmitButtons/MainDonationFormButton.vue';
import WMDEFundsForwardingDE from '@src/components/UseOfFunds/Infographics/WMDEFundsForwardingDE.vue';
import ProgressBar from '../content/ProgressBar.vue';
import { LocalCloseTracker } from '@src/utils/LocalCloseTracker';
import { BannerSubmitOnReturnEvent } from '@src/tracking/events/BannerSubmitOnReturnEvent';
Expand Down Expand Up @@ -248,10 +243,4 @@ const onHideFundsModal = (): void => {
isFundsModalVisible.value = false;
};
const onFundsModalCallToAction = (): void => {
props.pageScroller.scrollIntoView( '.wmde-banner-form' );
isFundsModalVisible.value = false;
onshowFullPageBanner();
};
</script>
44 changes: 26 additions & 18 deletions banners/mobile/C25_WMDE_Mobile_DE_00/components/BannerVar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

<template #slides="{ currentSlide }: any">
<BannerSlides :currentSlide="currentSlide" :play-live-text="contentState === ContentStates.Mini">
<template #progress><ProgressBar/></template>
<template #progress>
<ProgressBar/>
</template>
</BannerSlides>
</template>

Expand All @@ -27,7 +29,9 @@
<BannerText :play-live-text="contentState === ContentStates.FullPage"/>
</template>

<template #progress><ProgressBar/></template>
<template #progress>
<ProgressBar/>
</template>

<template #donation-form="{ formInteraction }: any">
<MultiStepDonation
Expand Down Expand Up @@ -61,7 +65,8 @@
@previous="previous"
>
<template #back>
<ChevronLeftIcon/> {{ $translate( 'back-button' ) }}
<ChevronLeftIcon/>
{{ $translate( 'back-button' ) }}
</template>
</UpgradeToYearlyButtonForm>
</template>
Expand Down Expand Up @@ -105,11 +110,7 @@
:visible="isFundsModalVisible"
@hide="onHideFundsModal"
@callToAction="onFundsModalCallToAction"
>
<template #infographic>
<WMDEFundsForwardingDE/>
</template>
</FundsModal>
/>
</div>
</template>

Expand All @@ -135,14 +136,9 @@ import ChevronLeftIcon from '@src/components/Icons/ChevronLeftIcon.vue';
import { CloseChoices } from '@src/domain/CloseChoices';
import { CloseEvent } from '@src/tracking/events/CloseEvent';
import { TrackingFeatureName } from '@src/tracking/TrackingEvent';
import {
createSubmittableMainDonationForm
} from '@src/components/DonationForm/StepControllers/SubmittableMainDonationForm';
import {
createSubmittableUpgradeToYearly
} from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly';
import { createSubmittableMainDonationForm } from '@src/components/DonationForm/StepControllers/SubmittableMainDonationForm';
import { createSubmittableUpgradeToYearly } from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly';
import MainDonationFormButton from '@src/components/DonationForm/SubComponents/SubmitButtons/MainDonationFormButton.vue';
import WMDEFundsForwardingDE from '@src/components/UseOfFunds/Infographics/WMDEFundsForwardingDE.vue';
import ProgressBar from '../content/ProgressBar.vue';
import { LocalCloseTracker } from '@src/utils/LocalCloseTracker';
import { BannerSubmitOnReturnEvent } from '@src/tracking/events/BannerSubmitOnReturnEvent';
Expand Down Expand Up @@ -248,17 +244,29 @@ function onshowFullPageBannerPreselected(): void {
const onHideFundsModal = (): void => {
props.pageScroller.scrollIntoView( '.wmde-banner-form' );
isFundsModalVisible.value = false;
if ( contentState.value === ContentStates.Mini ) {
emit( 'modalClosed' );
}
};
const onShowFundsModal = ( feature: TrackingFeatureName ): void => {
tracker.trackEvent( new UseOfFundsShownEvent( feature ) );
isFundsModalVisible.value = true;
tracker.trackEvent( new UseOfFundsShownEvent( feature ) );
if ( contentState.value === ContentStates.Mini ) {
emit( 'modalOpened' );
}
};
const onFundsModalCallToAction = (): void => {
props.pageScroller.scrollIntoView( '.wmde-banner-form' );
isFundsModalVisible.value = false;
onshowFullPageBanner();
if ( contentState.value === ContentStates.Mini ) {
onshowFullPageBanner();
}
props.pageScroller.scrollIntoView( '.wmde-banner-form' );
};
</script>
6 changes: 5 additions & 1 deletion src/components/UseOfFunds2024/styles/UseOfFunds.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
padding: map.get( units.$spacing, 'small' );
line-height: 1.8;
font-size: 16px;
max-width: 100vw;

@include breakpoints.desktop-up {
padding: map.get( units.$spacing, 'large' );
Expand Down Expand Up @@ -146,10 +147,13 @@
padding: map.get( units.$spacing, 'small' );

@include breakpoints.tablet-up {
margin: 0 ( -( map.get( units.$spacing, 'large' ) ) ) map.get( units.$spacing, 'large' );
padding: map.get( units.$spacing, 'large' );
}

@include breakpoints.desktop-up {
margin: 0 ( -( map.get( units.$spacing, 'large' ) ) ) map.get( units.$spacing, 'large' );
}

h2 {
margin-bottom: map.get( units.$spacing, 'medium' );

Expand Down
4 changes: 2 additions & 2 deletions src/components/UseOfFunds2024/styles/swatches/color_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ $gray400: #979797;
$gray500: #555555;
$gray800: #323232;

$blue300: #88C7F6;
$blue300: #88c7f6;
$blue300-hover: color.adjust( $blue300, $lightness: 5% );
$blue500: #2C9BF0;
$blue500: #2c9bf0;
$blue500-hover: color.adjust( $blue500, $lightness: -5% );

@mixin swatch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
@media ( prefers-color-scheme: light ) {
@include color_light.swatch;
}
}
}
2 changes: 2 additions & 0 deletions src/page/PageWPORG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ class PageWPORG implements Page {
document.body.style.position = 'fixed';
document.body.style.top = `-${ scrollY }px`;
document.body.style.width = '100vw';
document.body.style.overflowX = 'hidden';
}

/**
Expand All @@ -239,6 +240,7 @@ class PageWPORG implements Page {
document.body.style.position = '';
document.body.style.top = '';
document.body.style.width = '';
document.body.style.overflowX = '';
window.scrollTo( 0, parseInt( scrollY || '0' ) * -1 );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newDynamicContent } from '@test/banners/dynamicCampaignContent';
import { useOfFundsContent } from '@test/banners/useOfFundsContent2024';
import { formItems } from '@test/banners/formItems';
import { CurrencyEn } from '@src/utils/DynamicContent/formatters/CurrencyEn';
import { useOfFundsFeatures } from '@test/features/UseOfFunds2024';
import { desktopUseOfFundsFeatures } from '@test/features/UseOfFunds2024';
import {
bannerContentAnimatedTextFeatures,
bannerContentDateAndTimeFeatures,
Expand Down Expand Up @@ -172,7 +172,7 @@ describe( 'BannerCtrl.vue', () => {
[ 'expectEmitsModalOpenedEvent' ],
[ 'expectEmitsModalClosedEvent' ]
] )( '%s', async ( testName: string ) => {
await useOfFundsFeatures[ testName ]( getWrapper() );
await desktopUseOfFundsFeatures[ testName ]( getWrapper() );
} );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newDynamicContent } from '@test/banners/dynamicCampaignContent';
import { useOfFundsContent } from '@test/banners/useOfFundsContent2024';
import { formItems } from '@test/banners/formItems';
import { CurrencyEn } from '@src/utils/DynamicContent/formatters/CurrencyEn';
import { useOfFundsFeatures } from '@test/features/UseOfFunds2024';
import { desktopUseOfFundsFeatures } from '@test/features/UseOfFunds2024';
import {
bannerContentAnimatedTextFeatures,
bannerContentDateAndTimeFeatures,
Expand Down Expand Up @@ -220,7 +220,7 @@ describe( 'BannerVar.vue', () => {
[ 'expectEmitsModalOpenedEvent' ],
[ 'expectEmitsModalClosedEvent' ]
] )( '%s', async ( testName: string ) => {
await useOfFundsFeatures[ testName ]( getWrapper() );
await desktopUseOfFundsFeatures[ testName ]( getWrapper() );
} );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newDynamicContent } from '@test/banners/dynamicCampaignContent';
import { useOfFundsContent } from '@test/banners/useOfFundsContent2024';
import { formItems } from '@test/banners/formItems';
import { CurrencyEn } from '@src/utils/DynamicContent/formatters/CurrencyEn';
import { useOfFundsFeatures } from '@test/features/UseOfFunds2024';
import { desktopUseOfFundsFeatures } from '@test/features/UseOfFunds2024';
import { bannerContentAnimatedTextFeatures, bannerContentDateAndTimeFeatures, bannerContentDisplaySwitchFeatures, bannerContentFeatures } from '@test/features/BannerContent';
import { TrackerStub } from '@test/fixtures/TrackerStub';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearlyButton';
Expand Down Expand Up @@ -132,7 +132,7 @@ describe( 'BannerCtrl.vue', () => {
[ 'expectEmitsModalOpenedEvent' ],
[ 'expectEmitsModalClosedEvent' ]
] )( '%s', async ( testName: string ) => {
await useOfFundsFeatures[ testName ]( getWrapper() );
await desktopUseOfFundsFeatures[ testName ]( getWrapper() );
} );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newDynamicContent } from '@test/banners/dynamicCampaignContent';
import { useOfFundsContent } from '@test/banners/useOfFundsContent2024';
import { formItems } from '@test/banners/formItems';
import { CurrencyEn } from '@src/utils/DynamicContent/formatters/CurrencyEn';
import { useOfFundsFeatures } from '@test/features/UseOfFunds2024';
import { desktopUseOfFundsFeatures } from '@test/features/UseOfFunds2024';
import { bannerContentAnimatedTextFeatures, bannerContentDateAndTimeFeatures, bannerContentDisplaySwitchFeatures, bannerContentFeatures } from '@test/features/BannerContent';
import { TrackerStub } from '@test/fixtures/TrackerStub';
import { donationFormFeatures } from '@test/features/forms/MainDonationDonationReceipt_UpgradeToYearlyButton';
Expand Down Expand Up @@ -181,7 +181,7 @@ describe( 'BannerVar.vue', () => {
[ 'expectEmitsModalOpenedEvent' ],
[ 'expectEmitsModalClosedEvent' ]
] )( '%s', async ( testName: string ) => {
await useOfFundsFeatures[ testName ]( getWrapper() );
await desktopUseOfFundsFeatures[ testName ]( getWrapper() );
} );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { newDynamicContent } from '@test/banners/dynamicCampaignContent';
import { CurrencyDe } from '@src/utils/DynamicContent/formatters/CurrencyDe';
import { formItems } from '@test/banners/formItems';
import { softCloseFeatures } from '@test/features/SoftCloseMobile';
import { useOfFundsFeatures, useOfFundsScrollFeatures } from '@test/features/UseOfFunds2024';
import { mobileUseOfFundsFeatures, useOfFundsScrollFeatures } from '@test/features/UseOfFunds2024';
import { miniBannerFeatures } from '@test/features/MiniBanner';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearlyButton';
import { useFormModel } from '@src/components/composables/useFormModel';
Expand Down Expand Up @@ -156,10 +156,12 @@ describe( 'BannerCtrl.vue', () => {

describe( 'Use of Funds', () => {
test.each( [
[ 'expectShowsUseOfFunds' ],
[ 'expectHidesUseOfFunds' ]
[ 'expectShowsUseOfFundsOnFullPageBanner' ],
[ 'expectHidesUseOfFundsOnFullPageBanner' ],
[ 'expectDoesNotEmitModalOpenedEventOnFullPageBanner' ],
[ 'expectDoesNotEmitModalClosedEventOnFullPageBanner' ],
] )( '%s', async ( testName: string ) => {
await useOfFundsFeatures[ testName ]( getWrapper() );
await mobileUseOfFundsFeatures[ testName ]( getWrapper() );
} );

test.each( [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CurrencyDe } from '@src/utils/DynamicContent/formatters/CurrencyDe';
import { formItems } from '@test/banners/formItems';
import { softCloseFeatures } from '@test/features/SoftCloseMobile';
import {
useOfFundsFeatures,
mobileUseOfFundsFeatures,
useOfFundsScrollFeatures,
useOfFundsTrackingFeatures
} from '@test/features/UseOfFunds2024';
Expand Down Expand Up @@ -160,11 +160,15 @@ describe( 'BannerVar.vue', () => {

describe( 'Use of Funds', () => {
test.each( [
[ 'expectShowsUseOfFunds' ],
[ 'expectShowsUseOfFundsOnMiniBanner' ],
[ 'expectHidesUseOfFunds' ]
[ 'expectShowsUseOfFundsOnFullPageBanner' ],
[ 'expectHidesUseOfFundsOnMiniBanner' ],
[ 'expectHidesUseOfFundsOnFullPageBanner' ],
[ 'expectEmitsModalOpenedEventOnMiniBanner' ],
[ 'expectEmitsModalClosedEventOnMiniBanner' ],
[ 'expectDoesNotEmitModalClosedEventOnFullPageBanner' ]
] )( '%s', async ( testName: string ) => {
await useOfFundsFeatures[ testName ]( getWrapper() );
await mobileUseOfFundsFeatures[ testName ]( getWrapper() );
} );

test.each( [
Expand Down
Loading

0 comments on commit ae50baf

Please sign in to comment.