Restore Point

This commit is contained in:
2026-03-26 20:42:15 +03:00
parent 0c52789cf6
commit 5a6d96ca97
6 changed files with 19 additions and 9 deletions

View File

@@ -306,18 +306,21 @@
<Setter Property="Background" Value="{DynamicResource BadgeBgGreen}" /> <Setter Property="Background" Value="{DynamicResource BadgeBgGreen}" />
<Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" /> <Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" />
<Setter Property="Padding" Value="{DynamicResource BadgePadding}" /> <Setter Property="Padding" Value="{DynamicResource BadgePadding}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource AccentGreen}"/>
</Style> </Style>
<Style Selector="Border.badge-red"> <Style Selector="Border.badge-red">
<Setter Property="Background" Value="{DynamicResource BadgeBgRed}" /> <Setter Property="Background" Value="{DynamicResource BadgeBgRed}" />
<Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" /> <Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" />
<Setter Property="Padding" Value="{DynamicResource BadgePadding}" /> <Setter Property="Padding" Value="{DynamicResource BadgePadding}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource AccentRed}"/>
</Style> </Style>
<Style Selector="Border.badge-yellow"> <Style Selector="Border.badge-yellow">
<Setter Property="Background" Value="{DynamicResource BadgeBgYellow}" /> <Setter Property="Background" Value="{DynamicResource BadgeBgYellow}" />
<Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" /> <Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" />
<Setter Property="Padding" Value="{DynamicResource BadgePadding}" /> <Setter Property="Padding" Value="{DynamicResource BadgePadding}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource AccentYellow}"/>
</Style> </Style>
<Style Selector="Border.badge-blue"> <Style Selector="Border.badge-blue">

View File

@@ -17,7 +17,7 @@ public partial class AccountsViewModel : ViewModelBase
public required List<Transaction> Transactions = new(); public required List<Transaction> Transactions = new();
[ObservableProperty] private ObservableCollection<Account> _visibleAccounts = new(); [ObservableProperty] private ObservableCollection<Account> _visibleAccounts = new();
[ObservableProperty] private decimal _totalBalance = 0; [ObservableProperty] private decimal _totalBalance = 0;
[ObservableProperty] private Account _selectedAccount; [ObservableProperty] private Account? _selectedAccount;
public AccountsViewModel() public AccountsViewModel()
{ {
@@ -28,7 +28,7 @@ public partial class AccountsViewModel : ViewModelBase
{ {
FetchAndProcessAccountInfo(); FetchAndProcessAccountInfo();
GroupAccounts(); GroupAccounts();
SelectedAccount = VisibleAccounts.First(x => !x.GroupHeader); SelectedAccount = VisibleAccounts.FirstOrDefault(x => !x.GroupHeader);
} }
private void FetchAndProcessAccountInfo() private void FetchAndProcessAccountInfo()

View File

@@ -67,10 +67,18 @@ public partial class BudgetViewModel : ViewModelBase
} }
public async Task Initialize() public async Task Initialize()
{
try
{ {
await ProcessBudgets(); await ProcessBudgets();
ProcessChartData(); ProcessChartData();
} }
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
private void ProcessChartData() private void ProcessChartData()
{ {

View File

@@ -95,8 +95,8 @@ public partial class DashboardViewModel : ViewModelBase
.Sum(x => x.Amount); .Sum(x => x.Amount);
try try
{ {
_monthlyIncomeChange = Math.Round((MonthlyIncome / lastMonthIncome) - 1, 2); _monthlyIncomeChange = Math.Round((MonthlyIncome / ((lastMonthIncome == 0) ? 1 : lastMonthIncome)) - 1, 2);
_monthlyExpensesChange = Math.Round((MonthlyExpenses / lastMonthExpenses) - 1, 2); _monthlyExpensesChange = Math.Round((MonthlyExpenses / ((lastMonthExpenses == 0) ? 1 : lastMonthExpenses)) - 1, 2);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -225,8 +225,8 @@
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="6"> <StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="6">
<Border Classes.badge-green="{Binding IsOnTrack}" <Border Classes.badge-green="{Binding IsOnTrack}"
Classes.badge-warning="{Binding IsWarning}" Classes.badge-yellow="{Binding IsWarning}"
Classes.badge-over="{Binding IsOverBudget}" Classes.badge-red="{Binding IsOverBudget}"
CornerRadius="20" CornerRadius="20"
Padding="6,2"> Padding="6,2">
<StackPanel Orientation="Horizontal" Spacing="4"> <StackPanel Orientation="Horizontal" Spacing="4">

View File

@@ -7,7 +7,6 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
MinWidth="1000" MinHeight="600" MinWidth="1000" MinHeight="600"
x:Class="Clario.Views.MainWindow" x:Class="Clario.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="Clario" Title="Clario"
x:CompileBindings="False"> x:CompileBindings="False">
<ContentControl Content="{Binding}" /> <ContentControl Content="{Binding}" />