-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
New group creation #325
New group creation #325
Conversation
This reverts commit 7eb5233.
4d31eea
to
69cbca1
Compare
} | ||
}, | ||
computed: { | ||
views: function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so, I haven't checked this myself yet, and I could be mistaken, but my gut tells me that:
- This doesn't need to be a function
- This doesn't need to be a computed property (have you tried the
data:
field?) - For the stuff inside of it, the
get
/set
stuff of the computed properties is also not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
yes it does, see the api docs: https://vuejs.org/v2/api/#computed also, it's using
this
inside to use properties defined in data, and this is how that context is bound to the right place -
and 3.: I did try the data field, which is good for setting an initial value, but what I want to achieve is binding that keeps up-to-date when changed in either the parent or this child component.
for this I needed to solve how to updateform.groupName
in the parent when the value in the step child component changes.
I tried numerous solutions for that:
- firing an event in the step component and manually propagating through 4 components to get here 🤾♀️🤾♂️🤾♀️🤾♂️, and
- creating createGroup's own event bus for a more direct communication between the step and the parent 🚎
that you can see in the previous commits.
both those ways seemed way more cumbersome than this solution, where I directly use the computed value's setter to update data in the parent component.
And you can't use getter/setters for data, only for computed props.
I'm still thinking about creating a little tool that automates this kind of binding and makes it less ugly (I miss React's HOCs), but apart from that, this is the simplest solution I could find. let me know if you still see ways to simplify!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it does, see the api docs: https://vuejs.org/v2/api/#computed also, it's using this inside to use properties defined in data, and this is how that context is bound to the right place
Ah you're right, I think I might have been just used to seeing it written as views ()
instead of views: function ()
, and subconsciously forgotten those are the same thing, lol.
OK, this looks good, I will still play with it and see if I can think of any other way, but I'm getting more convinced that you've found the correct approach.
Kudos on the connect
function, and nice job with making this PR conform to #297. 👍
:value="group.memberRemovalPercentage" | ||
@input="update" | ||
/> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this: instead of having the "change" link turn the textfield into an input field, have it reveal a slider below the numbers that the user can click and drag to adjust the number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: I'm reminded by this quote from our post on Deprecating Majority Rule:
Therefore, it is dangerous to use majority rule whenever supermajority rule should be used instead, e.g. passing laws. That is why we plan on making supermajority the default threshold for removing members in Group Income, since doing so can have a potentially significant impact on a person’s life.
We should make it so that a function is called when the slider is dragged, and when it's dragged to a "bad place", Group Income will be able to make a warning field appear that explains to them that they're choosing a value that is most likely too low, and even linking them to our blog posts, etc.
<hr> | ||
|
||
<h2 class="title is-6"><i18n>Group purpose:</i18n></h2> | ||
<p class="subtitle is-2" :class="!group.sharedValues && 'is-danger'">{{ group.sharedValues || 'No group purpose set' }}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The font here is too big for the group purpose to be displayed (which can be quite long potentially).
Also, don't forget that the error text here needs to be localized (see comment above).
Honestly, I think that, as per the comments elsehwere, we shouldn't even have the option of saying 'No group purpose set'
, it should just always be set by the time this view is displayed, IMO.
@taoeffect I tried out vuelidate for validation, if you agree that this is a good direction then I will go through the codebase and replace all existing validation with this as of #334 About validation, the only thing remaining is an enter guard for routes of steps after an invalid one, let's talk at today's call whether it's necessary. I addressed most of the comments too, the only things I see remaining are
For the design questions, I would consider them low priority until we have progress on #327, I assume lot will change here too when that one moves forward. Let me know if you see something that damages usability and should be still done. Happy New Year! 🥂 |
@hubudibu Slack seems to be having some down time today, but I posted a reply yesterday (a little late in the day). Basically, yeah, I love your idea to use the circle slider around the numbers, that sounds really fun and cool! 😄 And if you want to chat about anything, you can always send me a DM on twitter, or post to the gitter, which thankfully is still up: https://gitter.im/okTurtles/group-income |
new slider circles! now my only problem is that the rule setting step is not tested, and neither is the circle slider package 😱 I'm trying to come up with a solution. in the meantime, looking forward to your review @taoeffect ! |
@@ -1,7 +1,7 @@ | |||
<template> | |||
<section class="has-text-right"> | |||
<p class="min-income-label">Min Income</p> | |||
<p class="min-income">${{ group.incomeProvided}}</p> | |||
<p class="min-income"><cyy>{{ group.incomeCurrency }}</cyy>{{ group.incomeProvided }}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few concerns about this cyy
component:
- It doesn't really do much, so it seems unnecessary (plus its name is unclear)
- Because it doesn't use bindings, it's not useful in situations where the input currency changes
- As far as I can tell, it would probably be much simpler to just use a computed property that passes
group.incomeCurrency
through thesymbol
function instead of a<cyy>
component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, they don't make much sense like this. I had some confusion about how the slots are supposed to work, and just copied some of our i18n component's workings here, but now that I checked it again, yes, the beforeMount
in cyy of course won't run again and update the value when it changes in the slot.
changing to computed properties.
|
||
<h2 class="title is-6"><i18n>Group name:</i18n></h2> | ||
<p class="subtitle is-2" v-if="group.groupName">{{ group.groupName }}</p> | ||
<p class="subtitle is-2 is-danger" v-else><i18n>No group name set</i18n></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This v-if
/v-else
condition shouldn't be necessary, right? By this point the validations should guarantee that group.groupName
is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, as I mentioned, all steps having their own URL makes it pretty easy to end up at this step, even with a simple refresh, that's why I kept these. is that something we should worry about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, technically you are correct, if the user is using the app in a browser, they could visit this page somehow... without setting the groupName... theoretically, perhaps by looking at the browsing history.
I have two suggestions on how to deal with this:
- Just make sure that vuelidate doesn't allow the form to be submitted (I'm guessing it already does that? Can you verify?)
- Have a guard of some sort, perhaps in
mounted ()
, i.e. maybe a mixin that checks the variables that need to be set by this step, and if they aren't set revert to the beginning of the StepAssistant.
EDIT: OK, I see that (1) above is the behavior. I guess that is fine. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
yes, that's the current behavior :)
-
here are my two suggestions:
2.1 the full solution would be to check for every step that all the previous steps are valid, and if not, go back to the first invalid step. this seems like a bigger task, but we have everything for this to work - the step-validator relation and the order of steps
2.2 the quicker solution would be to only guard the summary step, and if it's not valid, jump back to the first step of the assistant. this could work if we assumed that the only way to end up here in an invalid state is by skipping all the previous steps. but it's not the case, someone could easily hit refresh at the 2nd step and only miss the first one. from the user's perspective, without a proper error notification solution #175 , I think this is way more confusing and frustrating than seeing on the summary which step is actually missing and having to manually go back to correct it.
so in my opinion, what we have now is better than 2.2, and I'd love to do 2.1, but I assume we have things with higher priority.
thoughts? :)
|
||
<h2 class="title is-6"><i18n>Group purpose:</i18n></h2> | ||
<p class="title is-4" v-if="group.sharedValues">{{ group.sharedValues }}</p> | ||
<p class="subtitle is-2 is-danger" v-else><i18n>No group purpose set</i18n></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern here as above.
|
||
<h2 class="title is-6"><i18n>Minimum income:</i18n></h2> | ||
<p class="subtitle is-2" v-if="group.incomeProvided"><cyy>{{ group.incomeCurrency }}</cyy>{{ group.incomeProvided }}</p> | ||
<p class="subtitle is-2 is-danger" v-else><i18n>No group income set</i18n></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above + other comment below about <cyy>
component.
<hr> | ||
|
||
<h2 class="title is-6"><i18n>Members to invite:</i18n></h2> | ||
<p v-if="!group.invitees.length" class="subtitle is-2 is-warning"><i18n>Noone here yet</i18n></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "No one invited"
I think.
on a person’s life. Please consider using a supermajority threshold. | ||
<a href="https://groupincome.org/2016/09/deprecating-mays-theorem/#when-majority-rule-can-harm"> | ||
Read more on our blog about the dangers of majority rule. | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, but remember to put all text, including this, into <i18n>
tags. ^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoot!
work in progress, will at some point fix #311