Skip to content

Commit

Permalink
revert(front): revert progress display
Browse files Browse the repository at this point in the history
  • Loading branch information
SARDONYX-sard committed Nov 9, 2024
1 parent 2fcf897 commit a05c342
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function ConvertButton({ loading, progress, ...props }: Props) {
variant='contained'
{...props}
>
<span>{loading ? `${t('converting-btn')} ${progress}%` : isComplete ? 'OK' : t('convert-btn')}</span>
<span>{loading ? t('converting-btn') : isComplete ? 'OK' : t('convert-btn')}</span>
</LoadingButton>
);
}
4 changes: 1 addition & 3 deletions gui/frontend/src/services/api/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@ export async function progressListener(
const eventHandler: EventCallback<Payload> = (event) => {
/** file count to % */
const toPercentage = (num: number) => (num * 100) / maxNum;
/** To 0 ~ 100 */
const clamped = (progress: number) => Math.max(0, Math.min(100, progress));

if (maxNum === 0) {
maxNum = event.payload.index;
} else {
const percent = toPercentage(event.payload.index);
setProgress(clamped(percent));
setProgress(percent);
}
};

Expand Down

0 comments on commit a05c342

Please sign in to comment.