Skip to content

Commit c6e2660

Browse files
committed
Fix #28 on icon theming
1 parent f49d78f commit c6e2660

6 files changed

+29
-15
lines changed
+15-9
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
using System.Globalization;
1+
using Newtonsoft.Json.Linq;
2+
using System.Globalization;
3+
using System.Windows;
24
using System.Windows.Data;
35
using System.Windows.Media;
46

57
namespace GitHubActionsVS.Converters;
68

7-
public class ConclusionColorConverter : IValueConverter
9+
public class ConclusionColorConverter : IMultiValueConverter
810
{
9-
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
12+
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1013
{
11-
string status = value as string;
12-
return GetConclusionColor(status);
14+
string status = values[0] as string;
15+
Brush defaultBrush = values[1] as Brush;
16+
17+
return GetConclusionColor(status, defaultBrush);
1318
}
1419

15-
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20+
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
1621
{
17-
return value;
22+
throw new NotImplementedException();
1823
}
1924

20-
private SolidColorBrush GetConclusionColor(string status) => status.ToLowerInvariant() switch
25+
private Brush GetConclusionColor(string status, Brush inheritedBrush) => status.ToLowerInvariant() switch
2126
{
27+
2228
"success" => new SolidColorBrush(Colors.Green),
2329
"failure" => new SolidColorBrush(Colors.Red),
2430
"startup_failure" => new SolidColorBrush(Colors.Red),
2531
"waiting" => new SolidColorBrush(Color.FromRgb(154, 103, 0)),
26-
_ => new SolidColorBrush(Colors.Black),
32+
_ => inheritedBrush,
2733
};
2834
}

src/Converters/ConclusionIconConverter.cs

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
3030
"inprogress" => "\uEA82 ",
3131
"in_progress" => "\uEA82 ",
3232
"warning" => "\uEC1F ",
33+
null => "\uEA82 ",
3334
_ => "\uEA74 ",
3435
};
3536
}

src/Helpers/ConclusionFilter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static bool IsFinished(string conclusion)
1111
{
1212
return conclusion.ToLower() switch
1313
{
14-
"pending" or "waiting" or "queued" or "in_progress" or "inprogress" or "requested" => false,
14+
"pending" or "waiting" or "queued" or "in_progress" or "inprogress" or "requested" or null => false,
1515
_ => true,
1616
};
1717
}

src/Resources/UIStrings.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Resources/UIStrings.resx

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
<comment>For when no environments defined</comment>
199199
</data>
200200
<data name="NO_GIT_REPO" xml:space="preserve">
201-
<value>No git repo found</value>
201+
<value>No GitHub repositories found. Please open a folder that contains a GitHub repository.</value>
202202
<comment>For when no git repo is found</comment>
203203
</data>
204204
<data name="NO_PROJ_LOADED" xml:space="preserve">

src/ToolWindows/GHActionsToolWindow.xaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@
5858
<HierarchicalDataTemplate x:Key="TreeViewRunNodeDataTemplate" ItemsSource="{Binding Jobs}">
5959
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
6060
<TextBlock VerticalAlignment="Center" FontFamily="{StaticResource CodiconFont}"
61-
Foreground="{Binding Path=Conclusion, Converter={StaticResource ConclusionColorConverter}}"
62-
Text="{Binding Path=Conclusion, Converter={StaticResource ConclusionIconConverter}}"/>
61+
Text="{Binding Conclusion, Converter={StaticResource ConclusionIconConverter}}"
62+
Tag="{Binding ElementName=MessageArea, Path=Foreground}">
63+
<TextBlock.Foreground>
64+
<MultiBinding Converter="{StaticResource ConclusionColorConverter}">
65+
<Binding Path="Conclusion" />
66+
<Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
67+
</MultiBinding>
68+
</TextBlock.Foreground>
69+
</TextBlock>
6370
<emoji:TextBlock Text="{Binding DisplayName}" VerticalAlignment="Bottom" Tag="{Binding Url}">
6471
<emoji:TextBlock.ToolTip>
6572
<ToolTip Visibility="{Binding TriggerEvent, Converter={StaticResource NullVisibilityConverter}}">
@@ -119,7 +126,7 @@
119126
</Grid.RowDefinitions>
120127
<ProgressBar x:Name="refreshProgress" Height="5" Grid.Row="0" Visibility="Hidden"/>
121128
<Grid Grid.Row="1">
122-
<TextBlock HorizontalAlignment="Center" x:Name="MessageArea" />
129+
<TextBlock HorizontalAlignment="Center" x:Name="MessageArea" TextWrapping="Wrap" Margin="20" />
123130
<ScrollViewer VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="5,5,0,0" x:Name="ActionsInfoPanel">
124131
<StackPanel Orientation="Vertical">
125132
<Expander Header="{x:Static resx:UIStrings.HEADER_CURRENT_BRANCH}" x:Name="CurrentBranchExpander" FontWeight="Bold" ToolTipService.ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Header}">

0 commit comments

Comments
 (0)