Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 387f2e3

Browse files
Revert "Using only one view"
This reverts commit 271c2cd.
1 parent e249664 commit 387f2e3

File tree

6 files changed

+128
-1
lines changed

6 files changed

+128
-1
lines changed

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@
102102
<Compile Include="Services\PullRequestSessionManager.cs" />
103103
<Compile Include="Margins\InlineCommentMarginProvider.cs" />
104104
<Compile Include="Services\PullRequestSessionService.cs" />
105+
<Compile Include="Tags\ShowInlineAnnotationGlyph.xaml.cs">
106+
<DependentUpon>ShowInlineAnnotationGlyph.xaml</DependentUpon>
107+
</Compile>
108+
<Compile Include="Tags\ShowInlineCommentAnnotationGlyph.xaml.cs">
109+
<DependentUpon>ShowInlineCommentAnnotationGlyph.xaml</DependentUpon>
110+
</Compile>
105111
<Compile Include="ViewModels\PullRequestFileMarginViewModel.cs" />
106112
<Compile Include="ViewModels\InlineCommentPeekViewModel.cs" />
107113
<Compile Include="ViewModels\PullRequestStatusViewModel.cs" />
@@ -408,6 +414,14 @@
408414
<SubType>Designer</SubType>
409415
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
410416
</Page>
417+
<Page Include="Tags\ShowInlineAnnotationGlyph.xaml">
418+
<Generator>MSBuild:Compile</Generator>
419+
<SubType>Designer</SubType>
420+
</Page>
421+
<Page Include="Tags\ShowInlineCommentAnnotationGlyph.xaml">
422+
<Generator>MSBuild:Compile</Generator>
423+
<SubType>Designer</SubType>
424+
</Page>
411425
<Page Include="Views\PullRequestFileMarginView.xaml">
412426
<SubType>Designer</SubType>
413427
<Generator>MSBuild:Compile</Generator>

src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,25 @@ static UserControl CreateGlyph(InlineCommentTag tag)
5959

6060
if (showTag != null)
6161
{
62-
return new ShowInlineCommentGlyph();
62+
if (showTag.Thread != null && showTag.Annotations != null)
63+
{
64+
return new ShowInlineCommentAnnotationGlyph();
65+
}
66+
67+
if (showTag.Thread != null)
68+
{
69+
return new ShowInlineCommentGlyph
70+
{
71+
Opacity = showTag.Thread.IsStale ? 0.5 : 1,
72+
};
73+
}
74+
75+
if (showTag.Annotations != null)
76+
{
77+
return new ShowInlineAnnotationGlyph();
78+
}
79+
80+
throw new ArgumentException($"{nameof(showTag)} does not have a thread or annotations");
6381
}
6482

6583
throw new ArgumentException($"Unknown 'InlineCommentTag' type '{tag}'");
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<UserControl x:Class="GitHub.InlineReviews.Tags.ShowInlineAnnotationGlyph"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
7+
mc:Ignorable="d">
8+
9+
<Grid>
10+
<Border Background="{DynamicResource GitHubGlyphMarginCommentableBackground}" BorderThickness="0,0,1,0" />
11+
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,0">
12+
<Canvas Width="16" Height="16">
13+
<Canvas.Resources>
14+
<Style TargetType="Rectangle">
15+
<Setter Property="Fill" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
16+
<Setter Property="Stroke" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
17+
</Style>
18+
</Canvas.Resources>
19+
<Rectangle Width="8"
20+
Height="8"
21+
Canvas.Top="2.3"
22+
Canvas.Left="2.3"
23+
Fill="#959da5"
24+
Stroke="White"
25+
StrokeThickness="1">
26+
<Rectangle.LayoutTransform>
27+
<RotateTransform Angle="-45" />
28+
</Rectangle.LayoutTransform>
29+
</Rectangle>
30+
</Canvas>
31+
</Viewbox>
32+
</Grid>
33+
</UserControl>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Windows.Controls;
3+
4+
namespace GitHub.InlineReviews.Tags
5+
{
6+
public partial class ShowInlineAnnotationGlyph : UserControl
7+
{
8+
public ShowInlineAnnotationGlyph()
9+
{
10+
InitializeComponent();
11+
}
12+
13+
}
14+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<UserControl x:Class="GitHub.InlineReviews.Tags.ShowInlineCommentAnnotationGlyph"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
7+
mc:Ignorable="d">
8+
9+
<Grid>
10+
<Border Background="{DynamicResource GitHubGlyphMarginCommentableBackground}" BorderThickness="0,0,1,0" />
11+
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,0">
12+
<Canvas Width="16" Height="16">
13+
<Canvas.Resources>
14+
<Style TargetType="Path">
15+
<Setter Property="Fill" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
16+
<Setter Property="Stroke" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
17+
</Style>
18+
</Canvas.Resources>
19+
20+
<Rectangle Width="8"
21+
Height="8"
22+
Canvas.Top="2.3"
23+
Canvas.Left="2.3"
24+
Fill="#959da5"
25+
Stroke="White"
26+
StrokeThickness="1">
27+
<Rectangle.LayoutTransform>
28+
<RotateTransform Angle="-45" />
29+
</Rectangle.LayoutTransform>
30+
</Rectangle>
31+
</Canvas>
32+
</Viewbox>
33+
</Grid>
34+
</UserControl>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Windows.Controls;
3+
4+
namespace GitHub.InlineReviews.Tags
5+
{
6+
public partial class ShowInlineCommentAnnotationGlyph : UserControl
7+
{
8+
public ShowInlineCommentAnnotationGlyph()
9+
{
10+
InitializeComponent();
11+
}
12+
13+
}
14+
}

0 commit comments

Comments
 (0)