Skip to content

Commit

Permalink
ReviewViewer: Fix showing summary on games with no data
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Sep 22, 2021
1 parent fe135b0 commit 4ab50ad
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 70 deletions.
139 changes: 70 additions & 69 deletions source/Generic/ReviewViewer/Controls/ReviewsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,99 +6,100 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">

<StackPanel Name="MainPanel" Visibility="{Binding MainPanelVisibility}">
<StackPanel Name="MainPanel">
<StackPanel.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}" />
</StackPanel.Resources>

<StackPanel DockPanel.Dock="Left" Margin="0,0,0,10">
<StackPanel Orientation="Horizontal" >
<Viewbox Stretch="Uniform" Height="50" VerticalAlignment="Center"
<StackPanel Visibility="{Binding MainPanelVisibility, Mode=OneWay}">
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,10">
<StackPanel Orientation="Horizontal" >
<Viewbox Stretch="Uniform" Height="50" VerticalAlignment="Center"
Visibility="{Binding SelectedReview.VotedUp, Converter={StaticResource BooleanToVisibilityConverter}}">
<Canvas Width="256" Height="256" Canvas.Left="0" Canvas.Top="0">
<Canvas.Background>
<RadialGradientBrush GradientOrigin="0.06,0.08" Center="0.5, 0.5"
<Canvas Width="256" Height="256" Canvas.Left="0" Canvas.Top="0">
<Canvas.Background>
<RadialGradientBrush GradientOrigin="0.06,0.08" Center="0.5, 0.5"
RadiusX="1" RadiusY="1">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#2b526c" Offset="0.0" />
<GradientStop Color="#254c6f" Offset="0.34" />
<GradientStop Color="#0d2f5f" Offset="1.0" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Canvas.Background>
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Canvas.RenderTransform>
<Canvas.Resources/>
<Path Fill="#61b6e8">
<Path.Data>
<PathGeometry Figures="M126.16 44c-0.18-1.38-0.8-3.93-2.71-4.15c0 0-16.02-1.85-18.59 12.29c0 0-5.13 18.82 9.41 46.21l-15.08 0.64 H68.51c-10.2 0-18.45 10.81-18.51 24.16h44.89c1.87 0 3.38 1.51 3.38 3.38c0 1.86-1.51 3.38-3.38 3.38H51.86l5.43 19.22h43.68 c1.86 0 3.38 1.51 3.38 3.38c0 1.86-1.52 3.37-3.38 3.37H59.2l5.43 19.23h33.45c1.86 0 3.38 1.51 3.38 3.37 c0 1.86-1.51 3.38-3.38 3.38H67.09c5.27 11.59 13.82 20.4 23.03 20.4h68.13l21.34-62.23C174.13 134.96 132.53 92.42 126.16 44z M208.44 154.04c-1.8-3.64-4.9-6.36-8.74-7.67l-7.55-2.57L170.86 206l7.56 2.59c3.84 1.32 7.99 1.05 11.64-0.74 c3.65-1.79 6.36-4.89 7.67-8.73l11.45-33.45C210.49 161.82 210.23 157.69 208.44 154.04z" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<RadialGradientBrush.GradientStops>
<GradientStop Color="#2b526c" Offset="0.0" />
<GradientStop Color="#254c6f" Offset="0.34" />
<GradientStop Color="#0d2f5f" Offset="1.0" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Canvas.Background>
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Canvas.RenderTransform>
<Canvas.Resources/>
<Path Fill="#61b6e8">
<Path.Data>
<PathGeometry Figures="M126.16 44c-0.18-1.38-0.8-3.93-2.71-4.15c0 0-16.02-1.85-18.59 12.29c0 0-5.13 18.82 9.41 46.21l-15.08 0.64 H68.51c-10.2 0-18.45 10.81-18.51 24.16h44.89c1.87 0 3.38 1.51 3.38 3.38c0 1.86-1.51 3.38-3.38 3.38H51.86l5.43 19.22h43.68 c1.86 0 3.38 1.51 3.38 3.38c0 1.86-1.52 3.37-3.38 3.37H59.2l5.43 19.23h33.45c1.86 0 3.38 1.51 3.38 3.37 c0 1.86-1.51 3.38-3.38 3.38H67.09c5.27 11.59 13.82 20.4 23.03 20.4h68.13l21.34-62.23C174.13 134.96 132.53 92.42 126.16 44z M208.44 154.04c-1.8-3.64-4.9-6.36-8.74-7.67l-7.55-2.57L170.86 206l7.56 2.59c3.84 1.32 7.99 1.05 11.64-0.74 c3.65-1.79 6.36-4.89 7.67-8.73l11.45-33.45C210.49 161.82 210.23 157.69 208.44 154.04z" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Viewbox>

<Viewbox Stretch="Uniform" Height="50" VerticalAlignment="Center" RenderTransformOrigin="0.5, 0.5"
<Viewbox Stretch="Uniform" Height="50" VerticalAlignment="Center" RenderTransformOrigin="0.5, 0.5"
Visibility="{Binding SelectedReview.VotedUp, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
<Viewbox.RenderTransform>
<ScaleTransform ScaleX="-1" />
</Viewbox.RenderTransform>
<Canvas Width="256" Height="256" Canvas.Left="0" Canvas.Top="0"
<Viewbox.RenderTransform>
<ScaleTransform ScaleX="-1" />
</Viewbox.RenderTransform>
<Canvas Width="256" Height="256" Canvas.Left="0" Canvas.Top="0"
RenderTransformOrigin="0.5, 0.5">
<Canvas.Background>
<RadialGradientBrush GradientOrigin="0.06,0.92" Center="0.5, 0.5"
<Canvas.Background>
<RadialGradientBrush GradientOrigin="0.06,0.92" Center="0.5, 0.5"
RadiusX="1" RadiusY="1">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#753e41" Offset="0.0" />
<GradientStop Color="#683439" Offset="0.30" />
<GradientStop Color="#4b2125" Offset="1.0" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Canvas.Background>
<Canvas.RenderTransform>
<RotateTransform Angle="180" />
</Canvas.RenderTransform>
<Canvas.Resources/>
<Path Fill="#ec666d">
<Path.Data>
<PathGeometry Figures="M126.16 44c-0.18-1.38-0.8-3.93-2.71-4.15c0 0-16.02-1.85-18.59 12.29c0 0-5.13 18.82 9.41 46.21l-15.08 0.64 H68.51c-10.2 0-18.45 10.81-18.51 24.16h44.89c1.87 0 3.38 1.51 3.38 3.38c0 1.86-1.51 3.38-3.38 3.38H51.86l5.43 19.22h43.68 c1.86 0 3.38 1.51 3.38 3.38c0 1.86-1.52 3.37-3.38 3.37H59.2l5.43 19.23h33.45c1.86 0 3.38 1.51 3.38 3.37 c0 1.86-1.51 3.38-3.38 3.38H67.09c5.27 11.59 13.82 20.4 23.03 20.4h68.13l21.34-62.23C174.13 134.96 132.53 92.42 126.16 44z M208.44 154.04c-1.8-3.64-4.9-6.36-8.74-7.67l-7.55-2.57L170.86 206l7.56 2.59c3.84 1.32 7.99 1.05 11.64-0.74 c3.65-1.79 6.36-4.89 7.67-8.73l11.45-33.45C210.49 161.82 210.23 157.69 208.44 154.04z" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<RadialGradientBrush.GradientStops>
<GradientStop Color="#753e41" Offset="0.0" />
<GradientStop Color="#683439" Offset="0.30" />
<GradientStop Color="#4b2125" Offset="1.0" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Canvas.Background>
<Canvas.RenderTransform>
<RotateTransform Angle="180" />
</Canvas.RenderTransform>
<Canvas.Resources/>
<Path Fill="#ec666d">
<Path.Data>
<PathGeometry Figures="M126.16 44c-0.18-1.38-0.8-3.93-2.71-4.15c0 0-16.02-1.85-18.59 12.29c0 0-5.13 18.82 9.41 46.21l-15.08 0.64 H68.51c-10.2 0-18.45 10.81-18.51 24.16h44.89c1.87 0 3.38 1.51 3.38 3.38c0 1.86-1.51 3.38-3.38 3.38H51.86l5.43 19.22h43.68 c1.86 0 3.38 1.51 3.38 3.38c0 1.86-1.52 3.37-3.38 3.37H59.2l5.43 19.23h33.45c1.86 0 3.38 1.51 3.38 3.37 c0 1.86-1.51 3.38-3.38 3.38H67.09c5.27 11.59 13.82 20.4 23.03 20.4h68.13l21.34-62.23C174.13 134.96 132.53 92.42 126.16 44z M208.44 154.04c-1.8-3.64-4.9-6.36-8.74-7.67l-7.55-2.57L170.86 206l7.56 2.59c3.84 1.32 7.99 1.05 11.64-0.74 c3.65-1.79 6.36-4.89 7.67-8.73l11.45-33.45C210.49 161.82 210.23 157.69 208.44 154.04z" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Viewbox>

<StackPanel Margin="10,0,0,0">
<TextBlock Text="{DynamicResource LOCReview_Viewer_ReviewRecommendedLabel}"
<StackPanel Margin="10,0,0,0">
<TextBlock Text="{DynamicResource LOCReview_Viewer_ReviewRecommendedLabel}"
Visibility="{Binding SelectedReview.VotedUp, Converter={StaticResource BooleanToVisibilityConverter}}" />
<TextBlock Text="{DynamicResource LOCReview_Viewer_ReviewNotRecommendedLabel}"
<TextBlock Text="{DynamicResource LOCReview_Viewer_ReviewNotRecommendedLabel}"
Visibility="{Binding SelectedReview.VotedUp, Converter={StaticResource InvertedBooleanToVisibilityConverter}}" />
<TextBlock Text="{Binding FormattedPlaytime}" Opacity="0.75" />
<TextBlock Text="{Binding FormattedPlaytime}" Opacity="0.75" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>

<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,10">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" MinWidth="40">
<TextBlock Text="{Binding SelectedReviewDisplayIndex}" Margin="0" VerticalAlignment="Center"/>
<TextBlock Text="/" Margin="0" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Reviews.QuerySummary.NumReviews}" Margin="0" VerticalAlignment="Center"/>
</StackPanel>
<Button DockPanel.Dock="Right" Background="Transparent" BorderThickness="0" Content="&#xEAC9;" FontSize="40" FontFamily="{DynamicResource FontIcoFont}"
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,10">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" MinWidth="40">
<TextBlock Text="{Binding SelectedReviewDisplayIndex}" Margin="0" VerticalAlignment="Center"/>
<TextBlock Text="/" Margin="0" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Reviews.QuerySummary.NumReviews}" Margin="0" VerticalAlignment="Center"/>
</StackPanel>
<Button DockPanel.Dock="Right" Background="Transparent" BorderThickness="0" Content="&#xEAC9;" FontSize="40" FontFamily="{DynamicResource FontIcoFont}"
Command="{Binding PreviousReviewCommand}" Margin="10,0,0,0" Padding="0" VerticalAlignment="Center" />
<Button Name="ButtonNextReview" Background="Transparent" BorderThickness="0" Content="&#xEACA;" FontSize="40" FontFamily="{DynamicResource FontIcoFont}"
<Button Name="ButtonNextReview" Background="Transparent" BorderThickness="0" Content="&#xEACA;" FontSize="40" FontFamily="{DynamicResource FontIcoFont}"
Command="{Binding NextReviewCommand}" Margin="5,0,10,0" Padding="0" VerticalAlignment="Center"/>
</StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0,0,0,10" Height="180">
<TextBlock Text="{Binding SelectedReview.ReviewReview}" TextWrapping="Wrap"/>
</ScrollViewer>
</StackPanel>

<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0,0,0,10" Height="170">
<TextBlock Text="{Binding SelectedReview.ReviewReview}" TextWrapping="Wrap"/>
</ScrollViewer>

<DockPanel>
<StackPanel>
<Button Content="{DynamicResource LOCReview_Viewer_ReviewTypeAll}" MinWidth="60" Margin="5" Command="{Binding SwitchAllReviewsCommand}"/>
<Button Content="{DynamicResource LOCReview_Viewer_ReviewTypePositive}" MinWidth="60" Margin="5" Command="{Binding SwitchPositiveReviewsCommand}"/>
<Button Content="{DynamicResource LOCReview_Viewer_ReviewTypeNegative}" MinWidth="60" Margin="5" Command="{Binding SwitchNegativeReviewsCommand}"/>
</StackPanel>
<Grid Name="SummaryGrid" Margin="0,0,0,10">
<Grid Name="SummaryGrid" Margin="0,0,0,10" Visibility="{Binding MainPanelVisibility, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
Expand Down
6 changes: 5 additions & 1 deletion source/Generic/ReviewViewer/Controls/ReviewsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ public RelayCommand<object> SwitchAllReviewsCommand
void SwitchAllReviews()
{
selectedReviewSearch = ReviewSearchType.All;
SummaryGrid.Visibility = Visibility.Visible;
if (mainPanelVisibility == Visibility.Visible)
{
SummaryGrid.Visibility = Visibility.Visible;
}
UpdateReviewsContext();
}

Expand Down Expand Up @@ -297,6 +300,7 @@ public void UpdateReviewsContext()
{
if (!SettingsModel.Settings.DownloadDataOnGameSelection)
{
MainPanelVisibility = Visibility.Collapsed;
return;
}

Expand Down

0 comments on commit 4ab50ad

Please sign in to comment.