-
Notifications
You must be signed in to change notification settings - Fork 5
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
Change style and size of mini-window #85
Conversation
WalkthroughThis pull request introduces comprehensive changes to the vATIS Desktop application's user interface and view models. The modifications focus on enhancing the visual styling of buttons, improving the compact window's interactivity, and adding new properties to the ATIS station view model. The changes include new control themes for buttons, updated window layout, and refined event handling for better user experience. Changes
Sequence DiagramsequenceDiagram
participant User
participant CompactWindow
participant ViewModel
User->>CompactWindow: Move mouse over window
CompactWindow->>ViewModel: Set IsControlsVisible = true
CompactWindow->>User: Show window controls
User->>CompactWindow: Move mouse away
CompactWindow->>ViewModel: Set IsControlsVisible = false
CompactWindow->>User: Hide window controls
Possibly related PRs
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (5)
vATIS.Desktop/Ui/Styles/Buttons.axaml (4)
Line range hint
130-147
: Consider using theme resources for colors.While the implementation is good, consider moving the hardcoded colors (
Coral
,#ff9973
) to theme resources for better maintainability and theme customization support.- <TextBlock Text="{TemplateBinding Content}" Foreground="Coral"> + <TextBlock Text="{TemplateBinding Content}" Foreground="{DynamicResource SaveLinkForeground}"> <TextBlock.Styles> <Style Selector="TextBlock:pointerover"> - <Setter Property="Foreground" Value="#ff9973"/> + <Setter Property="Foreground" Value="{DynamicResource SaveLinkForegroundHover}"/>
Line range hint
343-383
: Consider using theme resources for colors.The close button implementation is solid, but consider moving the hardcoded colors (
#C0392B
,#dc6d62
) to theme resources for better maintainability and theme customization.- <Setter Property="Background" Value="#C0392B"/> - <Setter Property="BorderBrush" Value="#C0392B"/> + <Setter Property="Background" Value="{DynamicResource CloseButtonBackground}"/> + <Setter Property="BorderBrush" Value="{DynamicResource CloseButtonBorder}"/>
385-407
: Consider extracting common properties to a base theme.The
PinButtonSmall
theme shares several properties with the regularPinButton
theme, including the SVG path data. Consider creating a base theme to reduce duplication.+ <ControlTheme x:Key="BasePinButton" TargetType="ToggleButton"> + <Setter Property="Content"> + <Template> + <Viewbox UseLayoutRounding="True"> + <Path x:Name="Glyph" + Stretch="UniformToFill" + HorizontalAlignment="Center" + VerticalAlignment="Center" + FlowDirection="LeftToRight" + Fill="White" + Data="M7.374 12.268l-5.656 5.657A1 1 0 1 1 .303 16.51l5.657-5.656L1.718 6.61A6.992 6.992 0 0 1 7.9 4.67L11.617.954a2 2 0 0 1 2.828 0l2.829 2.828a2 2 0 0 1 0 2.829l-3.716 3.716a6.992 6.992 0 0 1-1.941 6.183l-4.243-4.242z"/> + </Viewbox> + </Template> + </Setter> + </ControlTheme> - <ControlTheme x:Key="PinButtonSmall" BasedOn="{StaticResource Dark}" TargetType="ToggleButton"> + <ControlTheme x:Key="PinButtonSmall" BasedOn="{StaticResource BasePinButton}" TargetType="ToggleButton">
452-469
: Consider extracting common properties to a base theme.Similar to the pin button, the
CompactViewButtonSmall
theme shares several properties with the regularCompactViewButton
theme. Consider creating a base theme to reduce duplication.+ <ControlTheme x:Key="BaseCompactViewButton" TargetType="Button"> + <Setter Property="Content"> + <Template> + <Viewbox UseLayoutRounding="True"> + <Path x:Name="Glyph" + Stretch="UniformToFill" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Fill="White" + Data="M 5.7474 345.3495 c -0 -1.9898 -0.7898 -3.8969 -2.197 -5.304 c -1.4064 -1.4064 -3.3135 -2.1963 -5.304 -2.197 l -64.2463 0 l 156.7472 -156.7458 l -0.0007 64.2456 c 0 1.9898 0.7898 3.8969 2.197 5.304 c 1.4064 1.4064 3.3135 2.1963 5.304 2.197 l 20.0012 -0 c 1.9884 -0 3.8962 -0.7905 5.3026 -2.197 c 1.4064 -1.4064 2.197 -3.3142 2.197 -5.3026 L 125.7483 128.8554 C 125.7483 126.8656 124.9578 124.9578 123.5514 123.5514 c -1.4064 -1.4064 -3.3135 -2.1963 -5.304 -2.197 L 1.7508 121.3551 c -1.9891 0.0007 -3.8962 0.7905 -5.3026 2.197 c -1.4064 1.4064 -2.197 3.3142 -2.197 5.304 l 0.0007 20.0005 c 0 2.0704 0.84 3.9457 2.197 5.3026 c 1.3569 1.3569 3.2322 2.197 5.304 2.197 l 64.247 -0.0007 l -156.7472 156.7458 l 0.0007 -64.2456 c -0 -1.9898 -0.7898 -3.8969 -2.197 -5.304 c -1.4064 -1.4064 -3.3135 -2.1963 -5.304 -2.197 l -20.0012 0 c -1.9884 0 -3.8962 0.7905 -5.3026 2.197 c -1.4064 1.4064 -2.197 3.3142 -2.197 5.3026 l 0 116.4944 c 0.0007 2.0711 0.84 3.9471 2.197 5.304 c 1.3569 1.3569 3.2329 2.1963 5.304 2.197 l 116.4958 -0 c 1.9884 -0 3.8962 -0.7905 5.3026 -2.197 c 1.4064 -1.4064 2.197 -3.3142 2.197 -5.3026 L 5.7474 345.3495 z"/> + </Viewbox> + </Template> + </Setter> + </ControlTheme> - <ControlTheme x:Key="CompactViewButtonSmall" BasedOn="{StaticResource Dark}" TargetType="Button"> + <ControlTheme x:Key="CompactViewButtonSmall" BasedOn="{StaticResource BaseCompactViewButton}" TargetType="Button">vATIS.Desktop/Ui/Windows/CompactWindow.axaml.cs (1)
72-86
: Simplify null checks using null-conditional operator.The implementation can be more concise while maintaining the same functionality.
- private void OnPointerEntered(object? sender, PointerEventArgs e) - { - if (ViewModel != null) - { - ViewModel.IsControlsVisible = true; - } - } - - private void OnPointerExited(object? sender, PointerEventArgs e) - { - if (ViewModel != null) - { - ViewModel.IsControlsVisible = false; - } - } + private void OnPointerEntered(object? sender, PointerEventArgs e) => + ViewModel?.IsControlsVisible = true; + + private void OnPointerExited(object? sender, PointerEventArgs e) => + ViewModel?.IsControlsVisible = false;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
vATIS.Desktop/Ui/Styles/Buttons.axaml
(11 hunks)vATIS.Desktop/Ui/ViewModels/AtisStationViewModel.cs
(16 hunks)vATIS.Desktop/Ui/ViewModels/CompactWindowViewModel.cs
(2 hunks)vATIS.Desktop/Ui/Windows/CompactWindow.axaml
(1 hunks)vATIS.Desktop/Ui/Windows/CompactWindow.axaml.cs
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: build (macos-latest)
- GitHub Check: Analyze (cpp)
- GitHub Check: build (windows-latest)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: Analyze (csharp)
🔇 Additional comments (9)
vATIS.Desktop/Ui/Styles/Buttons.axaml (1)
55-74
: LGTM! Clean template structure.The template structure is well-organized with proper spacing and alignment.
vATIS.Desktop/Ui/ViewModels/CompactWindowViewModel.cs (2)
43-49
: LGTM! Clean MVVM implementation.The property implementation correctly uses RaiseAndSetIfChanged for proper change notification.
52-58
: LGTM! Well-documented property with proper MVVM implementation.The IsControlsVisible property is correctly implemented with change notification and clear documentation.
vATIS.Desktop/Ui/Windows/CompactWindow.axaml (4)
9-11
: LGTM! Clear window size constraints.The window size constraints (MinHeight=50, MinWidth=100, MaxWidth=400) provide good bounds for the compact window.
20-27
: LGTM! Well-structured Border with proper event handling.The Border implementation includes all necessary pointer events and styling properties.
29-32
: LGTM! Clean implementation of controls visibility.The StackPanel correctly uses IsVisible binding to implement the hover functionality.
33-48
: LGTM! Well-organized ItemsControl template.The ItemsControl and its template provide a clean, structured layout for displaying station information.
vATIS.Desktop/Ui/ViewModels/AtisStationViewModel.cs (2)
397-404
: LGTM! Well-documented ObservationTime property.The property is properly implemented with change notification and clear documentation.
421-421
: LGTM! Improved data cleanliness with Trim().The Wind and Altimeter properties now properly trim whitespace, ensuring clean data.
Also applies to: 430-430
Summary by CodeRabbit
Release Notes
New Features
Improvements
UI Changes