mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 07:59:47 +00:00
Added a success event to the message bus for better ux
This commit is contained in:
parent
62a4549f89
commit
ca98c5548e
@ -13,4 +13,19 @@ public readonly record struct Error(string Icon, string Message)
|
|||||||
config.VisibleStateDuration = 14_000;
|
config.VisibleStateDuration = 14_000;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public readonly record struct Success(string Icon, string Message)
|
||||||
|
{
|
||||||
|
public void Show(ISnackbar snackbar)
|
||||||
|
{
|
||||||
|
var icon = this.Icon;
|
||||||
|
snackbar.Add(this.Message, Severity.Success, config =>
|
||||||
|
{
|
||||||
|
config.Icon = icon;
|
||||||
|
config.IconSize = Size.Large;
|
||||||
|
config.HideTransitionDuration = 600;
|
||||||
|
config.VisibleStateDuration = 10_000;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ public enum Event
|
|||||||
COLOR_THEME_CHANGED,
|
COLOR_THEME_CHANGED,
|
||||||
PLUGINS_RELOADED,
|
PLUGINS_RELOADED,
|
||||||
SHOW_ERROR,
|
SHOW_ERROR,
|
||||||
|
SHOW_SUCCESS,
|
||||||
|
|
||||||
// Update events:
|
// Update events:
|
||||||
USER_SEARCH_FOR_UPDATE,
|
USER_SEARCH_FOR_UPDATE,
|
||||||
|
@ -67,6 +67,8 @@ public sealed class MessageBus
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Task SendError(Error error) => this.SendMessage(null, Event.SHOW_ERROR, error);
|
public Task SendError(Error error) => this.SendMessage(null, Event.SHOW_ERROR, error);
|
||||||
|
|
||||||
|
public Task SendSuccess(Success success) => this.SendMessage(null, Event.SHOW_SUCCESS, success);
|
||||||
|
|
||||||
public void DeferMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data = default)
|
public void DeferMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data = default)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user