Skip to content

[Bug] Ratings Prompt: Animations #76

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

Merged
merged 16 commits into from
Oct 12, 2016

Conversation

iconix
Copy link
Contributor

@iconix iconix commented Oct 3, 2016

Adds the new motion designer-approved animations for the ratings prompt feature.

Some restructuring of the existing animations framework was needed.

@@ -1,3 +1,5 @@
import {SmartValue} from "../../communicator/smartValue";
Copy link
Contributor Author

@iconix iconix Oct 3, 2016

Choose a reason for hiding this comment

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

I think I am abusing the intended usage of SmartValues in this PR... I started using SVs because at one point during development, I thought I needed to be able to subscribe to changing AnimationStates.

Then it turned out I didn't need to subscribe, but I still needed a value container to 1) persist ratings panel AnimationState whenever the ratings panel (and its state) is blown away randomly by a re-render; and 2) update this persisted value across different layers of the animation strategy code (via setAnimationStrategy).

If someone has a suggestion for getting these behaviors without using SVs (perhaps there's a more Mith-react way?), please let me know :) Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm about to go through this PR so I will report back. My initial thought is to move state up one component so that it persists across re-renders of a sub-component, and pass it as a prop down the different layers of the animation strategy code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I think about, a Mith-react component tree serves a similar purpose to a SmartValue. When the state changes, it re-renders the component and passes the re-rendered value down as a prop to its children. #FoodForThought

Copy link
Contributor Author

@iconix iconix Oct 7, 2016

Choose a reason for hiding this comment

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

Good thought that I also had :D

So I originally tried implementing this by putting AnimationState (in enum form) on the MainController state. But I don't think that's actually what we want here because we don't want the main controller re-rendering on every animation state update of the sub-panel - we only want RatingsPanel to re-render.

Also note that I already am storing this on MainController state and then passing it to RatingsPanel as a prop, as suggested... but I'm avoiding the re-render behavior because I update the internals of the smart value and not the SmartValue<AnimationState> itself :P So that's another reason SVs are (too?) convenient here.

…anel animation in main controller with a simple fade-in
@mttwc
Copy link
Contributor

mttwc commented Oct 10, 2016

Build is broken when I merge master into this branch and run gulp full

@mttwc
Copy link
Contributor

mttwc commented Oct 10, 2016

^ @VishaalK and I were chatting about this and this is because the way we did typings, and what was in package.json is different in master compared to what is in this branch. You'll need to merge master into this branch and resolve typings, packages, and failing UTs :)

@iconix
Copy link
Contributor Author

iconix commented Oct 11, 2016

^what happens when a PR sits around for too long I guess :)

@mttwc
Copy link
Contributor

mttwc commented Oct 11, 2016

The animations look really good :D
Will go through the code itself now

Copy link
Contributor

@mttwc mttwc left a comment

Choose a reason for hiding this comment

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

Looks good! Just some really minor stuff.


protected doAnimateIn(parentEl: HTMLElement): Promise<void> {
return new Promise<void>((resolve) => {
for (let cIndex = 0; cIndex < this.contentToAnimate.length; cIndex++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I prefer to call these variables contentIndex and animatableIndex

Copy link
Contributor Author

@iconix iconix Oct 11, 2016

Choose a reason for hiding this comment

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

can do - agreed that this is a little confusing #Resolved

Rate,
Feedback,
End
Init = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why you explicitly define the index for each enum value?

Copy link
Contributor Author

@iconix iconix Oct 11, 2016

Choose a reason for hiding this comment

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

just to further call out that order matters for this particular enum

@iconix
Copy link
Contributor Author

iconix commented Oct 11, 2016

Created #93 to track this fix

@leakymemory leakymemory merged commit c02d86b into master Oct 12, 2016
@leakymemory leakymemory deleted the feature/ratings-prompt-animations branch October 12, 2016 20:35
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.

4 participants