Skip to content

Commit b537e1b

Browse files
Maintenance and font adjustments (#86)
#84 adjust font sizes fix height on properties page add fallback for user logged in status fix typo in readme
1 parent a7ed341 commit b537e1b

23 files changed

+674
-584
lines changed
-178 KB
Binary file not shown.
-747 KB
Binary file not shown.

KeyVaultExplorer/KeyVaultExplorer.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
</ItemGroup>
103103

104104
<ItemGroup>
105+
<Compile Update="Views\CustomControls\UserStatusTag.axaml.cs">
106+
<DependentUpon>UserStatusTag.axaml</DependentUpon>
107+
</Compile>
105108
<Compile Update="Views\Pages\PropertiesDialogs\CreateNewSecretVersion.axaml.cs">
106109
<DependentUpon>CreateNewSecretVersion.axaml</DependentUpon>
107110
</Compile>

KeyVaultExplorer/Resources/PercentageConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
1111
if (value is double width)
1212
{
1313
var calculatedWidth = width * 0.25;
14-
return calculatedWidth < 310 ? 310 : calculatedWidth;
14+
var minWidth = calculatedWidth < 310 ? 310 : calculatedWidth;
15+
return minWidth > 550 ? 550 : minWidth;
1516
}
1617
return value;
1718
}

KeyVaultExplorer/Resources/Resources.axaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<ResourceDictionary x:Key="Light">
2929
<StaticResource x:Key="TabViewBorderBrush" ResourceKey="AccentFillColorTertiaryBrush" />
3030

31+
<StaticResource x:Key="IconForegroundColor" ResourceKey="IconForegroundColorBrush" />
32+
<SolidColorBrush x:Key="IconForegroundColorBrush" Color="Transparent" />
33+
3134
<SolidColorBrush
3235
x:Key="AccentFillColorTertiaryBrush"
3336
Opacity="0.15"
@@ -41,7 +44,8 @@
4144
</ResourceDictionary>
4245
<ResourceDictionary x:Key="Dark">
4346
<StaticResource x:Key="TabViewBorderBrush" ResourceKey="AccentFillColorTertiaryBrush" />
44-
47+
<StaticResource x:Key="IconForegroundColor" ResourceKey="IconForegroundColorBrush" />
48+
<SolidColorBrush x:Key="IconForegroundColorBrush" Color="#9a2e00" />
4549
<SolidColorBrush
4650
x:Key="AccentFillColorTertiaryBrush"
4751
Opacity="0.15"

KeyVaultExplorer/Resources/Styles.axaml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,35 +113,38 @@
113113
<!-- Datagrid styles -->
114114

115115
<Style Selector="DataGridColumnHeader">
116-
<Setter Property="MinHeight" Value="25" />
117-
<Setter Property="Height" Value="25" />
116+
<Setter Property="MinHeight" Value="27" />
117+
<Setter Property="Height" Value="27" />
118118
</Style>
119119
<Style Selector="DataGridRowGroupHeader">
120-
<Setter Property="MinHeight" Value="25" />
121-
<Setter Property="Height" Value="25" />
122-
</Style>
123-
<Style Selector="DataGrid DataGridRow:nth-child(2n)">
124-
<Setter Property="Background" Value="rgba(148, 148, 148, 0.04)" />
120+
<Setter Property="MinHeight" Value="27" />
121+
<Setter Property="Height" Value="27" />
125122
</Style>
123+
126124
<Style Selector="DataGridRow">
127-
<Setter Property="Height" Value="25" />
128-
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
125+
<Setter Property="Height" Value="27" />
126+
<Setter Property="FontSize" Value="14" />
129127
</Style>
130128
<Style Selector="DataGridCell">
131-
<Setter Property="Height" Value="22" />
132-
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
129+
<Setter Property="Height" Value="27" />
130+
<Setter Property="FontSize" Value="14" />
133131
</Style>
134132

135133
<Style Selector="DataGridRow">
136-
<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
134+
<!--<Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />-->
135+
<Setter Property="FontSize" Value="14" />
137136
<Setter Property="Focusable" Value="False" />
138137
</Style>
139138

140139
<Style Selector="DataGridCell/template/ Grid#PART_CellRoot">
141-
<Setter Property="Height" Value="25" />
140+
<Setter Property="Height" Value="27" />
142141
</Style>
143142

144143

144+
<Style Selector="DataGrid DataGridRow:nth-child(2n)">
145+
<Setter Property="Background" Value="rgba(148, 148, 148, 0.04)" />
146+
</Style>
147+
145148
<Style Selector="DataGrid:focus DataGridCell:current /template/ Grid#FocusVisual">
146149
<Setter Property="IsVisible" Value="False" />
147150
<Setter Property="Background" Value="Transparent" />

KeyVaultExplorer/Services/ServiceCollectionExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void AddCommonServices(this IServiceCollection collection)
1414
collection.AddSingleton<AuthService>();
1515
collection.AddSingleton<VaultService>();
1616
collection.AddSingleton<TabViewPageViewModel>();
17-
collection.AddSingleton<ToolBarViewModel>();
17+
//collection.AddSingleton<ToolBarViewModel>();
1818
collection.AddSingleton<KeyVaultTreeListViewModel>();
1919
collection.AddSingleton<SettingsPageViewModel>();
2020
collection.AddSingleton<MainViewModel>();

KeyVaultExplorer/ViewModels/MainViewModel.cs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -68,57 +68,3 @@ private async Task SignOut()
6868
AuthenticatedUserClaims = null;
6969
}
7070
}
71-
72-
public class NavigationFactory : INavigationPageFactory
73-
{
74-
// Do this to avoid needing Activator.CreateInstance to create from type info
75-
// and to avoid a ridiculous amount of 'ifs'
76-
private readonly Control[] _pages =
77-
{
78-
new MainPage(),
79-
new SubscriptionsPage(),
80-
new SettingsPage(),
81-
};
82-
83-
private readonly Dictionary<string, Func<Control>> CorePages = new Dictionary<string, Func<Control>>
84-
{
85-
{ "MainPage", () => new MainPage() },
86-
{ "SubscriptionsPage", () => new SubscriptionsPage() },
87-
{ "SettingsPage", () => new SettingsPage() },
88-
};
89-
90-
public NavigationFactory()
91-
{
92-
Instance = this;
93-
}
94-
95-
private static NavigationFactory? Instance { get; set; }
96-
97-
public static Control[] GetPages()
98-
{
99-
return Instance!._pages;
100-
}
101-
102-
// Create a page based on a Type, but you can create it however you want
103-
public Control? GetPage(Type srcType)
104-
{
105-
// Return null here because we won't use this method at all
106-
CorePages.TryGetValue(srcType.FullName, out var func);
107-
Control page = null;
108-
page = func();
109-
return page;
110-
}
111-
112-
// Create a page based on an object, such as a view model
113-
public Control? GetPageFromObject(object target)
114-
{
115-
return target switch
116-
{
117-
MainPage => _pages[0],
118-
SubscriptionsPage => _pages[1],
119-
SettingsPage => _pages[2],
120-
121-
_ => throw new Exception()
122-
};
123-
}
124-
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using Avalonia.Controls;
2+
using FluentAvalonia.UI.Controls;
3+
using KeyVaultExplorer.Views.Pages;
4+
using System;
5+
using System.Collections.Generic;
6+
7+
namespace KeyVaultExplorer.ViewModels;
8+
9+
public class NavigationFactory : INavigationPageFactory
10+
{
11+
// Do this to avoid needing Activator.CreateInstance to create from type info
12+
// and to avoid a ridiculous amount of 'ifs'
13+
private readonly Control[] _pages =
14+
{
15+
new MainPage(),
16+
new SubscriptionsPage(),
17+
new SettingsPage(),
18+
};
19+
20+
private readonly Dictionary<string, Func<Control>> CorePages = new Dictionary<string, Func<Control>>
21+
{
22+
{ "MainPage", () => new MainPage() },
23+
{ "SubscriptionsPage", () => new SubscriptionsPage() },
24+
{ "SettingsPage", () => new SettingsPage() },
25+
};
26+
27+
public NavigationFactory()
28+
{
29+
Instance = this;
30+
}
31+
32+
private static NavigationFactory? Instance { get; set; }
33+
34+
public static Control[] GetPages()
35+
{
36+
return Instance!._pages;
37+
}
38+
39+
// Create a page based on a Type, but you can create it however you want
40+
public Control? GetPage(Type srcType)
41+
{
42+
// Return null here because we won't use this method at all
43+
CorePages.TryGetValue(srcType.FullName, out var func);
44+
Control page = null;
45+
page = func();
46+
return page;
47+
}
48+
49+
// Create a page based on an object, such as a view model
50+
public Control? GetPageFromObject(object target)
51+
{
52+
return target switch
53+
{
54+
MainPage => _pages[0],
55+
SubscriptionsPage => _pages[1],
56+
SettingsPage => _pages[2],
57+
58+
_ => throw new Exception()
59+
};
60+
}
61+
}

KeyVaultExplorer/ViewModels/VaultPageViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public partial class VaultPageViewModel : ViewModelBase
3939
private NotificationViewModel _notificationViewModel;
4040

4141
private SettingsPageViewModel _settingsPageViewModel;
42+
public string VaultTotalString => VaultContents.Count == 0 || VaultContents.Count > 1 ? $"{VaultContents.Count} items" : "1 item";
4243

4344
[ObservableProperty]
4445
private string authorizationMessage;
@@ -47,6 +48,7 @@ public partial class VaultPageViewModel : ViewModelBase
4748
private bool hasAuthorizationError = false;
4849

4950
[ObservableProperty]
51+
[NotifyPropertyChangedFor(nameof(VaultTotalString))]
5052
private bool isBusy = false;
5153

5254
[ObservableProperty]
@@ -59,6 +61,7 @@ public partial class VaultPageViewModel : ViewModelBase
5961
private TabStripItem selectedTab;
6062

6163
[ObservableProperty]
64+
[NotifyPropertyChangedFor(nameof(VaultTotalString))]
6265
private ObservableCollection<KeyVaultContentsAmalgamation> vaultContents;
6366

6467
[ObservableProperty]

0 commit comments

Comments
 (0)