Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C23_WMDE_Desktop_DE_05 #182

Merged
merged 42 commits into from
Sep 25, 2023
Merged

C23_WMDE_Desktop_DE_05 #182

merged 42 commits into from
Sep 25, 2023

Conversation

Abban
Copy link
Member

@Abban Abban commented Sep 13, 2023

  • Adds a load of new Vue inputs and fields to replace the old Buefy ones.
  • Updates touched components from options to composition API and setup script.
  • Changes how DonationForm switching is handled to allow it to be A/B tested.
  • Adds a new donation address page.

Ticket: Ticket: https://phabricator.wikimedia.org/T345528

@Abban Abban force-pushed the C23_WMDE_Desktop_DE_05 branch from bfc5d1c to 01a2039 Compare September 13, 2023 13:27
Base automatically changed from update-vue to main September 14, 2023 11:29
@Abban Abban force-pushed the C23_WMDE_Desktop_DE_05 branch from 11231b9 to bc097da Compare September 15, 2023 10:15
@Abban Abban force-pushed the C23_WMDE_Desktop_DE_05 branch 2 times, most recently from 6e46e0e to 4b7e73c Compare September 18, 2023 12:14
* Remove component tag to allow easier A/B testing
* Improve tests

Ticket: https://phabricator.wikimedia.org/T345528
* Moved functionality into composables
* Added more tests

Ticket: https://phabricator.wikimedia.org/T345528
These inputs are all ripped from Buefy and are going to be replaced

Ticket: https://phabricator.wikimedia.org/T345528
This adds a reusable radio field component.
Also adds tests for both.

Ticket: https://phabricator.wikimedia.org/T345528
* Mailing List is what the donors are signing up to
  so rename it from newsletter.
* The CheckboxMultipleFormInput component will be used
  for the incentive field on the membership form.
* Add a model composable.
* Add tests for checkbox and mailing list components.

Ticket: https://phabricator.wikimedia.org/T345528
* Add tests
* Modify the Text Input so it bubbles events properly
* Add @test alias to jest and ts configs

Ticket: https://phabricator.wikimedia.org/T345528
* New donation form is now functional but ugly
* Adjusted form inputs to allow more model types
* Fixed DonationForm tests

Ticket: https://phabricator.wikimedia.org/T345528
This adds the styles with the new spacing guidelines
to the new input fields.

Ticket: https://phabricator.wikimedia.org/T345528
Adds hidden fields to post tracking and payment
information when the form is submitted.

Ticket: https://phabricator.wikimedia.org/T345528
This fixes validation and field names to make sure
the form submits to the application correctly.

https://phabricator.wikimedia.org/T345528
This adds a new donation summary to cover display
of the new company donor with contact details.

Ticket: https://phabricator.wikimedia.org/T345528
Add a hidden field to the country autocomplete
that contains the country code to be submitted to
the application.

Ticket: https://phabricator.wikimedia.org/T345528
The salutation should be re-localised if the
donor changes language after selecting one.

Ticket: https://phabricator.wikimedia.org/T345528
@Abban Abban force-pushed the C23_WMDE_Desktop_DE_05 branch from 4b7e73c to 71a60c4 Compare September 18, 2023 12:38
Abban and others added 3 commits September 18, 2023 14:45
For some (currently unknown reason) the form does not send the IBAN any
more when its rendering component has no name attribute
Copy link
Member

@gbirke gbirke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like all the changes you made here. Moving all store-related interactions to composables introduces a nice facade for the store and shows the future API of what state setting and getting we need.
At the moment, I'd leave the composables as-is and only split them further if a feature requires that.

I'm approving this so we can get this off the table quickly, even though some of the changes are confusing to me and I don't feel comfortable working on the frontend as long as there are bits in it I don't understand the purpose of.


<style scoped lang="scss">

</style>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub syntax highlighting for this is broken. We can probably live with that, but it's annoying. Maybe it's the question mark in line 16? You could move that to a computed property or you could raise an issue with the GitHub team

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try hitting Vue Language Server -> Restart in the bottom right of the code window in PhpStorm. We still have some weird issues hanging on where it stops working properly.

@@ -0,0 +1,11 @@
import { Ref, ref, UnwrapRef, watch } from 'vue';

export function useFieldModel<T>( modelValue: () => UnwrapRef<T>, initialValue: T ): Ref<UnwrapRef<T>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still very confused why we need this and what problem this solves. My best guess that this is something about the hierarchy and two-way data binding: having a "parent" component that receives update events from a child component, sending the value from the event to the store (which might modify them) and then sending the modified value to back to the child component (to update its internal ref)?

Also, why is modelValue an anonymous function that returns something? Is this just convenience for watch? The call of this is confusing, because we always pass in the function made form the prop and then the same prop as initialvalue. coulnd't we call the function for the initial value?

I'm also confused by the usage of the modelValue inside the other composables, maybe you can explain that a bit as well.

Please write some documentation on this pattern

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you pass the model value straight to an input model from the props you get:

VueCompilerError: v-model cannot be used on a prop, because local prop bindings are not writable. Use a v-bind binding combined with a v-on listener that emits update:x event instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why is modelValue an anonymous function that returns something?

Looking at it again, I can see I ran into loads of TS typing issues when I try to pass a prop straight through


interface Props {
modelValue: Array<string | number>;
nativeValue: string | number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the naming here. What's the purpose and difference between CheckboxMultipleFormInput and CheckboxSingleFormInput?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs show that there are different methods of using a checkbox as a group with an array and as a boolean value: https://vuejs.org/guide/essentials/forms.html#checkbox

Rather than have a single one that muddles it's way through how it should bind values differently depending on if it has an Array as it's modelValue or not I decided that WET was better here.

The multiple one will be used on the incentives field in the membership form (But mabe that field should actually be a radio)

click(): void,
};

export function useInputFocusing(): ReturnType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a docblock here to explain what this does? It's like a polyfill that unifies label click behavior across browsers, right?

@@ -0,0 +1,23 @@
import { computed, ref, UnwrapRef, watch, WritableComputedRef } from 'vue';

export function useInputModel<T>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be similar to useFieldModel, could you elaborate on similarities and differences, maybe add a docblock what this is for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fieldModel is only for watching updates to it's own v-model so it can pass those updates to the child input. The inputModel is a 2 way binding between the actual html input and the outer v-model, it bubbles change events and also watches for changes in it's outer model.

If a campaign times out then this allows a fallback
slot to be rendered.

Ticket: https://phabricator.wikimedia.org/T345528
@Abban Abban force-pushed the C23_WMDE_Desktop_DE_05 branch from 8fc28fb to 23b4311 Compare September 21, 2023 05:41
@Abban Abban marked this pull request as ready for review September 21, 2023 05:44
@Abban Abban mentioned this pull request Sep 21, 2023
Abban and others added 9 commits September 21, 2023 15:17
If a campaign times out then this allows a fallback
slot to be rendered.

Ticket: https://phabricator.wikimedia.org/T345528
- A new component that renders different text on the submit button of the donation form,
depending on the payment type.
- removes info text in the summary that explained the button before

- renaming isDirectDebit to isDirectDebitPayment to unify it with the others and the getters in the store
- adding a test for the new component

Ticket: https://phabricator.wikimedia.org/T344426
* Renames the form_inputs to form_elements
* Adds new buttons
* Add component and styles for the payment summary

Ticket: https://phabricator.wikimedia.org/T345722
New styles for donation payment summary
- the form should submit the values collected in SubmitValues.vue

- the code from both useAddressFormEventHandlers was adjusted to not diverge too much

- trackFormSubmission() is removed from the DonationReceipt bucket because the tracking
currently does not work there

belongs to the changes in https://phabricator.wikimedia.org/T345528
@moiikana moiikana merged commit 68f3b5d into main Sep 25, 2023
1 check passed
@moiikana moiikana deleted the C23_WMDE_Desktop_DE_05 branch September 25, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants