From e8b105f1554ffba999d6e6a4b4d66ed89bfb19ac Mon Sep 17 00:00:00 2001 From: Said Amir Kattan Date: Fri, 7 Aug 2026 02:42:24 +0300 Subject: [PATCH] Add Taske UI source files --- Components/App.razor | 11 +++ Components/Layout/MainLayout.razor | 143 +++++++++++++++++++++++++++++ Components/Pages/Index.razor | 9 ++ Components/RedirectToTasks.razor | 8 ++ Program.cs | 37 ++++++++ Properties/launchSettings.json | 14 +++ UI.csproj | 29 ++++++ _Imports.razor | 17 ++++ tailwind.config.js | 11 +++ wwwroot/appsettings.json | 5 + wwwroot/css/app.css | 105 +++++++++++++++++++++ wwwroot/index.html | 21 +++++ 12 files changed, 410 insertions(+) create mode 100644 Components/App.razor create mode 100644 Components/Layout/MainLayout.razor create mode 100644 Components/Pages/Index.razor create mode 100644 Components/RedirectToTasks.razor create mode 100644 Program.cs create mode 100644 Properties/launchSettings.json create mode 100644 UI.csproj create mode 100644 _Imports.razor create mode 100644 tailwind.config.js create mode 100644 wwwroot/appsettings.json create mode 100644 wwwroot/css/app.css create mode 100644 wwwroot/index.html diff --git a/Components/App.razor b/Components/App.razor new file mode 100644 index 0000000..cb3b797 --- /dev/null +++ b/Components/App.razor @@ -0,0 +1,11 @@ + + + + + + + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/Components/Layout/MainLayout.razor b/Components/Layout/MainLayout.razor new file mode 100644 index 0000000..089f771 --- /dev/null +++ b/Components/Layout/MainLayout.razor @@ -0,0 +1,143 @@ +@inherits LayoutComponentBase +@using Tasks.Module.Services +@using Tasks.Module.Models +@using Tasks.Module.Components.Dialogs +@inject IViewService ViewService +@inject IDialogService DialogService + + + + + + + + + Taske + + + + + @* My Tasks Section *@ +
+ + + My Tasks + +
+ +
+ + @* Categories Section *@ +
+
+ + CATEGORIES + +
+
+ +
+ + @* Tags Section *@ +
+
+ + TAGS + +
+
+ +
+ + @* Views Section *@ +
+
+ VIEWS + +
+ @if (_loadingViews) + { + + } + else + { + @foreach (var view in _views) + { + + + @view.Name + + } + } +
+ +
+ + @* Files Section *@ +
+ +
+
+
+ + + @Body + + +
+ + + +@code { + private bool _drawerOpen = true; + private List _views = new(); + private bool _loadingViews = true; + + protected override async Task OnInitializedAsync() + { + await LoadViews(); + } + + private async Task LoadViews() + { + _loadingViews = true; + try + { + _views = await ViewService.GetAllViewsAsync(); + } + catch (Exception ex) + { + Console.WriteLine($"Error loading views: {ex.Message}"); + } + finally + { + _loadingViews = false; + } + } + + private async Task CreateView() + { + var parameters = new DialogParameters(); + var options = new DialogOptions { CloseOnEscapeKey = true, MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = await DialogService.ShowAsync("Create View", parameters, options); + var result = await dialog.Result; + + if (result is { Canceled: false } && result.Data is CreateTaskViewDto createDto) + { + try + { + var newView = await ViewService.CreateViewAsync(createDto); + _views.Add(newView); + StateHasChanged(); + } + catch (Exception ex) + { + Console.WriteLine($"Error creating view: {ex.Message}"); + } + } + } +} \ No newline at end of file diff --git a/Components/Pages/Index.razor b/Components/Pages/Index.razor new file mode 100644 index 0000000..721ca49 --- /dev/null +++ b/Components/Pages/Index.razor @@ -0,0 +1,9 @@ +@page "/" +@inject NavigationManager Navigation + +@code { + protected override void OnInitialized() + { + Navigation.NavigateTo("/tasks"); + } +} \ No newline at end of file diff --git a/Components/RedirectToTasks.razor b/Components/RedirectToTasks.razor new file mode 100644 index 0000000..4e432fe --- /dev/null +++ b/Components/RedirectToTasks.razor @@ -0,0 +1,8 @@ +@inject NavigationManager Navigation + +@code { + protected override void OnInitialized() + { + Navigation.NavigateTo("/tasks", forceLoad: true); + } +} \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..cb0e5b4 --- /dev/null +++ b/Program.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using MudBlazor; +using MudBlazor.Services; +using Tasks.Module.Services; +using UI; +using UI.Components; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +builder.RootComponents.Add("#app"); +builder.RootComponents.Add("head::after"); + +// Configure HTTP client for Tasks API +var tasksApiUrl = builder.Configuration["ApiSettings:TasksUrl"] ?? "http://localhost:5000"; +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(tasksApiUrl) }); + +// Add MudBlazor services +builder.Services.AddMudServices(config => +{ + config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight; + config.SnackbarConfiguration.PreventDuplicates = false; + config.SnackbarConfiguration.ShowCloseIcon = true; + config.SnackbarConfiguration.VisibleStateDuration = 3000; + config.SnackbarConfiguration.HideTransitionDuration = 100; + config.SnackbarConfiguration.ShowTransitionDuration = 100; + config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; +}); + +// Register services +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); + +await builder.Build().RunAsync(); \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..fe87315 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "UI": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy", + "applicationUrl": "http://localhost:5173", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/UI.csproj b/UI.csproj new file mode 100644 index 0000000..589587a --- /dev/null +++ b/UI.csproj @@ -0,0 +1,29 @@ + + + + net10.0 + enable + enable + true + + + + false + false + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_Imports.razor b/_Imports.razor new file mode 100644 index 0000000..3efa281 --- /dev/null +++ b/_Imports.razor @@ -0,0 +1,17 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using MudBlazor +@using UI +@using UI.Components +@using UI.Components.Layout +@using UI.Components.Pages +@using Tasks.Module +@using Tasks.Module.Components +@using Tasks.Module.Components.Sidebar +@using Tasks.Module.Services +@using Tasks.Module.Models \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..8b0b954 --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,11 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + "./**/*.{razor,html,cs}", + "./_content/MudBlazor/**/*.{razor,html,cs}" + ], + theme: { + extend: {}, + }, + plugins: [], +} \ No newline at end of file diff --git a/wwwroot/appsettings.json b/wwwroot/appsettings.json new file mode 100644 index 0000000..50d8cfc --- /dev/null +++ b/wwwroot/appsettings.json @@ -0,0 +1,5 @@ +{ + "ApiSettings": { + "TasksUrl": "http://localhost:5000" + } +} diff --git a/wwwroot/css/app.css b/wwwroot/css/app.css new file mode 100644 index 0000000..53ed2c1 --- /dev/null +++ b/wwwroot/css/app.css @@ -0,0 +1,105 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +html, body { + font-family: 'Roboto', sans-serif; +} + +/* Custom styles */ +.flex { + display: flex; +} + +.flex-col { + flex-direction: column; +} + +.items-center { + align-items: center; +} + +.justify-between { + justify-content: space-between; +} + +.gap-2 { + gap: 0.5rem; +} + +.gap-3 { + gap: 0.75rem; +} + +.mb-3 { + margin-bottom: 0.75rem; +} + +.mb-4 { + margin-bottom: 1rem; +} + +.mt-2 { + margin-top: 0.5rem; +} + +.mt-3 { + margin-top: 0.75rem; +} + +.ml-2 { + margin-left: 0.5rem; +} + +.ml-4 { + margin-left: 1rem; +} + +.ml-8 { + margin-left: 2rem; +} + +.pl-4 { + padding-left: 1rem; +} + +.pa-4 { + padding: 1rem; +} + +.pa-8 { + padding: 2rem; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.text-center { + text-align: center; +} + +.text-gray-500 { + color: #6b7280; +} + +.text-red-500 { + color: #ef4444; +} + +.line-through { + text-decoration: line-through; +} + +.opacity-70 { + opacity: 0.7; +} + +.border-l-2 { + border-left-width: 2px; +} + +.border-gray-300 { + border-color: #d1d5db; +} \ No newline at end of file diff --git a/wwwroot/index.html b/wwwroot/index.html new file mode 100644 index 0000000..1f52b41 --- /dev/null +++ b/wwwroot/index.html @@ -0,0 +1,21 @@ + + + + + + + Taske + + + + + + + +
Loading...
+ + + + + + \ No newline at end of file