-
Notifications
You must be signed in to change notification settings - Fork 101
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
Implement a number-count animation for DORA-cards #385
Comments
@e-for-eshaan I would like to work on this issue, can you assign it to me. |
Hey @KartikChawla09, sure you can take this up. |
I'm assigning this to you. In case that changes, let me know and I'll unassign you. |
Thank you for assigning it to me. Can you have a look at #459 while I work on this ? |
Hey @KartikChawla09, #459 was merged. 👏🏽 👏🏽 👏🏽 |
Yes! I am working on it. Will raise a PR ASAP. |
Hey @e-for-eshaan @jayantbh . |
Hey @KartikChawla09, this shouldn't have happened. Did you check if there is an older commit that seems to not have this issue? |
The last commit I remember working correctly was this one. But maybe the issue is at my end only. It would really help if someone could confirm that by checking on their local deployment. |
Hey @KartikChawla09 , are you still working on this? |
Yes! I have implemented the counter as well but I am having some issues with my local deployment due to which I am not able to test the code locally. I will push the code when I am able to fix the issue. I have sent the error on Slack as well. |
@KartikChawla09 been a while, how's this coming up, should I assign this to someone else? |
There was some issue with my local deployment, as I mentioned I raised as issue on Slack as well but it didn't get fixed so I couldn't test my code. import { useEffect, useState } from "react";
const easeInOutQuad = (t: number) => {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
};
const CounterAnimation = ({
targetValue,
duration,
}: {
targetValue: number;
duration: number;
}) => {
const [count, setCount] = useState(0);
useEffect(() => {
const flag = Math.floor(targetValue) === targetValue;
let start = 0;
const iterations = 10;
const time = duration / iterations;
const startTime = performance.now();
const counter = setInterval(() => {
const elapsed = performance.now() - startTime;
const progress = elapsed / duration;
const easedProgress = easeInOutQuad(progress);
start += 1;
flag
? setCount(Math.floor(easedProgress * targetValue))
: setCount(parseFloat((easedProgress * targetValue).toFixed(2)));
if (start >= iterations) {
clearInterval(counter);
setCount(targetValue);
}
}, time);
}, [duration, targetValue]);
return <>{count}</>;
};
export default CounterAnimation; This code snippet might help the person who takes up this issue! |
Thanks @KartikChawla09 for your contribution, even though we couldn't sort out issues with running Middleware on an 8GB RAM system. Hopefully we'll get an idea of how to deal with that in the near future. Unless you're able to see if Gitpod works out for you (which based on the last time we chatted about this, you'd hit some limits). I've unassigned the issue for now, such that someone else can take it up. |
@jayantbh please assign this issue to me, I'll would like to pick this up. |
Done, @xyfer17 |
@jayantbh can you help me out, I'm unable to load the dora metrics getting error from api side: Endpoint:
|
I think this broke as part of a recent axios upgrade. Could you check if this works with an older commit? |
Ah damn dependabot update. Let's see if we can revert that. |
Okay that went as a bulk update. Would you be able to see if it's trivial to sort out? Maybe just downgrade axios for your specific PR? |
@jayantbh I have few questions on for the above enhancement:
also check the below video, I've try to create the animation on the every page render using the custom hook, please suggest your thoughts. Screen.Recording.2024-10-22.111307.mp4 |
|
Why do we need this ?
we can add some animation to the cards' numbers on
similar to this
Acceptance Criteria
try not to introduce packages within the code base, writing optimized code will be appreciated
It's best if you apply these animation for the
Deployment frequency
andChange failure rate
first. These look farely straight forwardusing a component/custom-hook based approach is appreciated
TODO 1
TODO 2
TODO 3
Further Comments / References
The text was updated successfully, but these errors were encountered: