In this episode, we shift our focus back to the client side and start working on showing upload progress to the user. We begin by hooking into the uploader's progress
event, tapping into the event system to grab ongoing updates as our file uploads. We explore the event payload to see what kind of progress details we get, and then update our local state with this info so we can use it in the UI.
After getting the progress data in our state, we build a simple progress bar in the page, using a conditional to only display it when an upload is happening. We make use of some quick styling to get the progress bar looking nice, and set up its width to dynamically reflect our upload progress. We also add a bit of a CSS transition for smoother visual feedback when the progress bar updates.
We then clean up how we display the exact percentage, rounding the number to avoid a pile of decimals by adding a computed property to our state. All that’s left is to polish the design a little and add the percentage sign next to the progress, and we’re all set: the user now gets clear and smooth feedback during file uploads, showing both a progress bar and a percentage label. Nice and user-friendly!