From 1aaf4e8a7e62a88b7e8b4312e3040dfab72a864a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Fri, 6 Mar 2026 04:04:14 +0100 Subject: [PATCH] Settings UI --- .../Translations/en_US/resources.json | 2 + .../SettingOptionsPageViewModel.cs | 42 ++ Wino.Mail.WinUI/Views/SettingOptionsPage.xaml | 603 +++++------------- .../Views/SettingOptionsPage.xaml.cs | 2 + 4 files changed, 198 insertions(+), 451 deletions(-) diff --git a/Wino.Core.Domain/Translations/en_US/resources.json b/Wino.Core.Domain/Translations/en_US/resources.json index f0277a2a..f7683c2f 100644 --- a/Wino.Core.Domain/Translations/en_US/resources.json +++ b/Wino.Core.Domain/Translations/en_US/resources.json @@ -748,6 +748,8 @@ "SettingsOptions_MailSection": "Mail", "SettingsOptions_CalendarSection": "Calendar", "SettingsOptions_MoreComingSoon": "More options coming soon", + "SettingsOptions_HeroDescription": "Customize your Wino Mail experience", + "SettingsOptions_AccountsSummary": "{0} account(s) configured", "SettingsPaneLengthReset_Description": "Reset the size of the mail list to original if you have issues with it.", "SettingsPaneLengthReset_Title": "Reset Mail List Size", "SettingsPaypal_Description": "Show much more love ❤️ All donations are appreciated.", diff --git a/Wino.Core.ViewModels/SettingOptionsPageViewModel.cs b/Wino.Core.ViewModels/SettingOptionsPageViewModel.cs index df4b5ce4..f1840720 100644 --- a/Wino.Core.ViewModels/SettingOptionsPageViewModel.cs +++ b/Wino.Core.ViewModels/SettingOptionsPageViewModel.cs @@ -1,14 +1,56 @@ using System; +using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; using Wino.Core.Domain; using Wino.Core.Domain.Enums; +using Wino.Core.Domain.Interfaces; +using Wino.Core.Domain.Models.Navigation; using Wino.Messaging.Client.Navigation; namespace Wino.Core.ViewModels; public partial class SettingOptionsPageViewModel : CoreBaseViewModel { + private readonly INativeAppService _nativeAppService; + private readonly IAccountService _accountService; + + [ObservableProperty] + public partial string VersionText { get; set; } = string.Empty; + + [ObservableProperty] + public partial string AccountSummaryText { get; set; } = string.Empty; + + [ObservableProperty] + public partial int AccountCount { get; set; } + + public SettingOptionsPageViewModel(INativeAppService nativeAppService, IAccountService accountService) + { + _nativeAppService = nativeAppService; + _accountService = accountService; + } + + public override void OnNavigatedTo(NavigationMode mode, object parameters) + { + base.OnNavigatedTo(mode, parameters); + + VersionText = string.Format("{0}{1}", Translator.SettingsAboutVersion, _nativeAppService.GetFullAppVersion()); + _ = LoadAccountSummaryAsync(); + } + + private async Task LoadAccountSummaryAsync() + { + var accounts = await _accountService.GetAccountsAsync(); + int count = accounts?.Count ?? 0; + + await ExecuteUIThread(() => + { + AccountCount = count; + AccountSummaryText = string.Format(Translator.SettingsOptions_AccountsSummary, count); + }); + } + [RelayCommand] private void GoAccountSettings() => Messenger.Send(); diff --git a/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml b/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml index f8a98333..52cd9d26 100644 --- a/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml +++ b/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml @@ -13,16 +13,17 @@ mc:Ignorable="d"> - + - + - + + Width="72" + Height="72" + Background="{ThemeResource AccentFillColorDefaultBrush}" + CornerRadius="16"> + FontSize="32" + Foreground="{ThemeResource TextOnAccentFillColorPrimaryBrush}" + Glyph="" /> + - + Spacing="4"> + + + Text="{x:Bind ViewModel.VersionText, Mode=OneWay}" /> + + + + + + - + - - - - - - + + - - - - - - - + + + + + - - - + + + + + - + + + + + - + + + + + - - - + + - - - - - - + + + + + - - - - - - + + + + + - - - - - - - + + + + + - - - + + + + + - + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml.cs b/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml.cs index 159c0ea3..2ec1c820 100644 --- a/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml.cs +++ b/Wino.Mail.WinUI/Views/SettingOptionsPage.xaml.cs @@ -1,3 +1,4 @@ +using CommunityToolkit.WinUI.Controls; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Wino.Core.Domain.Enums; @@ -17,6 +18,7 @@ public sealed partial class SettingOptionsPage : SettingOptionsPageAbstract WinoPage? page = sender switch { Button button when button.Tag is WinoPage p => p, + SettingsCard card when card.Tag is WinoPage p => p, _ => null };