diff --git a/Clario.Android/Clario.Android.csproj b/Clario.Android/Clario.Android.csproj
index c4ed782..bd7e303 100644
--- a/Clario.Android/Clario.Android.csproj
+++ b/Clario.Android/Clario.Android.csproj
@@ -13,16 +13,13 @@
Clario.Android
-
-
- Resources\drawable\Icon.png
-
-
-
+
+
+
@@ -30,4 +27,9 @@
+
+
+
+
+
diff --git a/Clario.Android/Icon.png b/Clario.Android/Icon.png
deleted file mode 100644
index e69de29..0000000
diff --git a/Clario.Android/Resources/drawable-night-v31/avalonia_anim.xml b/Clario.Android/Resources/drawable-night-v31/avalonia_anim.xml
deleted file mode 100644
index dde4b5a..0000000
--- a/Clario.Android/Resources/drawable-night-v31/avalonia_anim.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Clario.Android/Resources/drawable-v31/avalonia_anim.xml b/Clario.Android/Resources/drawable-v31/avalonia_anim.xml
deleted file mode 100644
index 94f27d9..0000000
--- a/Clario.Android/Resources/drawable-v31/avalonia_anim.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Clario.Android/Resources/drawable/Icon.png b/Clario.Android/Resources/drawable/Icon.png
new file mode 100644
index 0000000..609b617
Binary files /dev/null and b/Clario.Android/Resources/drawable/Icon.png differ
diff --git a/Clario.Android/Resources/drawable/splash_screen.xml b/Clario.Android/Resources/drawable/splash_screen.xml
index 2e920b4..3943420 100644
--- a/Clario.Android/Resources/drawable/splash_screen.xml
+++ b/Clario.Android/Resources/drawable/splash_screen.xml
@@ -5,7 +5,7 @@
-
diff --git a/Clario.Android/Resources/mipmap-anydpi-v26/ic_launcher.xml b/Clario.Android/Resources/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..345888d
--- /dev/null
+++ b/Clario.Android/Resources/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Clario.Android/Resources/mipmap-hdpi/ic_launcher.png b/Clario.Android/Resources/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a471a68
Binary files /dev/null and b/Clario.Android/Resources/mipmap-hdpi/ic_launcher.png differ
diff --git a/Clario.Android/Resources/mipmap-hdpi/ic_launcher_background.png b/Clario.Android/Resources/mipmap-hdpi/ic_launcher_background.png
new file mode 100644
index 0000000..d814e91
Binary files /dev/null and b/Clario.Android/Resources/mipmap-hdpi/ic_launcher_background.png differ
diff --git a/Clario.Android/Resources/mipmap-hdpi/ic_launcher_foreground.png b/Clario.Android/Resources/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..540359a
Binary files /dev/null and b/Clario.Android/Resources/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/Clario.Android/Resources/mipmap-hdpi/ic_launcher_monochrome.png b/Clario.Android/Resources/mipmap-hdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..540359a
Binary files /dev/null and b/Clario.Android/Resources/mipmap-hdpi/ic_launcher_monochrome.png differ
diff --git a/Clario.Android/Resources/mipmap-mdpi/ic_launcher.png b/Clario.Android/Resources/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..9fbfaff
Binary files /dev/null and b/Clario.Android/Resources/mipmap-mdpi/ic_launcher.png differ
diff --git a/Clario.Android/Resources/mipmap-mdpi/ic_launcher_background.png b/Clario.Android/Resources/mipmap-mdpi/ic_launcher_background.png
new file mode 100644
index 0000000..29ad737
Binary files /dev/null and b/Clario.Android/Resources/mipmap-mdpi/ic_launcher_background.png differ
diff --git a/Clario.Android/Resources/mipmap-mdpi/ic_launcher_foreground.png b/Clario.Android/Resources/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..ac8b67f
Binary files /dev/null and b/Clario.Android/Resources/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/Clario.Android/Resources/mipmap-mdpi/ic_launcher_monochrome.png b/Clario.Android/Resources/mipmap-mdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..ac8b67f
Binary files /dev/null and b/Clario.Android/Resources/mipmap-mdpi/ic_launcher_monochrome.png differ
diff --git a/Clario.Android/Resources/mipmap-xhdpi/ic_launcher.png b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..b73651f
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher.png differ
diff --git a/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_background.png b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_background.png
new file mode 100644
index 0000000..280bfe0
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_background.png differ
diff --git a/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_foreground.png b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..94a8d21
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_monochrome.png b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..94a8d21
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xhdpi/ic_launcher_monochrome.png differ
diff --git a/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher.png b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..f47d9d8
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_background.png b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_background.png
new file mode 100644
index 0000000..b76da7e
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_background.png differ
diff --git a/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_foreground.png b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..241af26
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_monochrome.png b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..241af26
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxhdpi/ic_launcher_monochrome.png differ
diff --git a/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher.png b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..bf9bbc1
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_background.png b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_background.png
new file mode 100644
index 0000000..b90fa91
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_background.png differ
diff --git a/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..1b432ff
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_monochrome.png b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000..1b432ff
Binary files /dev/null and b/Clario.Android/Resources/mipmap-xxxhdpi/ic_launcher_monochrome.png differ
diff --git a/Clario.Android/Resources/values-v31/styles.xml b/Clario.Android/Resources/values-v31/styles.xml
index d5ecec4..9f70053 100644
--- a/Clario.Android/Resources/values-v31/styles.xml
+++ b/Clario.Android/Resources/values-v31/styles.xml
@@ -9,7 +9,6 @@
- @null
- true
- @color/splash_background
- - @drawable/avalonia_anim
- 1000
- @style/MyTheme.Main
diff --git a/Clario.Android/Resources/values/colors.xml b/Clario.Android/Resources/values/colors.xml
index 59279d5..6e1ec38 100644
--- a/Clario.Android/Resources/values/colors.xml
+++ b/Clario.Android/Resources/values/colors.xml
@@ -1,4 +1,4 @@
- #FFFFFF
+ #0B0D12
diff --git a/Clario.Android/play_store_512.png b/Clario.Android/play_store_512.png
new file mode 100644
index 0000000..d616c0e
Binary files /dev/null and b/Clario.Android/play_store_512.png differ
diff --git a/Clario.Browser/Clario.Browser.csproj b/Clario.Browser/Clario.Browser.csproj
index 29125f6..9a83c58 100644
--- a/Clario.Browser/Clario.Browser.csproj
+++ b/Clario.Browser/Clario.Browser.csproj
@@ -9,7 +9,10 @@
+
+
+
diff --git a/Clario.Desktop/Clario.Desktop.csproj b/Clario.Desktop/Clario.Desktop.csproj
index ae21efd..484e86d 100644
--- a/Clario.Desktop/Clario.Desktop.csproj
+++ b/Clario.Desktop/Clario.Desktop.csproj
@@ -1,8 +1,6 @@
WinExe
-
net8.0
enable
@@ -19,7 +17,10 @@
All
+
+
+
diff --git a/Clario.Desktop/Program.cs b/Clario.Desktop/Program.cs
index ebe8654..d1e1a8f 100644
--- a/Clario.Desktop/Program.cs
+++ b/Clario.Desktop/Program.cs
@@ -1,6 +1,5 @@
using System;
using Avalonia;
-using Clario.Services;
namespace Clario.Desktop;
diff --git a/Clario.iOS/Clario.iOS.csproj b/Clario.iOS/Clario.iOS.csproj
index ab5ee0b..f14564b 100644
--- a/Clario.iOS/Clario.iOS.csproj
+++ b/Clario.iOS/Clario.iOS.csproj
@@ -9,7 +9,10 @@
+
+
+
diff --git a/Clario/App.axaml b/Clario/App.axaml
index fc6cda3..223eabb 100644
--- a/Clario/App.axaml
+++ b/Clario/App.axaml
@@ -2,10 +2,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Clario"
xmlns:converters="clr-namespace:Clario.Converters"
+ xmlns:views="clr-namespace:Clario.Views"
+ xmlns:vm="clr-namespace:Clario.ViewModels"
+ xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia"
x:Class="Clario.App"
- RequestedThemeVariant="Dark">
+ RequestedThemeVariant="Default">
-
@@ -24,9 +26,12 @@
+
+
+
\ No newline at end of file
diff --git a/Clario/App.axaml.cs b/Clario/App.axaml.cs
index bda3905..cfed3a8 100644
--- a/Clario/App.axaml.cs
+++ b/Clario/App.axaml.cs
@@ -2,11 +2,10 @@ using System;
using System.Globalization;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Data.Core;
using Avalonia.Data.Core.Plugins;
using System.Linq;
-using System.Threading;
using Avalonia.Markup.Xaml;
+using Avalonia.Styling;
using Clario.Data;
using Clario.Services;
using Clario.ViewModels;
@@ -16,15 +15,42 @@ namespace Clario;
public partial class App : Application
{
+ public static bool IsMobile { get; private set; }
+
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
+ RequestedThemeVariant = ThemeVariant.Dark;
}
public override async void OnFrameworkInitializationCompleted()
{
base.OnFrameworkInitializationCompleted();
+ if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLoading)
+ {
+ // Avoid duplicate validations from both Avalonia and the CommunityToolkit.
+ // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
+ DisableAvaloniaDataAnnotationValidation();
+
+ desktopLoading.MainWindow = new MainWindow
+ {
+ DataContext = new LoadingViewModel()
+ };
+ desktopLoading.MainWindow.Show();
+ }
+
+ else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatformLoading)
+ {
+ Console.WriteLine("ANDROID PATH HIT");
+ singleViewPlatformLoading.MainView = new MainAppMobile()
+ {
+ DataContext = new LoadingViewModel()
+ };
+ }
+
+ IsMobile = ApplicationLifetime is ISingleViewApplicationLifetime;
+
var culture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = culture;
@@ -36,7 +62,6 @@ public partial class App : Application
}
catch
{
- /* session invalid or expired */
}
var user = SupabaseService.Client.Auth.CurrentUser;
@@ -53,19 +78,13 @@ public partial class App : Application
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
DisableAvaloniaDataAnnotationValidation();
- desktop.MainWindow = new MainWindow
- {
- DataContext = user is not null ? new MainViewModel() : new AuthViewModel()
- };
- desktop.MainWindow.Show();
+ desktop.MainWindow!.DataContext = user is not null ? new MainViewModel() : new AuthViewModel();
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
{
- singleViewPlatform.MainView = new MainView
- {
- DataContext = user is not null ? new MainViewModel() : new AuthViewModel()
- };
+ Console.WriteLine("ANDROID PATH HIT");
+ singleViewPlatform.MainView!.DataContext = user is not null ? new MainViewModel() : new AuthViewModel();
}
}
diff --git a/Clario/Assets/Icons/arrow-left-right.svg b/Clario/Assets/Icons/arrow-left-right.svg
new file mode 100644
index 0000000..d98fbc9
--- /dev/null
+++ b/Clario/Assets/Icons/arrow-left-right.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Clario/Assets/Icons/sliders-horizontal.svg b/Clario/Assets/Icons/sliders-horizontal.svg
new file mode 100644
index 0000000..2dddc42
--- /dev/null
+++ b/Clario/Assets/Icons/sliders-horizontal.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Clario/Assets/Logo.png b/Clario/Assets/Logo.png
new file mode 100644
index 0000000..609b617
Binary files /dev/null and b/Clario/Assets/Logo.png differ
diff --git a/Clario/Clario.csproj b/Clario/Clario.csproj
index 801406c..de6fc5e 100644
--- a/Clario/Clario.csproj
+++ b/Clario/Clario.csproj
@@ -22,7 +22,17 @@
All
+
+
+
+
+
+
+ MobileMainView.axaml
+ Code
+
+
diff --git a/Clario/Clario.parcel b/Clario/Clario.parcel
new file mode 100644
index 0000000..f024ba8
--- /dev/null
+++ b/Clario/Clario.parcel
@@ -0,0 +1,30 @@
+{
+ "GeneralSettings": {
+ "NetProjectPath": "Clario.csproj",
+ "ApplicationName": "Clario",
+ "Version": "1.0.0",
+ "PackageName": {
+ "$type": "msbuild",
+ "property": "AssemblyName"
+ },
+ "AssemblyName": {
+ "$type": "msbuild",
+ "property": "AssemblyName"
+ }
+ },
+ "LinuxSettings": {
+ "CreateBinSymlink": "True"
+ },
+ "Win32Settings": {
+ "IncludeUninstaller": "True"
+ },
+ "MacOsSettings": {
+ "CreateBundle": true,
+ "BundleIdentifier": "com.CompanyName.Clario",
+ "SigningCredentialsType": "AdHoc"
+ },
+ "PublishSettings": {
+ "PublishSingleFile": "True",
+ "ExtraBuildProperties": {}
+ }
+}
\ No newline at end of file
diff --git a/Clario/Converters/AccountFromIdConverter.cs b/Clario/Converters/AccountFromIdConverter.cs
index 172304b..1d3b1a8 100644
--- a/Clario/Converters/AccountFromIdConverter.cs
+++ b/Clario/Converters/AccountFromIdConverter.cs
@@ -11,7 +11,7 @@ public class AccountFromIdConverter : IValueConverter
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not Guid) return null;
- var accounts = DataRepo.General.Accounts;
+ var accounts = DataRepo.General.FetchAccounts().Result;
if (accounts is null) return null;
return accounts.FirstOrDefault(x => x.Id == (Guid)value)?.Name;
}
diff --git a/Clario/Converters/AmountSignConverter.cs b/Clario/Converters/AmountSignConverter.cs
index 89fa418..56f9e1b 100644
--- a/Clario/Converters/AmountSignConverter.cs
+++ b/Clario/Converters/AmountSignConverter.cs
@@ -12,7 +12,11 @@ public class AmountSignConverter : IMultiValueConverter
{
if (values.Any(x => x is null) || values.Count < 2) return 0;
if (values[0] is decimal amount && values[1] is string type)
- return (type.Equals("income", StringComparison.CurrentCultureIgnoreCase) ? amount : -amount);
+ if (parameter is string param && param.Equals("round"))
+ return (type.Equals("income", StringComparison.CurrentCultureIgnoreCase) ? $"${Math.Round(amount)}" : $"-${Math.Round(amount)}");
+ else
+ return (type.Equals("income", StringComparison.CurrentCultureIgnoreCase) ? $"${amount}" : $"-${amount}");
+
return 0;
}
}
\ No newline at end of file
diff --git a/Clario/Converters/BoolToColorConverter.cs b/Clario/Converters/BoolToColorConverter.cs
new file mode 100644
index 0000000..9b2efbb
--- /dev/null
+++ b/Clario/Converters/BoolToColorConverter.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Globalization;
+using Avalonia;
+using Avalonia.Data.Converters;
+using Avalonia.Media;
+
+namespace Clario.Converters;
+
+// BoolToColorConverter.cs
+public class BoolToColorConverter : IValueConverter
+{
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is not bool boolValue || parameter is not string colors)
+ return AvaloniaProperty.UnsetValue;
+
+ var parts = colors.Split('|');
+ if (parts.Length != 2) return AvaloniaProperty.UnsetValue;
+
+ var hex = boolValue ? parts[0] : parts[1];
+
+ if (targetType == typeof(IBrush) || targetType == typeof(SolidColorBrush))
+ return SolidColorBrush.Parse(hex);
+
+ if (targetType == typeof(Color))
+ return Color.Parse(hex);
+
+ return SolidColorBrush.Parse(hex);
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ => throw new NotImplementedException();
+}
\ No newline at end of file
diff --git a/Clario/Converters/BoolToCssConverter.cs b/Clario/Converters/BoolToCssConverter.cs
new file mode 100644
index 0000000..30be2bb
--- /dev/null
+++ b/Clario/Converters/BoolToCssConverter.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Globalization;
+using Avalonia;
+using Avalonia.Data.Converters;
+
+namespace Clario.Converters;
+
+// BoolToCssConverter.cs
+public class BoolToCssConverter : IValueConverter
+{
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is not bool b || parameter is not string colors)
+ return AvaloniaProperty.UnsetValue;
+
+ var parts = colors.Split('|');
+ if (parts.Length != 2) return AvaloniaProperty.UnsetValue;
+
+ var hex = b ? parts[0] : parts[1];
+ return $"path, circle, rect, ellipse, line, polyline, polygon, text, use {{ stroke: {hex}; }}";
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ => throw new NotImplementedException();
+}
\ No newline at end of file
diff --git a/Clario/Converters/DecimalColorConverter.cs b/Clario/Converters/DecimalColorConverter.cs
index 077d702..7e23934 100644
--- a/Clario/Converters/DecimalColorConverter.cs
+++ b/Clario/Converters/DecimalColorConverter.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Avalonia.Data.Converters;
-using Avalonia.Media;
namespace Clario.Converters;
diff --git a/Clario/Converters/DecimalSignConverter.cs b/Clario/Converters/DecimalSignConverter.cs
index 663cfb9..8a5df7e 100644
--- a/Clario/Converters/DecimalSignConverter.cs
+++ b/Clario/Converters/DecimalSignConverter.cs
@@ -8,7 +8,8 @@ public class DecimalSignConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
- if (value is decimal d) return (d < 0 ? $"-${Math.Abs(Math.Round(d))}" : $"+${Math.Abs(Math.Round(d))}");
+ if (value is decimal d)
+ return (d < 0 ? $"-${Math.Abs(Math.Round(d))}" : $"+${Math.Abs(Math.Round(d))}");
return "$0";
}
diff --git a/Clario/Converters/FirstValueConverter.cs b/Clario/Converters/FirstValueConverter.cs
index 375ae6f..8a3d2ec 100644
--- a/Clario/Converters/FirstValueConverter.cs
+++ b/Clario/Converters/FirstValueConverter.cs
@@ -1,6 +1,5 @@
using System;
using System.Globalization;
-using System.Runtime.InteropServices.JavaScript;
using Avalonia.Data.Converters;
namespace Clario.Converters;
diff --git a/Clario/Converters/NetworthSumConverter.cs b/Clario/Converters/NetworthSumConverter.cs
index 8bdac89..447c1ca 100644
--- a/Clario/Converters/NetworthSumConverter.cs
+++ b/Clario/Converters/NetworthSumConverter.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Avalonia.Data.Converters;
-using LiveChartsCore.SkiaSharpView.Avalonia;
namespace Clario.Converters;
diff --git a/Clario/Converters/PercentageConverter.cs b/Clario/Converters/PercentageConverter.cs
index 1c9d68a..5d40a38 100644
--- a/Clario/Converters/PercentageConverter.cs
+++ b/Clario/Converters/PercentageConverter.cs
@@ -14,8 +14,8 @@ public class PercentageConverter : IMultiValueConverter
if (value[0] is decimal part && value[1] is decimal total && part > 0)
{
- var percentage = Math.Round(part / total, 2);
- return percentage.ToString("0%");
+ var percentage = Math.Round(part / total, 3);
+ return percentage.ToString("0.0%");
}
return "0%";
diff --git a/Clario/Converters/SvgPathFromName.cs b/Clario/Converters/SvgPathFromName.cs
index 7b949b7..2f4c510 100644
--- a/Clario/Converters/SvgPathFromName.cs
+++ b/Clario/Converters/SvgPathFromName.cs
@@ -1,8 +1,6 @@
using System;
using System.Globalization;
-using System.Linq;
using Avalonia.Data.Converters;
-using Clario.Data;
namespace Clario.Converters;
diff --git a/Clario/CustomControls/DateRangePicker.axaml b/Clario/CustomControls/DateRangePicker.axaml
index 228fe08..9c715a2 100644
--- a/Clario/CustomControls/DateRangePicker.axaml
+++ b/Clario/CustomControls/DateRangePicker.axaml
@@ -1,50 +1,84 @@
-
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Clario/CustomControls/DateRangePicker.cs b/Clario/CustomControls/DateRangePicker.cs
index 203b63a..052cc60 100644
--- a/Clario/CustomControls/DateRangePicker.cs
+++ b/Clario/CustomControls/DateRangePicker.cs
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
+using Calendar = Avalonia.Controls.Calendar;
namespace Clario.CustomControls;
@@ -19,7 +21,6 @@ public class DateRangePicker : TemplatedControl
set => SetValue(SelectionModeProperty, value);
}
-
public static readonly StyledProperty> SelectedDatesProperty =
AvaloniaProperty.Register>(
nameof(SelectedDates), new List());
@@ -30,6 +31,16 @@ public class DateRangePicker : TemplatedControl
set => SetValue(SelectedDatesProperty, value);
}
+ public static readonly StyledProperty SelectedDateProperty =
+ AvaloniaProperty.Register(
+ nameof(SelectedDate), null);
+
+ public DateTime? SelectedDate
+ {
+ get => GetValue(SelectedDateProperty);
+ set => SetValue(SelectedDateProperty, value);
+ }
+
public static readonly StyledProperty DisplayTextProperty =
AvaloniaProperty.Register(
nameof(DisplayText), "Select Date");
@@ -40,114 +51,180 @@ public class DateRangePicker : TemplatedControl
set => SetValue(DisplayTextProperty, value);
}
- private Button _button;
- private Popup _popup;
- private Calendar _calendar;
+
+ private Button? _button;
+ private Popup? _popup;
+ private Calendar? _calendar;
- protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
- {
- base.OnPropertyChanged(change);
- if (change.Property == SelectedDatesProperty && _calendar != null)
- {
- _calendar.SelectedDates.Clear();
+ private bool _isSyncing = false;
- foreach (var date in SelectedDates)
- {
- _calendar.SelectedDates.Add(date);
- }
-
- if (SelectionMode == CalendarSelectionMode.SingleDate)
- _popup.IsOpen = false;
- }
- }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
+
+
+ if (_button != null) _button.Click -= OnButtonClick;
+ if (_calendar != null) _calendar.SelectedDatesChanged -= OnCalendarDatesChanged;
+
_button = e.NameScope.Find