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="CornerRadius" Value="{DynamicResource RadiusPill}" />
<Setter Property="Padding" Value="{DynamicResource BadgePadding}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource AccentGreen}"/>
</Style>
<Style Selector="Border.badge-red">
<Setter Property="Background" Value="{DynamicResource BadgeBgRed}" />
<Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" />
<Setter Property="Padding" Value="{DynamicResource BadgePadding}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource AccentRed}"/>
</Style>
<Style Selector="Border.badge-yellow">
<Setter Property="Background" Value="{DynamicResource BadgeBgYellow}" />
<Setter Property="CornerRadius" Value="{DynamicResource RadiusPill}" />
<Setter Property="Padding" Value="{DynamicResource BadgePadding}" />
<Setter Property="TextElement.Foreground" Value="{DynamicResource AccentYellow}"/>
</Style>
<Style Selector="Border.badge-blue">

View File

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

View File

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

View File

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

View File

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

View File

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