Skip to content

Commit

Permalink
enhance: notification popup
Browse files Browse the repository at this point in the history
  • Loading branch information
love-linger committed Dec 13, 2024
1 parent 6eb226e commit 0265883
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ public bool Exec()
}

if (string.IsNullOrEmpty(e.Data))
{
errs.Add(string.Empty);
return;
}

if (TraitErrorAsOutput)
OnReadline(e.Data);

Expand All @@ -89,6 +93,7 @@ public bool Exec()
return;
if (REG_PROGRESS().IsMatch(e.Data))
return;

errs.Add(e.Data);
};

Expand Down
15 changes: 10 additions & 5 deletions src/Views/LauncherPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,24 @@
<Border Margin="6" HorizontalAlignment="Stretch" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #8F000000)">
<Border Padding="8" CornerRadius="6" Background="{DynamicResource Brush.Popup}">
<Grid RowDefinitions="26,Auto">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Margin="8,0">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto" Margin="8,0">
<Path Grid.Column="0" Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red" IsVisible="{Binding IsError}"/>
<Path Grid.Column="0" Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green" IsVisible="{Binding !IsError}"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Error}" IsVisible="{Binding IsError}"/>
<TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Info}" IsVisible="{Binding !IsError}"/>
<Button Grid.Column="2" Classes="icon_button" Width="16" Height="16" Click="OnDismissNotification">
<Button Grid.Column="2" Classes="icon_button" Width="16" Height="16" Click="OnCopyNotification">
<Path Width="12" Height="12" Data="{StaticResource Icons.Copy}"/>
</Button>
<Button Grid.Column="3" Classes="icon_button" Width="16" Height="16" Margin="8,0,0,0" Click="OnDismissNotification">
<Path Width="10" Height="10" Data="{StaticResource Icons.Window.Close}"/>
</Button>
</Grid>

<ScrollViewer Grid.Row="1" Margin="8" MaxHeight="100" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<SelectableTextBlock TextWrapping="Wrap" Text="{Binding Message}"/>
</ScrollViewer>
<Border Grid.Row="1" Margin="8" Background="{DynamicResource Brush.Contents}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<ScrollViewer MaxHeight="200" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<TextBlock Margin="4,2" TextWrapping="NoWrap" Text="{Binding Message}"/>
</ScrollViewer>
</Border>
</Grid>
</Border>
</Border>
Expand Down
8 changes: 8 additions & 0 deletions src/Views/LauncherPage.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ private void OnMaskClicked(object sender, PointerPressedEventArgs e)
OnPopupCancel(sender, e);
}

private void OnCopyNotification(object sender, RoutedEventArgs e)
{
if (sender is Button { DataContext: Models.Notification notice })
App.CopyText(notice.Message);

e.Handled = true;
}

private void OnDismissNotification(object sender, RoutedEventArgs e)
{
if (sender is Button { DataContext: Models.Notification notice } &&
Expand Down

0 comments on commit 0265883

Please sign in to comment.