Skip to content

Commit

Permalink
Merge pull request #3910 from zyhfish/task/update-pr-3885
Browse files Browse the repository at this point in the history
remove the visible parameter in module message component.
  • Loading branch information
sbwalker authored Feb 27, 2024
2 parents f017b6b + 9ebd882 commit e218234
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
8 changes: 2 additions & 6 deletions Oqtane.Client/Modules/Controls/ModuleMessage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@inherits ModuleControlBase
@inject NavigationManager NavigationManager

@if (Visible && !string.IsNullOrEmpty(Message))
@if (!string.IsNullOrEmpty(Message))
{
<div class="@_classname alert-dismissible fade show mb-3" role="alert">
@((MarkupString)Message)
Expand Down Expand Up @@ -30,14 +30,10 @@
[Parameter]
public MessageType Type { get; set; }

[Parameter]
public bool Visible { get; set; } = true;

public void RefreshMessage(string message, MessageType type, bool visible)
public void RefreshMessage(string message, MessageType type)
{
Message = message;
Type = type;
Visible = visible;

UpdateClassName();

Expand Down
16 changes: 8 additions & 8 deletions Oqtane.Client/UI/RenderModeBoundary.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
@if (ModuleType != null)
{
@((MarkupString)$"<!-- rendermode: {ModuleState.RenderMode} -->")
<ModuleMessage @ref="moduleMessageTop" Message="@_messageContent" Type="@_messageType" Visible="@(!string.IsNullOrEmpty(_messageContent) && _messagePosition == "top")" />
<ModuleMessage @ref="moduleMessageTop" Message="@_messageContent" Type="@_messageType" />
@DynamicComponent
@if (_progressIndicator)
{
<div class="app-progress-indicator"></div>
}
<ModuleMessage @ref="moduleMessageBottom" Message="@_messageContent" Type="@_messageType" Visible="@(!string.IsNullOrEmpty(_messageContent) && _messagePosition == "bottom")" />
<ModuleMessage @ref="moduleMessageBottom" Message="@_messageContent" Type="@_messageType" />
}
}
else
Expand Down Expand Up @@ -131,17 +131,17 @@

private void Refresh()
{
var messageTopVisible = !string.IsNullOrEmpty(_messageContent) && _messagePosition == "top";
var messageBottomVisible = !string.IsNullOrEmpty(_messageContent) && _messagePosition == "bottom";
var updateTop = string.IsNullOrEmpty(_messageContent) || _messagePosition == "top";
var updateBottom = string.IsNullOrEmpty(_messageContent) || _messagePosition == "bottom";

if (moduleMessageTop != null)
if (updateTop && moduleMessageTop != null)
{
moduleMessageTop.RefreshMessage(_messageContent, _messageType, messageTopVisible);
moduleMessageTop.RefreshMessage(_messageContent, _messageType);
}

if (moduleMessageBottom != null)
if (updateBottom && moduleMessageBottom != null)
{
moduleMessageBottom.RefreshMessage(_messageContent, _messageType, messageBottomVisible);
moduleMessageBottom.RefreshMessage(_messageContent, _messageType);
}
}

Expand Down

0 comments on commit e218234

Please sign in to comment.