Skip to content
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

Restyle of the MessageBox used for Exceptions #2483

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<Setter Property="LayoutHeight" Value="300" />
<Setter Property="SaveAspectRatio" Value="True" />
</Style>

<Style Selector="^ ctxt|CTextBlock">

<!-- set CTextBlock defaults to paragraph -->
Expand Down Expand Up @@ -159,7 +159,7 @@
<Setter Property="Padding" Value="4,2" />
<Setter Property="Margin" Value="2,0" />
<Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" />
<Setter Property="Background" Value="{StaticResource SurfaceHighBrush}" />
<Setter Property="Background" Value="{StaticResource SurfaceTranslucentLowBrush}" />
</Style>

<!-- links and their states -->
Expand All @@ -175,10 +175,11 @@
<!-- code block (separate to inline code) -->
<Style Selector="^ Border.CodeBlock">
<Setter Property="Padding" Value="8,8" />
<Setter Property="Margin" Value="8,16" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="0,8" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="BorderBrush" Value="{StaticResource SurfaceTranslucentHighBrush}" />
<Setter Property="CornerRadius" Value="4" />
<Setter Property="Background" Value="{StaticResource SurfaceHighBrush}" />
<Setter Property="Background" Value="{StaticResource SurfaceTranslucentLowBrush}" />

<Style Selector="^ TextBlock">
<Setter Property="FontFamily" Value="{StaticResource FontBodyCode}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,67 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ok="clr-namespace:NexusMods.App.UI.Overlays.Generic.MessageBox.Ok"
xmlns:base="clr-namespace:NexusMods.App.UI.Overlays.Generic.MessageBox.Base"
xmlns:resources="clr-namespace:NexusMods.App.UI.Resources">
xmlns:resources="clr-namespace:NexusMods.App.UI.Resources"
xmlns:controls="clr-namespace:NexusMods.App.UI.Controls"
xmlns:icons="clr-namespace:NexusMods.Icons;assembly=NexusMods.Icons">

<base:MessageBoxBackground MinWidth="300" MaxWidth="640">
<base:MessageBoxBackground.TopContent>
<StackPanel Orientation="Vertical" Margin="24" Spacing="16">

<!-- Title -->
<DockPanel HorizontalAlignment="Stretch" Margin="0,0,0,16">
<TextBlock DockPanel.Dock="Left" x:Name="HeadingText" />
<DockPanel Margin="24, 16">

<!-- Title -->
<DockPanel DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0">

<!-- 'Cross' button. -->
<Button
x:Name="CloseButton"
DockPanel.Dock="Right"
Classes="BareIcon WindowClose"
HorizontalAlignment="Right"
VerticalAlignment="Center"/>
<controls:StandardButton
x:Name="CloseButton" DockPanel.Dock="Right"
LeftIcon="{x:Static icons:IconValues.Close}"
ShowIcon="Left"
ShowLabel="False"
Type="Tertiary"
Fill="None" />

<TextBlock x:Name="HeadingText"
Text="Title Text"
VerticalAlignment="Center"
TextWrapping="NoWrap"
TextTrimming="CharacterEllipsis" />
</DockPanel>

<!-- Message -->
<TextBlock x:Name="MessageTextBlock" TextWrapping="WrapWithOverflow" MaxLines="50" />

<!-- Supporting Markdown -->
<reactiveUi:ViewModelViewHost x:Name="MarkdownRendererViewModelViewHost" MaxHeight="640" MaxWidth="600"/>
<StackPanel Orientation="Vertical" Spacing="8">
<!-- Message -->
<TextBlock x:Name="MessageTextBlock"
TextWrapping="WrapWithOverflow"
MaxLines="50"
Text="Description" />

</StackPanel>
<!-- Supporting Markdown -->
<reactiveUi:ViewModelViewHost x:Name="MarkdownRendererViewModelViewHost" MaxHeight="640"
MaxWidth="600" />
</StackPanel>

</DockPanel>

</base:MessageBoxBackground.TopContent>

<base:MessageBoxBackground.BottomContent>

<!-- Buttons -->
<StackPanel Orientation="Horizontal" Margin="24" VerticalAlignment="Center" HorizontalAlignment="Right" Classes="Spacing-6">

<Button x:Name="OkButton"
Classes="Standard Primary"
<StackPanel Orientation="Horizontal"
Margin="24"
VerticalAlignment="Center"
HorizontalAlignment="Right"
VerticalAlignment="Center">
<TextBlock Text="{x:Static resources:Language.MessageBox_Button_Ok}" />
</Button>
Spacing="{StaticResource Spacing-2.5}">

<controls:StandardButton
x:Name="OkButton"
Text="{x:Static resources:Language.MessageBox_Button_Ok}"
Type="Primary"
Fill="Strong"
HorizontalAlignment="Right"
VerticalAlignment="Center" />

</StackPanel>

</base:MessageBoxBackground.BottomContent>
Expand Down
2 changes: 1 addition & 1 deletion src/NexusMods.App.UI/Resources/Language.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/NexusMods.App.UI/Resources/Language.resx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<value>No</value>
</data>
<data name="MessageBox_Button_Ok" xml:space="preserve">
<value>Ok</value>
<value>OK</value>
</data>
<data name="CancelDownloadOverlayView_Description_download_will_be_cancelled" xml:space="preserve">
<value>{0} will be cancelled and the files will be deleted.</value>
Expand Down
5 changes: 2 additions & 3 deletions src/NexusMods.App.UI/Windows/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ private IDisposable ConnectErrors(IServiceProvider provider)
if (msg.Exception != null)
{
details = $"""
### Exception Details
```
{msg.Exception}
```
{msg.Exception}
```
""";
}

Expand Down
Loading