Skip to content

Commit

Permalink
use prediction in event progress
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-Arc committed Oct 24, 2024
1 parent 57eb453 commit 1f130fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
width: 0;
border-radius: 1px 0 0 1px;

transition: 1s linear;
transition: 200ms linear;
transition-property: width;
background-color: $gray-200;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useClientTimePrediction } from '../../../../common/hooks/useClientTimePrediction';
import { useTimer } from '../../../../common/hooks/useSocket';
import { getProgress } from '../../../../common/utils/getProgress';

import style from './EventBlockProgressBar.module.scss';

export default function EventBlockProgressBar() {
const timer = useTimer();

const progress = getProgress(timer.current, timer.duration);
const { duration } = useTimer();
const clientCurrent = useClientTimePrediction();
const progress = getProgress(clientCurrent, duration);

return <div className={style.progressBar} style={{ width: `${progress}%` }} />;
}

0 comments on commit 1f130fc

Please sign in to comment.