diff --git a/src/Apps/Corathing.Organizer.WPF/Corathing.Organizer.WPF.csproj b/src/Apps/Corathing.Organizer.WPF/Corathing.Organizer.WPF.csproj index 800e5b6..ab9fb87 100644 --- a/src/Apps/Corathing.Organizer.WPF/Corathing.Organizer.WPF.csproj +++ b/src/Apps/Corathing.Organizer.WPF/Corathing.Organizer.WPF.csproj @@ -40,7 +40,6 @@ - diff --git a/src/Apps/Corathing.Organizer/Corathing.Organizer.csproj b/src/Apps/Corathing.Organizer/Corathing.Organizer.csproj index e5b652b..6d186fd 100644 --- a/src/Apps/Corathing.Organizer/Corathing.Organizer.csproj +++ b/src/Apps/Corathing.Organizer/Corathing.Organizer.csproj @@ -7,8 +7,9 @@ - - + + + diff --git a/src/Apps/Corathing.Organizer/Supabases/SupabaseAuthManager.cs b/src/Apps/Corathing.Organizer/Supabases/SupabaseAuthManager.cs new file mode 100644 index 0000000..7743ef7 --- /dev/null +++ b/src/Apps/Corathing.Organizer/Supabases/SupabaseAuthManager.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Supabase; +using Supabase.Interfaces; + +namespace Corathing.Organizer.Supabases; + +public class SupabaseAuthManager +{ + public Supabase.Client Client { get; private set; } + + public SupabaseAuthManager(IServiceProvider services) + { + + } + + public async Task InitializeAsync() + { + var url = Environment.GetEnvironmentVariable("SUPABASE_URL"); + var key = Environment.GetEnvironmentVariable("SUPABASE_KEY"); + + var options = new Supabase.SupabaseOptions + { + AutoConnectRealtime = true + }; + + var supabase = new Supabase.Client(url, key, options); + await supabase.InitializeAsync(); + } +} diff --git a/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/Models/ToDoJob.cs b/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/Models/ToDoJob.cs index d19de62..5c1bd41 100644 --- a/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/Models/ToDoJob.cs +++ b/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/Models/ToDoJob.cs @@ -11,12 +11,21 @@ namespace Corathing.Widgets.Basics.Widgets.ToDoLists.Models; public partial class Job : ObservableObject { + [ObservableProperty] + private JobType _jobType; } public partial class AddingJob : Job { } +public enum JobType +{ + Normal, + IsCompleted, + Placeholder +} + public partial class ToDoJob : Job { [DefaultValue(false)] diff --git a/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml b/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml index ed11d51..99ac80b 100644 --- a/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml +++ b/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml @@ -165,13 +165,19 @@ BorderBrush="{DynamicResource TextControlForegroundDisabled}" /> + - + + + diff --git a/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml.cs b/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml.cs index 583ebeb..c74053e 100644 --- a/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml.cs +++ b/src/Widgets/Corathing.Widgets.Basics/Widgets/ToDoLists/ToDoListWidget.xaml.cs @@ -26,6 +26,7 @@ using Corathing.Contracts.Services; using Corathing.Widgets.Basics.Widgets.Timers; using Corathing.Widgets.Basics.Widgets.ToDoLists.Models; +using CommunityToolkit.Mvvm.Collections; namespace Corathing.Widgets.Basics.Widgets.ToDoLists; @@ -38,20 +39,19 @@ namespace Corathing.Widgets.Basics.Widgets.ToDoLists; )] public partial class ToDoListViewModel : WidgetContext { - private ObservableCollection _jobs; - public ObservableCollection Jobs + private ObservableGroupedCollection? _groupedJobs; + public ObservableGroupedCollection? GroupedJobs { - get => _jobs; + get => _groupedJobs; set { - - if (EqualityComparer?>.Default.Equals(_jobs, value)) + if (EqualityComparer?>.Default.Equals(_groupedJobs, value)) return; - OnPropertyChanging(nameof(Jobs)); - _jobs = value; - var itemsView = (IEditableCollectionView)CollectionViewSource.GetDefaultView(_jobs); + OnPropertyChanging(nameof(GroupedJobs)); + _groupedJobs = value; + var itemsView = (IEditableCollectionView)CollectionViewSource.GetDefaultView(_groupedJobs); itemsView.NewItemPlaceholderPosition = NewItemPlaceholderPosition.AtEnd; - OnPropertyChanged(nameof(Jobs)); + OnPropertyChanged(nameof(GroupedJobs)); } } @@ -60,19 +60,31 @@ public override void OnCreate(IServiceProvider services, WidgetState state) ILocalizationService localizationService = _services.GetService(); localizationService.Provide("Corathing.Widgets.Basics.ToDoListName", value => WidgetTitle = value); - Jobs = new ObservableCollection(); + GroupedJobs = new ObservableGroupedCollection(); } [RelayCommand] public void AddNewJob() { - Jobs.Add(new ToDoJob()); + GroupedJobs?.AddItem(JobType.Normal, new ToDoJob()); } [RelayCommand] public void RemoveJob(ToDoJob job) { - Jobs.Remove(job); + GroupedJobs?.RemoveItem(job.JobType, job); + } + + [RelayCommand] + public void MarkJob(ToDoJob job) + { + + } + + [RelayCommand] + public void UnmarkJob(ToDoJob job) + { + } }