-
Notifications
You must be signed in to change notification settings - Fork 67
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
Loading utility should enable success & error states #188
Comments
Expanding on this, the loading feature should have a success/error/info callback that dictates the icon/color - something like: dc.util.loader = function(yes, typeClass) {
var loader = $('<div>').addClass('dropchop-loader');
if (yes) {
$('body').addClass('dropchop-loading');
$('body').append(loader);
} else {
$('body').removeClass('dropchop-loading');
$('.dropchop-loader').addClass(typeClass).fadeOut(2000, function(){ // class that has icon built in
$(this).remove();
});
}
}; |
I was thinking about this last night when I noticed a similar issue with the "Import file from a URL" feature. Perhaps a more Nodejs-y convention would be passing an optional error object, and displaying an appropriate loading state icon. Something like...
Operationally, it would look like
Thoughts? |
On a related note (this might be a separate issue) it might be best to handle the loading state on a method-by-method basis instead of universally through By moving the loading state trigger out of |
Excellent thoughts, @jczaplew. Definitely agree that taking the loader out of the
It seems like if we have these errors popping up, we'll want to notify what the error is. Do you think it would make sense to build that into the loader or just use |
For notifying the user, I think that could be baked into the loader. As for different icons/colors, it could possibly be generalized to
How about something like
? That way the loader function is generic and error messages can be unique to the method producing them. |
Looks good to me! Semi-related: It seems important to have sticky notifications for errors so users can copy them without rushing before they automatically remove. Created a separate issue for this #193 |
The .dropchop-loader {
&.loader-loading {}
&.loader-error {}
&.loader-warning {}
&.loader-success {}
} |
Entered by friend Sam Bolstad while testing at his house 👍
When results from Overpass API come back negative, the icon is still a green checkmark, which is a bit misleading.
The text was updated successfully, but these errors were encountered: