Skip to content

Commit 18a64e0

Browse files
committed
gitlab: don't show logo for 3rd party instances
On custom GitLab instances, don't show the GitLab "fox" logo, only the logotype. We also replace the old PNG logo with SVG/vector versions for better display on high-resolution displays. Ensure we only show the "sign up" link for GitLab.com fix wpf
1 parent 22e07c7 commit 18a64e0

File tree

8 files changed

+316
-18
lines changed

8 files changed

+316
-18
lines changed
Binary file not shown.

src/shared/GitLab.UI.Avalonia/GitLab.UI.Avalonia.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@
2828
</Compile>
2929
</ItemGroup>
3030

31-
<ItemGroup>
32-
<AvaloniaResource Include="Assets\gitlab-logo-gray-rgb.png" />
33-
</ItemGroup>
34-
3531
</Project>

src/shared/GitLab.UI.Avalonia/Views/CredentialsView.axaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,26 @@
66
xmlns:vm="clr-namespace:GitLab.UI.ViewModels;assembly=GitLab.UI.Shared"
77
xmlns:converters="clr-namespace:GitCredentialManager.UI.Converters;assembly=gcmcoreuiavn"
88
mc:Ignorable="d" d:DesignWidth="420"
9-
x:Class="GitLab.UI.Views.CredentialsView">
9+
x:Class="GitLab.UI.Views.CredentialsView"
10+
x:Name="view">
1011
<Design.DataContext>
1112
<vm:CredentialsViewModel/>
1213
</Design.DataContext>
1314
<DockPanel>
1415
<StackPanel DockPanel.Dock="Top" Margin="0,0,0,15">
15-
<Image Source="../Assets/gitlab-logo-gray-rgb.png"
16-
HorizontalAlignment="Center"
17-
Height="80"/>
16+
<!--
17+
Only show the GitLab logo when this is GitLab.com,
18+
otherwise show just the logo type "GitLab".
19+
-->
20+
<StackPanel Orientation="Horizontal"
21+
HorizontalAlignment="Center"
22+
Margin="0,0,0,10">
23+
<Image Source="{Binding GitLabLogoImage, ElementName=view}"
24+
Height="46" VerticalAlignment="Center" Margin="0,0,8,0"
25+
IsVisible="{Binding Url, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
26+
<Image Source="{Binding GitLabLogoTypeImage, ElementName=view}"
27+
Height="24" VerticalAlignment="Center"/>
28+
</StackPanel>
1829
<TextBlock Text="Sign in"
1930
HorizontalAlignment="Center"
2031
FontSize="16"
@@ -27,6 +38,7 @@
2738
</StackPanel>
2839

2940
<WrapPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Center"
41+
IsVisible="{Binding Url, Converter={x:Static StringConverters.IsNullOrEmpty}}"
3042
Margin="0,20,0,0">
3143
<TextBlock Text="Don't have an account?" Margin="0,0,5,0" />
3244
<Button Content="Sign up"

src/shared/GitLab.UI.Avalonia/Views/CredentialsView.axaml.cs

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
using Avalonia;
12
using Avalonia.Controls;
23
using Avalonia.Markup.Xaml;
4+
using Avalonia.Media;
35
using GitLab.UI.ViewModels;
46
using GitCredentialManager.UI.Controls;
57

@@ -13,6 +15,8 @@ public class CredentialsView : UserControl, IFocusable
1315
private TextBox _patUserNameTextBox;
1416
private TextBox _userNameTextBox;
1517
private TextBox _passwordTextBox;
18+
private DrawingImage _gitLabLogoImage;
19+
private DrawingImage _gitLabLogoTypeImage;
1620

1721
public CredentialsView()
1822
{
@@ -63,5 +67,132 @@ public void SetFocus()
6367
}
6468
}
6569
}
70+
71+
public IImage GitLabLogoImage
72+
{
73+
get
74+
{
75+
if (_gitLabLogoImage is null)
76+
{
77+
var brush1 = SolidColorBrush.Parse("#E24329");
78+
var brush2 = SolidColorBrush.Parse("#FCA326");
79+
var brush3 = SolidColorBrush.Parse("#FC6D26");
80+
81+
var geometry1 = PathGeometry.Parse(
82+
"M442.097,243.57h-87.12l37.425-115.224c1.919-5.895,10.282-5.895,12.27,0L442.097,243.57L442.097,243.57z" +
83+
"M292.778,434.892L292.778,434.892l62.199-191.322H230.669L292.778,434.892L292.778,434.892z" +
84+
"M143.549,243.57h87.12l-37.494-115.224c-1.919-5.895-10.282-5.895-12.27,0L143.549,243.57L143.549,243.57z"
85+
);
86+
var geometry2 = PathGeometry.Parse(
87+
"M442.097,243.57L442.097,243.57l18.873,58.126c1.714,5.278-0.137,11.104-4.661,14.394L292.778,434.892L442.097,243.57L442.097,243.57z" +
88+
"M143.549,243.57L143.549,243.57l-18.941,58.126c-1.714,5.278,0.137,11.104,4.661,14.394l163.509,118.801L143.549,243.57L143.549,243.57z"
89+
);
90+
var poly1 = new PolylineGeometry
91+
{
92+
Points =
93+
{
94+
new Point(292.778,434.892),
95+
new Point(354.977,243.57),
96+
new Point(442.097,243.57),
97+
}
98+
};
99+
var poly2 = new PolylineGeometry
100+
{
101+
Points =
102+
{
103+
new Point(292.778,434.892),
104+
new Point(143.549,243.57),
105+
new Point(230.669,243.57),
106+
}
107+
};
108+
109+
_gitLabLogoImage = new DrawingImage
110+
{
111+
Drawing = new DrawingGroup
112+
{
113+
Children =
114+
{
115+
new GeometryDrawing { Geometry = geometry1, Brush = brush1 },
116+
new GeometryDrawing { Geometry = geometry2, Brush = brush2 },
117+
new GeometryDrawing { Geometry = poly1, Brush = brush3 },
118+
new GeometryDrawing { Geometry = poly2, Brush = brush3 },
119+
}
120+
}
121+
};
122+
}
123+
124+
return _gitLabLogoImage;
125+
}
126+
}
127+
128+
public IImage GitLabLogoTypeImage
129+
{
130+
get
131+
{
132+
if (_gitLabLogoTypeImage is null)
133+
{
134+
var brush = SolidColorBrush.Parse("#8C929D");
135+
var geometry1 = PathGeometry.Parse(
136+
"M13,188.892c-5.5,5.7-14.6,11.4-27,11.4c-16.6,0-23.3-8.2-23.3-18.9" +
137+
"c0-16.1,11.2-23.8,35-23.8c4.5,0,11.7,0.5,15.4,1.2v30.1H13z M-9.6,90.392c-17.6,0-33.8,6.2-46.4,16.7l7.7,13.4" +
138+
"c8.9-5.2,19.8-10.4,35.5-10.4c17.9,0,25.8,9.2,25.8,24.6v7.9c-3.5-0.7-10.7-1.2-15.1-1.2c-38.2,0-57.6,13.4-57.6,41.4" +
139+
"c0,25.1,15.4,37.7,38.7,37.7c15.7,0,30.8-7.2,36-18.9l4,15.9h15.4v-83.2C34.3,107.992,22.9,90.392-9.6,90.392L-9.6,90.392z"
140+
);
141+
var geometry2 = PathGeometry.Parse(
142+
"M-17.7,201.192c-8.2,0-15.4-1-20.8-3.5v-67.3v-7.8c7.4-6.2,16.6-10.7,28.3-10.7" +
143+
"c21.1,0,29.2,14.9,29.2,39C19,185.092,5.9,201.192-17.7,201.192 M-8.5,90.592c-19.5,0-30,13.3-30,13.3v-21l-0.1-27.8h-9.8h-11.5" +
144+
"l0.1,158.5c10.7,4.5,25.3,6.9,41.2,6.9c40.7,0,60.3-26,60.3-70.9C41.6,114.092,23.5,90.592-8.5,90.592"
145+
);
146+
var geometry3 = PathGeometry.Parse(
147+
"M18.3,72.192c19.3,0,31.8,6.4,39.9,12.9l9.4-16.3c-12.7-11.2-29.9-17.2-48.3-17.2" +
148+
"c-46.4,0-78.9,28.3-78.9,85.4c0,59.8,35.1,83.1,75.2,83.1c20.1,0,37.2-4.7,48.4-9.4l-0.5-63.9v-7.5v-12.6H4v20.1h38l0.5,48.5" +
149+
"c-5,2.5-13.6,4.5-25.3,4.5c-32.2,0-53.8-20.3-53.8-63C-36.7,93.292-14.4,72.192,18.3,72.192"
150+
);
151+
var geometry4 = PathGeometry.Parse(
152+
"M-37.7,55.592H-59l0.1,27.3v11.2v6.5v11.4v65v0.2c0,26.3,11.4,43.9,43.9,43.9" +
153+
"c4.5,0,8.9-0.4,13.1-1.2v-19.1c-3.1,0.5-6.4,0.7-9.9,0.7c-17.9,0-25.8-9.2-25.8-24.6v-65h35.7v-17.8h-35.7L-37.7,55.592" +
154+
"L-37.7,55.592z"
155+
);
156+
var geometry5 = PathGeometry.Parse(
157+
"M839.7,198.192h-21.8l0.1,162.5h88.3v-20.1h-66.5L839.7,198.192L839.7,198.192z" +
158+
"M680.4,360.692h21.3v-124h-21.3V360.692L680.4,360.692z" +
159+
"M680.4,219.592h21.3v-21.3h-21.3V219.592L680.4,219.592z"
160+
);
161+
162+
_gitLabLogoTypeImage = new DrawingImage
163+
{
164+
Drawing = new DrawingGroup
165+
{
166+
Children =
167+
{
168+
new DrawingGroup
169+
{
170+
Transform = new TranslateTransform(977.327440, 143.286396),
171+
Children = { new GeometryDrawing { Geometry = geometry1, Brush = brush } }
172+
},
173+
new DrawingGroup
174+
{
175+
Transform = new TranslateTransform(1099.766904, 143.128930),
176+
Children = { new GeometryDrawing { Geometry = geometry2, Brush = brush } }
177+
},
178+
new DrawingGroup
179+
{
180+
Transform = new TranslateTransform(584.042117, 143.630796),
181+
Children = { new GeometryDrawing { Geometry = geometry3, Brush = brush } }
182+
},
183+
new DrawingGroup
184+
{
185+
Transform = new TranslateTransform(793.569045, 142.577463),
186+
Children = { new GeometryDrawing { Geometry = geometry4, Brush = brush } }
187+
},
188+
new GeometryDrawing { Geometry = geometry5, Brush = brush },
189+
}
190+
}
191+
};
192+
}
193+
194+
return _gitLabLogoTypeImage;
195+
}
196+
}
66197
}
67198
}
Binary file not shown.

src/windows/GitLab.UI.Windows/GitLab.UI.Windows.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,4 @@
1919
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
2020
</ItemGroup>
2121

22-
<ItemGroup>
23-
<Resource Include="Assets\gitlab-logo-gray-rgb.png" />
24-
</ItemGroup>
25-
2622
</Project>

src/windows/GitLab.UI.Windows/Views/CredentialsView.xaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
xmlns:sharedControls="clr-namespace:GitCredentialManager.UI.Controls;assembly=gcmcoreuiwpf"
1010
mc:Ignorable="d"
1111
d:DataContext="{d:DesignInstance viewModels:CredentialsViewModel}"
12-
d:DesignWidth="300">
12+
d:DesignWidth="300"
13+
x:Name="view">
1314
<UserControl.Resources>
1415
<ResourceDictionary>
1516
<ResourceDictionary.MergedDictionaries>
@@ -22,10 +23,19 @@
2223

2324
<DockPanel>
2425
<StackPanel DockPanel.Dock="Top" Margin="0,0,0,15">
25-
<!-- TODO: replace with GitLab logo -->
26-
<Image Source="/Assets/gitlab-logo-gray-rgb.png"
27-
HorizontalAlignment="Center"
28-
Height="80"/>
26+
<!--
27+
Only show the GitLab logo when this is GitLab.com,
28+
otherwise show just the logo type "GitLab".
29+
-->
30+
<StackPanel Orientation="Horizontal"
31+
HorizontalAlignment="Center"
32+
Margin="0,0,0,10">
33+
<Image Source="{Binding GitLabLogoImage, ElementName=view}"
34+
Height="46" VerticalAlignment="Center" Margin="0,0,8,0"
35+
Visibility="{Binding Url, Converter={StaticResource NonEmptyStringToVisibleConverter}, ConverterParameter=Invert}"/>
36+
<Image Source="{Binding GitLabLogoTypeImage, ElementName=view}"
37+
Height="24" VerticalAlignment="Center"/>
38+
</StackPanel>
2939
<TextBlock Text="Sign in"
3040
HorizontalAlignment="Center"
3141
FontSize="16"
@@ -40,7 +50,8 @@
4050
</StackPanel>
4151

4252
<WrapPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Center"
43-
Margin="0,20,0,0">
53+
Margin="0,20,0,0"
54+
Visibility="{Binding Url, Converter={StaticResource NonEmptyStringToVisibleConverter}, ConverterParameter=Invert}">
4455
<TextBlock Text="Don't have an account? "
4556
Margin="0,0,5,0"
4657
FontSize="14">

0 commit comments

Comments
 (0)