Skip to content

Commit 201b319

Browse files
committed
Fix connection cards: full-width, correct connected state, remove redundant action
- Added HorizontalAlignment=Stretch to all card buttons for full-width rows - Removed redundant "Connect" action text from GitHub card (clicking the card itself triggers the connection) - Fixed Google/Microsoft always showing "Connected" — ObjectConverters.Equal compared int Count to string "0" which never matched. Added IsGoogleConnected and IsMicrosoftConnected bool properties set from LoadXxxConnections() instead - Removed unused "Connect" action text from Google/Microsoft cards (kept only the connecting spinner)
1 parent cea8582 commit 201b319

2 files changed

Lines changed: 18 additions & 26 deletions

File tree

desktop/PrivStack.Desktop/ViewModels/ConnectionsViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ public ConnectionsViewModel(
9696
[ObservableProperty]
9797
private bool _isGoogleConnecting;
9898

99+
[ObservableProperty]
100+
private bool _isGoogleConnected;
101+
99102
// ========================================
100103
// Microsoft Connection State
101104
// ========================================
@@ -106,6 +109,9 @@ public ConnectionsViewModel(
106109
[ObservableProperty]
107110
private bool _isMicrosoftConnecting;
108111

112+
[ObservableProperty]
113+
private bool _isMicrosoftConnected;
114+
109115
// ========================================
110116
// Plugin-Driven Provider Visibility
111117
// ========================================
@@ -352,6 +358,7 @@ private async void LoadGoogleConnections()
352358
var connections = await _connectionService.GetConnectionsAsync("google");
353359
GoogleConnections = new ObservableCollection<OAuthConnectionItem>(
354360
connections.Select(c => ToOAuthItem("google", c)));
361+
IsGoogleConnected = GoogleConnections.Count > 0;
355362
}
356363
catch (Exception ex)
357364
{
@@ -366,6 +373,7 @@ private async void LoadMicrosoftConnections()
366373
var connections = await _connectionService.GetConnectionsAsync("microsoft");
367374
MicrosoftConnections = new ObservableCollection<OAuthConnectionItem>(
368375
connections.Select(c => ToOAuthItem("microsoft", c)));
376+
IsMicrosoftConnected = MicrosoftConnections.Count > 0;
369377
}
370378
catch (Exception ex)
371379
{

desktop/PrivStack.Desktop/Views/SettingsPanel.axaml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,13 +1119,13 @@
11191119
IsEnabled="{Binding !IsConnecting}"
11201120
IsVisible="{Binding IsGitHubRequired}"
11211121
Background="Transparent" BorderThickness="0"
1122-
Padding="0"
1122+
Padding="0" HorizontalAlignment="Stretch"
11231123
HorizontalContentAlignment="Stretch">
11241124
<Border CornerRadius="10" Padding="12,10"
11251125
Background="{DynamicResource ThemeSurfaceBrush}"
11261126
BorderBrush="{DynamicResource ThemeBorderBrush}"
11271127
BorderThickness="1">
1128-
<Grid ColumnDefinitions="Auto,*,Auto">
1128+
<Grid ColumnDefinitions="Auto,*">
11291129
<!-- GitHub logo with themed background -->
11301130
<Border CornerRadius="8" Width="36" Height="36"
11311131
Background="{DynamicResource ThemeGitHubBrandBrush}"
@@ -1155,12 +1155,6 @@
11551155
IsVisible="{Binding IsGitHubConnected}"
11561156
TextWrapping="Wrap"/>
11571157
</StackPanel>
1158-
<!-- Action hint -->
1159-
<TextBlock Grid.Column="2" Text="Connect"
1160-
FontSize="{DynamicResource ThemeFontSizeXs}"
1161-
Foreground="{DynamicResource ThemePrimaryBrush}"
1162-
VerticalAlignment="Center"
1163-
IsVisible="{Binding !IsGitHubConnected}"/>
11641158
</Grid>
11651159
</Border>
11661160
</Button>
@@ -1170,7 +1164,7 @@
11701164
IsEnabled="{Binding !IsGoogleConnecting}"
11711165
IsVisible="{Binding IsGoogleRequired}"
11721166
Background="Transparent" BorderThickness="0"
1173-
Padding="0"
1167+
Padding="0" HorizontalAlignment="Stretch"
11741168
HorizontalContentAlignment="Stretch">
11751169
<Border CornerRadius="10" Padding="12,10"
11761170
Background="{DynamicResource ThemeSurfaceBrush}"
@@ -1199,21 +1193,16 @@
11991193
<TextBlock Text="Connect your account"
12001194
FontSize="{DynamicResource ThemeFontSizeXs}"
12011195
Foreground="{DynamicResource ThemeTextMutedBrush}"
1202-
IsVisible="{Binding GoogleConnections.Count, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=0}"
1196+
IsVisible="{Binding !IsGoogleConnected}"
12031197
TextWrapping="Wrap"/>
12041198
<!-- Connected -->
12051199
<TextBlock Text="Connected"
12061200
FontSize="{DynamicResource ThemeFontSizeXs}"
12071201
Foreground="{DynamicResource ThemeSuccessBrush}"
1208-
IsVisible="{Binding GoogleConnections.Count, Converter={x:Static ObjectConverters.NotEqual}, ConverterParameter=0}"
1202+
IsVisible="{Binding IsGoogleConnected}"
12091203
TextWrapping="Wrap"/>
12101204
</StackPanel>
1211-
<!-- Action hint / spinner -->
1212-
<TextBlock Grid.Column="2" Text="Connect"
1213-
FontSize="{DynamicResource ThemeFontSizeXs}"
1214-
Foreground="{DynamicResource ThemePrimaryBrush}"
1215-
VerticalAlignment="Center"
1216-
IsVisible="{Binding GoogleConnections.Count, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=0}"/>
1205+
<!-- Connecting spinner -->
12171206
<ProgressBar Grid.Column="2" IsIndeterminate="True" Width="40" Height="3"
12181207
VerticalAlignment="Center"
12191208
IsVisible="{Binding IsGoogleConnecting}"/>
@@ -1226,7 +1215,7 @@
12261215
IsEnabled="{Binding !IsMicrosoftConnecting}"
12271216
IsVisible="{Binding IsMicrosoftRequired}"
12281217
Background="Transparent" BorderThickness="0"
1229-
Padding="0"
1218+
Padding="0" HorizontalAlignment="Stretch"
12301219
HorizontalContentAlignment="Stretch">
12311220
<Border CornerRadius="10" Padding="12,10"
12321221
Background="{DynamicResource ThemeSurfaceBrush}"
@@ -1255,21 +1244,16 @@
12551244
<TextBlock Text="Connect your account"
12561245
FontSize="{DynamicResource ThemeFontSizeXs}"
12571246
Foreground="{DynamicResource ThemeTextMutedBrush}"
1258-
IsVisible="{Binding MicrosoftConnections.Count, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=0}"
1247+
IsVisible="{Binding !IsMicrosoftConnected}"
12591248
TextWrapping="Wrap"/>
12601249
<!-- Connected -->
12611250
<TextBlock Text="Connected"
12621251
FontSize="{DynamicResource ThemeFontSizeXs}"
12631252
Foreground="{DynamicResource ThemeSuccessBrush}"
1264-
IsVisible="{Binding MicrosoftConnections.Count, Converter={x:Static ObjectConverters.NotEqual}, ConverterParameter=0}"
1253+
IsVisible="{Binding IsMicrosoftConnected}"
12651254
TextWrapping="Wrap"/>
12661255
</StackPanel>
1267-
<!-- Action hint / spinner -->
1268-
<TextBlock Grid.Column="2" Text="Connect"
1269-
FontSize="{DynamicResource ThemeFontSizeXs}"
1270-
Foreground="{DynamicResource ThemePrimaryBrush}"
1271-
VerticalAlignment="Center"
1272-
IsVisible="{Binding MicrosoftConnections.Count, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=0}"/>
1256+
<!-- Connecting spinner -->
12731257
<ProgressBar Grid.Column="2" IsIndeterminate="True" Width="40" Height="3"
12741258
VerticalAlignment="Center"
12751259
IsVisible="{Binding IsMicrosoftConnecting}"/>

0 commit comments

Comments
 (0)