Skip to content

Commit 56344c5

Browse files
author
Mani
committed
Styled User cards and a few other stuff in Welcome page and signin
1 parent dac758b commit 56344c5

8 files changed

Lines changed: 147 additions & 90 deletions

File tree

App.axaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
<Color x:Key="NavButtonsHoverBackground">#DDDDDD</Color>
4242
<Color x:Key="NavButtonsPressedBackground">#CCCCCC</Color>
4343
<Color x:Key="ReadOnlyBackground">#DEDEDE</Color>
44-
<Color x:Key="WelcomePageBackgroundDarker">#898791</Color>
45-
<Color x:Key="WelcomePageBackgroundLighter">#ECEAF5</Color>
46-
<Color x:Key="WelcomeUserCardBackground">#BFBFBF</Color>
4744

4845
<SolidColorBrush x:Key="MyProjectsForeground">#555555</SolidColorBrush>
4946
<SolidColorBrush x:Key="CollapseIconForeground">Black</SolidColorBrush>
@@ -69,9 +66,6 @@
6966
<Color x:Key="NavButtonsHoverBackground">#5C5C5C</Color>
7067
<Color x:Key="NavButtonsPressedBackground">#3C3C3C</Color>
7168
<Color x:Key="ReadOnlyBackground">#2B2B2B</Color>
72-
<Color x:Key="WelcomePageBackgroundDarker">#242424</Color>
73-
<Color x:Key="WelcomePageBackgroundLighter">#404040</Color>
74-
<Color x:Key="WelcomeUserCardBackground">#2A2A2A</Color>
7569

7670
<SolidColorBrush x:Key="MyProjectsForeground">WhiteSmoke</SolidColorBrush>
7771
<SolidColorBrush x:Key="CollapseIconForeground">White</SolidColorBrush>

Services/AppSettingsService.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ public class AppSettingsService {
2121
"settings.json"
2222
);
2323

24-
private static readonly string DefaultSettingsPath = Path.Combine(
25-
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
26-
"ProjectManagementSystem",
27-
"settings.json"
28-
);
29-
3024
public GlobalSettings GlobalSettings { get; private set; } = new();
3125
public UserSettings CurrentSettings { get; private set; } = new();
3226

@@ -129,12 +123,6 @@ private void Apply(UserSettings settings) {
129123
_ => ThemeVariant.Default
130124
};
131125
}
132-
133-
private static string GetSettingsPath(int userId) => Path.Combine(
134-
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
135-
"ProjectManagementSystem",
136-
$"settings.user.{userId}.json"
137-
);
138126

139127
public void LoadForUser(int userId) {
140128
var path = GetUserSettingsPath(userId);
@@ -184,4 +172,20 @@ public void AddRememberedUser(int userId) {
184172
}
185173
SaveGlobal();
186174
}
175+
176+
public string? getThemeForUser(int userId) {
177+
var path = GetUserSettingsPath(userId);
178+
179+
try {
180+
if (!File.Exists(path)) return null;
181+
182+
var json = File.ReadAllText(path);
183+
using var doc = JsonDocument.Parse(json);
184+
185+
if (doc.RootElement.TryGetProperty("Theme", out var themeElement)) {
186+
return themeElement.GetString();
187+
}
188+
} catch {/**/}
189+
return null;
190+
}
187191
}

Styles/AuthenticationStyles.axaml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,6 @@
44
<Border Padding="20">
55
<!-- Add Controls for Previewer Here -->
66

7-
<Border Classes="InnerRightBorder">
8-
<Grid RowDefinitions="Auto, *">
9-
<TextBlock Classes="SignInText" Grid.Row="0" Text="Sign In"></TextBlock>
10-
<StackPanel Grid.Row="1" Orientation="Vertical" Spacing="20" Margin="0 60 0 0">
11-
<TextBox Name="UsernameTextBox" Classes="InfoTextBox" PlaceholderText="Username"></TextBox>
12-
<Panel>
13-
<TextBox Name="PasswordTextBox" Classes="InfoTextBox" PasswordChar="" PlaceholderText="Password"></TextBox>
14-
<TextBlock Classes="PassVisibleIcon" Text="&#xE220;"/>
15-
</Panel>
16-
<Button Name="SignInButton" Classes="SignInButton" Content="Sign In"></Button>
17-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
18-
<TextBlock Classes="DontHaveAccountText" Text="Don't have an account?"></TextBlock>
19-
<Button Classes="ChangeAuthButton">
20-
<TextBlock Text="Create Account"></TextBlock>
21-
</Button>
22-
</StackPanel>
23-
</StackPanel>
24-
</Grid>
25-
</Border>
26-
277
</Border>
288
</Design.PreviewWith>
299

@@ -319,4 +299,22 @@
319299
<Setter Property="Cursor" Value="Hand"></Setter>
320300
</Style>
321301

302+
<Style Selector="CheckBox.Custom">
303+
<Setter Property="FontFamily" Value="{DynamicResource Nunito-SemiBold}"></Setter>
304+
</Style>
305+
306+
<Style Selector="CheckBox.Custom /template/ Border#NormalRectangle">
307+
<Setter Property="Background" Value="{DynamicResource ElementGeneralBackground}"/>
308+
<Setter Property="CornerRadius" Value="100"/>
309+
</Style>
310+
311+
<Style Selector="CheckBox.Custom:checked /template/ Border#NormalRectangle">
312+
<Setter Property="Background" Value="{DynamicResource PrimaryAccentColor}"/>
313+
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryAccentColor}"/>
314+
</Style>
315+
316+
<Style Selector="CheckBox.Custom:pointerover /template/ Border#NormalRectangle">
317+
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryAccentColor}"/>
318+
</Style>
319+
322320
</Styles>

Styles/WelcomeStyles.axaml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<Style Selector="Border.MainBorder">
2626
<Setter Property="Background">
2727
<LinearGradientBrush StartPoint="0, 0" EndPoint="0%, 100%">
28-
<GradientStop Offset="0" Color="{DynamicResource WelcomePageBackgroundLighter}"/>
29-
<GradientStop Offset="1" Color="{DynamicResource WelcomePageBackgroundDarker}"/>
28+
<GradientStop Offset="0" Color="#404040"/>
29+
<GradientStop Offset="1" Color="#242424"/>
3030
</LinearGradientBrush>
3131
</Setter>
3232
</Style>
@@ -37,27 +37,53 @@
3737
<Setter Property="FontSize" Value="20"></Setter>
3838
<Setter Property="Margin" Value="0 55 0 0"></Setter>
3939
<Setter Property="Opacity" Value="0.85"></Setter>
40+
<Setter Property="Foreground" Value="GhostWhite"></Setter>
4041
</Style>
4142

4243
<Style Selector="TextBlock.AppName">
4344
<Setter Property="FontFamily" Value="{DynamicResource Nunito-ExtraBold}"></Setter>
4445
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
4546
<Setter Property="FontSize" Value="45"></Setter>
4647
<Setter Property="Opacity" Value="0.9"></Setter>
48+
<Setter Property="Foreground" Value="GhostWhite"></Setter>
4749
</Style>
4850

4951
<Style Selector="Border.UserCard">
5052
<Setter Property="Width" Value="350"></Setter>
5153
<Setter Property="Height" Value="100"></Setter>
5254
<Setter Property="CornerRadius" Value="20"></Setter>
53-
<Setter Property="Background" Value="{DynamicResource WelcomeUserCardBackground}"></Setter>
55+
<Setter Property="Background" Value="#2A2A2A"></Setter>
5456
<Setter Property="BorderThickness" Value="0 0 0 6.5"></Setter>
5557
<Setter Property="ClipToBounds" Value="True"></Setter>
56-
<Setter Property="BoxShadow" Value="0 4 10 5 #75000000"></Setter>
57-
<Setter Property="Margin" Value="20"></Setter>
58+
<Setter Property="BoxShadow" Value="0 4 10 5 #FF0000"></Setter>
59+
<Setter Property="Margin" Value="0"></Setter>
5860
<Setter Property="Cursor" Value="Hand"></Setter>
5961
</Style>
6062

63+
<Style Selector="Border.UserCardShadow">
64+
<Setter Property="Width" Value="350"></Setter>
65+
<Setter Property="Height" Value="100"></Setter>
66+
<Setter Property="CornerRadius" Value="20"></Setter>
67+
<Setter Property="Padding" Value="0"></Setter>
68+
<Setter Property="BoxShadow" Value="0 5 10 0 #80000000"></Setter>
69+
<Setter Property="Margin" Value="20"></Setter>
70+
<Setter Property="Transitions">
71+
<Transitions>
72+
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.1" Easing="CubicEaseOut"/>
73+
<BoxShadowsTransition Property="BoxShadow" Duration="0:0:0.1" Easing="CubicEaseOut"/>
74+
</Transitions>
75+
</Setter>
76+
</Style>
77+
78+
<Style Selector="Border.UserCardShadow:pointerover">
79+
<Setter Property="RenderTransform" Value="translateY(-6px) scale(1.02)"></Setter>
80+
<Setter Property="BoxShadow" Value="0 5 15 0 #80505050"></Setter>
81+
</Style>
82+
83+
<Style Selector="Border.UserCardShadow.Pressed">
84+
<Setter Property="RenderTransform" Value="translateY(-2px) scale(0.97)"/>
85+
</Style>
86+
6187
<Style Selector="Border.ImageBorder">
6288
<Setter Property="Height" Value="70"></Setter>
6389
<Setter Property="Width" Value="70"></Setter>
@@ -74,11 +100,13 @@
74100
<Setter Property="FontFamily" Value="{DynamicResource Nunito-SemiBold}"></Setter>
75101
<Setter Property="FontSize" Value="20"></Setter>
76102
<Setter Property="Margin" Value="0 17 0 7.5"></Setter>
103+
<Setter Property="Foreground" Value="GhostWhite"></Setter>
77104
</Style>
78105

79106
<Style Selector="TextBlock.FullnameText">
80107
<Setter Property="FontFamily" Value="{DynamicResource Nunito-Regular}"></Setter>
81108
<Setter Property="FontSize" Value="15"></Setter>
109+
<Setter Property="Foreground" Value="GhostWhite"></Setter>
82110
</Style>
83111

84112
<Style Selector="Border.Ellipse">
@@ -93,29 +121,34 @@
93121
<Setter Property="Background" Value="Transparent"></Setter>
94122
<Setter Property="Cursor" Value="Hand"></Setter>
95123
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
96-
<Setter Property="Margin" Value="0 0 0 100"></Setter>
124+
<Setter Property="Margin" Value="0 20 0 60"></Setter>
97125
</Style>
98126

99127
<Style Selector="Button.UseAnotherAccountButton:pointerover /template/ ContentPresenter">
100128
<Setter Property="Background" Value="Transparent"></Setter>
101129
</Style>
102130

131+
<Style Selector="Button.UseAnotherAccountButton TextBlock">
132+
<Setter Property="Foreground" Value="GhostWhite"></Setter>
133+
</Style>
134+
103135
<Style Selector="Button.UseAnotherAccountButton:pointerover TextBlock">
104136
<Setter Property="TextDecorations" Value="Underline"></Setter>
137+
<Setter Property="Foreground" Value="White"></Setter>
105138
</Style>
106139

107140
<Style Selector="Border.SideLines">
108141
<Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
109142
<Setter Property="Height" Value="1"></Setter>
110-
<Setter Property="Background" Value="{DynamicResource NavButtonsHoverBackground}"></Setter>
143+
<Setter Property="Background" Value="GhostWhite"></Setter>
111144
<Setter Property="CornerRadius" Value="100"></Setter>
112145
<Setter Property="VerticalAlignment" Value="Center"></Setter>
113146
</Style>
114147

115148
<Style Selector="TextBlock.OrText">
116149
<Setter Property="FontFamily" Value="{DynamicResource Nunito-Regular}"></Setter>
117-
<Setter Property="Foreground" Value="{DynamicResource NavButtonsForeground}"></Setter>
118150
<Setter Property="VerticalAlignment" Value="Center"></Setter>
119-
<Setter Property="FontSize" Value="12.5"></Setter>
151+
<Setter Property="FontSize" Value="16"></Setter>
152+
<Setter Property="Foreground" Value="GhostWhite"></Setter>
120153
</Style>
121154
</Styles>

ViewModels/WelcomeViewModel.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,27 @@ private void SelectUser(User user) {
3737
}
3838
};
3939

40+
// Apply selected user's accent color
4041
var accent = AccentColorsBase.AccentColors.FirstOrDefault(c => c.Name == user.AccentColorName)
4142
?? AccentColorsBase.AccentColors.First();
4243
AppSettingsService.Instance!.ApplyAccentColor(accent);
4344

45+
// Apply selected user's theme
46+
var theme = AppSettingsService.Instance.getThemeForUser(user.Id);
47+
AppSettingsService.Instance.ApplyTheme(theme!);
48+
4449
NavigationService.Instance.NavigateTo(AuthVm);
4550
}
4651

4752
[RelayCommand]
4853
private void SignInWithDifferentAccount() {
49-
54+
// Apply default accent color
5055
var accent = AccentColorsBase.AccentColors.First();
5156
AppSettingsService.Instance!.ApplyAccentColor(accent);
5257

58+
// Apply system theme
59+
AppSettingsService.Instance.ApplyTheme("System");
60+
5361
NavigationService.Instance.NavigateTo(new AuthenticationViewModel("Slate Violet"));
5462
}
5563
}

Views/SignInView.axaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
<TextBlock Tapped="ChangePasswordVisibility_Click" Classes="PassVisibleIcon" Text="&#xE220;" IsVisible="{Binding PasswordField.PasswordVisible, Converter={x:Static BoolConverters.Not}}"/>
1818
<TextBlock Tapped="ChangePasswordVisibility_Click" Classes="PassVisibleIcon" Text="&#xE224;" IsVisible="{Binding PasswordField.PasswordVisible}"/>
1919
</Panel>
20-
<CheckBox Classes="RememberMeCheckBox" Content="Remember Me" IsChecked="{Binding RememberMe}"/>
20+
<CheckBox Classes="Custom" Content="Remember Me" IsChecked="{Binding RememberMe}"
21+
HorizontalAlignment="Center"
22+
Margin="-160 0 0 0"/>
2123
<Button Name="SignInButton" Classes="SignInButton" Content="Sign In" Command="{Binding SignInCommand}"></Button>
2224
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
2325
<TextBlock Classes="DontHaveAccountText" Text="Don't have an account?"></TextBlock>

0 commit comments

Comments
 (0)