-
Notifications
You must be signed in to change notification settings - Fork 919
Add sidebar upload progress toast and optional finish title #8308
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
79cdedb
68ff837
f35d49d
694a7e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { ToastProgress } from "./toast-progress"; | |
| export async function withLoadingToast<T>( | ||
| title: string, | ||
| fn: (progress: ProgressState) => Promise<T>, | ||
| finishTitle?: string, | ||
|
||
| ): Promise<T> { | ||
| const progress = ProgressState.indeterminate(); | ||
| const loadingToast = toast({ | ||
|
|
@@ -30,6 +31,9 @@ export async function withLoadingToast<T>( | |
| try { | ||
| const result = await fn(progress); | ||
| loadingToast.dismiss(); | ||
| if (finishTitle) { | ||
| toast({ title: finishTitle }); | ||
| } | ||
|
||
| return result; | ||
| } catch (error) { | ||
| loadingToast.dismiss(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to check, this covers clicking on the upload button on the panel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it covers both click to upload and drag-drop.