Skip to content

Commit c749e83

Browse files
ComputelessComputerwarp-agent
andcommitted
show download progress during update
Co-Authored-By: Warp <agent@warp.dev>
1 parent 10e4faa commit c749e83

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/components/UpdateBanner.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ interface UpdateBannerProps {
88

99
export function UpdateBanner({ update, onDismiss, }: UpdateBannerProps,) {
1010
const [updating, setUpdating,] = useState(false,);
11+
const [progress, setProgress,] = useState<number | null>(null,);
1112

1213
const handleUpdate = async () => {
1314
setUpdating(true,);
1415
try {
15-
await update.downloadAndInstall();
16+
await update.downloadAndInstall((downloaded, total,) => {
17+
if (total > 0) setProgress(Math.round((downloaded / total) * 100,),);
18+
},);
1619
} catch (err) {
1720
console.error("Update failed:", err,);
1821
setUpdating(false,);
22+
setProgress(null,);
1923
}
2024
};
2125

@@ -38,7 +42,11 @@ export function UpdateBanner({ update, onDismiss, }: UpdateBannerProps,) {
3842
: "linear-gradient(to bottom, #4b5563, #1f2937)",
3943
}}
4044
>
41-
{updating ? "Updating\u2026" : "Update & Restart"}
45+
{updating
46+
? progress !== null
47+
? `Downloading\u2026 ${progress}%`
48+
: "Preparing\u2026"
49+
: "Update & Restart"}
4250
</button>
4351

4452
{!updating && (

0 commit comments

Comments
 (0)