Wetterdienst: Hover Bugfix

This commit is contained in:
2026-08-23 21:51:26 +02:00
parent 83a430f8ee
commit 788ae6ad32
4 changed files with 39 additions and 6 deletions
@@ -107,6 +107,20 @@ public sealed class SchoolDayWeatherSummaryTests
Assert.False(SchoolDayWeatherSummary.WarningTouchesDate(warning, Day.AddDays(3))); Assert.False(SchoolDayWeatherSummary.WarningTouchesDate(warning, Day.AddDays(3)));
} }
[Fact]
public void WeekCellItem_WetterOderWarnung_AktiviertGemeinsameHoverFlaeche()
{
var cell = WeekCellItem.WeekdayHeader(DayOfWeek.Monday, Day, false);
Assert.False(cell.HasWeatherInformation);
cell.SetWeather(SchoolDayWeatherSummary.From(Snapshot(Hour(10)), Day), []);
Assert.True(cell.HasWeatherInformation);
cell.SetWeather(null, [new WeatherWarning { Headline = "Amtliche Warnung" }]);
Assert.True(cell.HasWeatherInformation);
Assert.Contains("Amtliche Warnung", cell.WeatherTooltip);
}
private static WeatherSnapshot Snapshot(params WeatherForecastHour[] hours) => new() private static WeatherSnapshot Snapshot(params WeatherForecastHour[] hours) => new()
{ {
RetrievedAt = DateTime.UtcNow, RetrievedAt = DateTime.UtcNow,
@@ -783,8 +783,16 @@ public partial class WeekCellItem : ObservableObject
[ObservableProperty] private string _weatherTooltip = ""; [ObservableProperty] private string _weatherTooltip = "";
[ObservableProperty] private bool _hasWeatherWarning; [ObservableProperty] private bool _hasWeatherWarning;
public bool HasWeather => WeatherSymbol.Length > 0; public bool HasWeather => WeatherSymbol.Length > 0;
public bool HasWeatherInformation => HasWeather || HasWeatherWarning;
partial void OnWeatherSymbolChanged(string value) => OnPropertyChanged(nameof(HasWeather)); partial void OnWeatherSymbolChanged(string value)
{
OnPropertyChanged(nameof(HasWeather));
OnPropertyChanged(nameof(HasWeatherInformation));
}
partial void OnHasWeatherWarningChanged(bool value) =>
OnPropertyChanged(nameof(HasWeatherInformation));
public void SetWeather(SchoolDayWeatherSummary? summary, IReadOnlyList<WeatherWarning> warnings) public void SetWeather(SchoolDayWeatherSummary? summary, IReadOnlyList<WeatherWarning> warnings)
{ {
@@ -195,11 +195,19 @@
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4"> HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4">
<TextBlock Text="{Binding Text}" FontWeight="SemiBold" FontSize="12" Opacity="0.75" <TextBlock Text="{Binding Text}" FontWeight="SemiBold" FontSize="12" Opacity="0.75"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
<TextBlock Text="{Binding WeatherSymbol}" FontSize="16" VerticalAlignment="Center" <!-- TextBlock-Trefferflächen sind bei Emoji-Fallback-Schriften teils nur wenige
IsVisible="{Binding HasWeather}" ToolTip.Tip="{Binding WeatherTooltip}"/> Pixel groß. Der transparente Border bietet eine verlässliche Hover-Fläche. -->
<TextBlock Text="⚠" FontSize="12" Foreground="#D85A30" FontWeight="Bold" <Border Background="Transparent" CornerRadius="4" Padding="4,2"
VerticalAlignment="Center" IsVisible="{Binding HasWeatherWarning}" IsVisible="{Binding HasWeatherInformation}"
ToolTip.Tip="{Binding WeatherTooltip}"/> ToolTip.Tip="{Binding WeatherTooltip}" ToolTip.ShowDelay="200">
<StackPanel Orientation="Horizontal" Spacing="3">
<TextBlock Text="{Binding WeatherSymbol}" FontSize="16" VerticalAlignment="Center"
IsVisible="{Binding HasWeather}" IsHitTestVisible="False"/>
<TextBlock Text="⚠" FontSize="12" Foreground="#D85A30" FontWeight="Bold"
VerticalAlignment="Center" IsVisible="{Binding HasWeatherWarning}"
IsHitTestVisible="False"/>
</StackPanel>
</Border>
</StackPanel> </StackPanel>
</Border> </Border>
<TextBlock Text="{Binding Text}" IsVisible="{Binding IsPeriodLabel}" <TextBlock Text="{Binding Text}" IsVisible="{Binding IsPeriodLabel}"
+3
View File
@@ -763,6 +763,9 @@ weiterhin keine automatisierte Testsuite (kein PHP-Testframework im Projekt).
eine gut sichtbare Zusammenfassung oberhalb des Rasters; mehrtägige Warnungen werden jedem eine gut sichtbare Zusammenfassung oberhalb des Rasters; mehrtägige Warnungen werden jedem
überlappten Schultag zugeordnet. Vergangene Tage und Wochen außerhalb der verfügbaren überlappten Schultag zugeordnet. Vergangene Tage und Wochen außerhalb der verfügbaren
Prognose bleiben ohne Symbol, statt einen veralteten oder erfundenen Zustand anzuzeigen. Prognose bleiben ohne Symbol, statt einen veralteten oder erfundenen Zustand anzuzeigen.
**Nachtrag Hover-Bugfix:** Wetter- und Warnsymbol liegen gemeinsam in einer transparenten,
gepolsterten Trefferfläche. Der Tooltip hängt nicht mehr direkt am je nach Plattform sehr
kleinen Emoji-`TextBlock` und wird dadurch im Wochenraster zuverlässig ausgelöst.
**Nachtrag zu 4.3 (Nutzer-Feedback nach Erstumsetzung):** **Nachtrag zu 4.3 (Nutzer-Feedback nach Erstumsetzung):**
- **Ferien/Feiertage-Pflege verschoben:** Die Bundesland-Auswahl und das Schulferien-CRUD standen - **Ferien/Feiertage-Pflege verschoben:** Die Bundesland-Auswahl und das Schulferien-CRUD standen