diff --git a/WebApp/Components/Features/Calendar/Index.razor b/WebApp/Components/Features/Calendar/Index.razor index 1feb986..dcdb05a 100644 --- a/WebApp/Components/Features/Calendar/Index.razor +++ b/WebApp/Components/Features/Calendar/Index.razor @@ -16,6 +16,7 @@ Admin + diff --git a/WebApp/Components/Features/MeetingSchedule/Index.razor b/WebApp/Components/Features/MeetingSchedule/Index.razor index 52d9a03..a80ae52 100644 --- a/WebApp/Components/Features/MeetingSchedule/Index.razor +++ b/WebApp/Components/Features/MeetingSchedule/Index.razor @@ -1,4 +1,4 @@ -@page "/meeting-schedule" +@page "/meeting-schedule" @attribute [Authorize] @using System.Text @using Core.Calculation @@ -10,7 +10,11 @@ @inject ClipboardService ClipboardService @inject LocalStorageService LocalStorage - + + + + + diff --git a/WebApp/Components/Features/Students/EventRanking.razor b/WebApp/Components/Features/Students/EventRanking.razor index c4c0db4..090084a 100644 --- a/WebApp/Components/Features/Students/EventRanking.razor +++ b/WebApp/Components/Features/Students/EventRanking.razor @@ -1,4 +1,4 @@ -@page "/students/event-ranking" +@page "/students/event-ranking" @attribute [Authorize] @using Microsoft.EntityFrameworkCore @using WebApp.Models @@ -9,7 +9,11 @@ + Icon="@AppIcons.EventRank"> + + + + @if (_students == null) { diff --git a/WebApp/Components/Features/Students/Registration.razor b/WebApp/Components/Features/Students/Registration.razor index eeb466b..e1e8fee 100644 --- a/WebApp/Components/Features/Students/Registration.razor +++ b/WebApp/Components/Features/Students/Registration.razor @@ -17,6 +17,7 @@ OnClick="ToggleRegionalFilter"> @(_showRegionalOnly ? "Showing Regional Only" : "Show Regional Only") + diff --git a/WebApp/Components/Features/Teams/Assignment.razor b/WebApp/Components/Features/Teams/Assignment.razor index ed64720..c94b4ed 100644 --- a/WebApp/Components/Features/Teams/Assignment.razor +++ b/WebApp/Components/Features/Teams/Assignment.razor @@ -1,4 +1,4 @@ -@page "/teams/assignment" +@page "/teams/assignment" @attribute [Authorize] @using Core.Calculation @using Core.Validation @@ -18,6 +18,7 @@ Edit Student Event Rankings + diff --git a/WebApp/Components/Pages/NoteEditDialog.razor b/WebApp/Components/Pages/NoteEditDialog.razor index 7f92ec2..83e2294 100644 --- a/WebApp/Components/Pages/NoteEditDialog.razor +++ b/WebApp/Components/Pages/NoteEditDialog.razor @@ -6,7 +6,7 @@ @inject ISnackbar Snackbar @inject IDialogService DialogService - + + MaxLength="200" + ReadOnly="@IsPageNote" /> Content (Markdown) Note?.Title?.StartsWith("@") ?? false; + protected override void OnInitialized() { _note = new Note diff --git a/WebApp/Components/Pages/NoteHistoryDialog.razor b/WebApp/Components/Pages/NoteHistoryDialog.razor index 18cb6ff..754b067 100644 --- a/WebApp/Components/Pages/NoteHistoryDialog.razor +++ b/WebApp/Components/Pages/NoteHistoryDialog.razor @@ -4,7 +4,7 @@ @inject INotesService NotesService @inject IDialogService DialogService - + @if (_isLoading) { diff --git a/WebApp/Components/Pages/NoteVersionViewDialog.razor b/WebApp/Components/Pages/NoteVersionViewDialog.razor index 579cb6f..55f84db 100644 --- a/WebApp/Components/Pages/NoteVersionViewDialog.razor +++ b/WebApp/Components/Pages/NoteVersionViewDialog.razor @@ -2,7 +2,7 @@ @using WebApp.Services @using MudBlazor - + @_history.Title diff --git a/WebApp/Components/Pages/Notes.razor b/WebApp/Components/Pages/Notes.razor index 5430381..d14b56a 100644 --- a/WebApp/Components/Pages/Notes.razor +++ b/WebApp/Components/Pages/Notes.razor @@ -54,7 +54,8 @@ + ExpandedChanged="@((bool expanded) => OnPanelExpandedChanged(noteId, expanded))" + Class="@MarkdownHelper.GetNoteColorClass(noteId)"> @@ -402,7 +403,7 @@ var result = await DialogService.ShowMessageBox( "Delete Note", - (MarkupString)$"Are you sure you want to delete {note.Title}? This cannot be undone.", + (MarkupString)$"Are you sure you want to delete {note.Title}? You can restore it later from the 'Show Removed' view.", yesText: "Yes", noText: "Cancel"); diff --git a/WebApp/Components/Shared/Components/NoteCard.razor b/WebApp/Components/Shared/Components/NoteCard.razor index 2d33156..07cf860 100644 --- a/WebApp/Components/Shared/Components/NoteCard.razor +++ b/WebApp/Components/Shared/Components/NoteCard.razor @@ -4,7 +4,7 @@ @* Reuse dialog options pattern - could be extracted if used in more places *@ - +
diff --git a/WebApp/Components/Shared/Components/NoteViewDialog.razor b/WebApp/Components/Shared/Components/NoteViewDialog.razor index 81d6623..43b5aa8 100644 --- a/WebApp/Components/Shared/Components/NoteViewDialog.razor +++ b/WebApp/Components/Shared/Components/NoteViewDialog.razor @@ -4,7 +4,7 @@ @inject NavigationManager NavigationManager @implements IAsyncDisposable - + @if (_isLoading) { diff --git a/WebApp/Components/Shared/Components/PageNoteButton.razor b/WebApp/Components/Shared/Components/PageNoteButton.razor index 00bde98..37dffb7 100644 --- a/WebApp/Components/Shared/Components/PageNoteButton.razor +++ b/WebApp/Components/Shared/Components/PageNoteButton.razor @@ -8,7 +8,8 @@ Variant="@Variant" Size="@Size" Color="@ButtonColor" - Tooltip="@TooltipText"> + Tooltip="@TooltipText" + Class="@MarkdownHelper.GetNoteColorClass(_noteId)"> @if (!string.IsNullOrEmpty(ButtonText)) { @ButtonText @@ -37,6 +38,7 @@ private string IconValue => Icon ?? Icons.Material.Filled.Note; private string TooltipText => Tooltip ?? $"Page notes for {PageIdentifier}"; private bool _hasContent = false; + private int _noteId = 0; private Color ButtonColor => _hasContent ? Color.Success : (Variant == Variant.Filled ? Color.Primary : Color.Default); private CancellationTokenSource? _cancellationTokenSource; private bool _isDisposed = false; @@ -59,6 +61,7 @@ { var note = await NotesService.GetPageNoteAsync(PageIdentifier); _hasContent = note != null && !string.IsNullOrWhiteSpace(note.Content); + _noteId = note?.Id ?? 0; if (!_isDisposed) { @@ -100,8 +103,9 @@ var dialog = await DialogService.ShowAsync($"Page Notes: {PageIdentifier}", parameters, options); var result = await dialog.Result; - // Refresh content indicator after dialog closes - if (!result.Canceled && !_isDisposed) + // Always refresh content indicator after dialog closes + // (content may have been saved even if dialog was closed with Cancel) + if (!_isDisposed) { await CheckNoteContent(); } diff --git a/WebApp/Components/Shared/Components/PageNoteDialog.razor b/WebApp/Components/Shared/Components/PageNoteDialog.razor index 594857c..81c7916 100644 --- a/WebApp/Components/Shared/Components/PageNoteDialog.razor +++ b/WebApp/Components/Shared/Components/PageNoteDialog.razor @@ -3,7 +3,7 @@ @inject ISnackbar Snackbar @implements IAsyncDisposable - + @if (_isLoading) { @@ -167,15 +167,21 @@ } else { - await NotesService.CreateNoteAsync(_note); + // CreateNoteAsync returns the note with the ID populated + var createdNote = await NotesService.CreateNoteAsync(_note); + // Update _note with the returned note to get the ID immediately + _note = createdNote; + _isEdit = true; // Mark as existing note now Snackbar.Add("Page note created successfully", Severity.Success); } if (!_isDisposed) { - // After saving, switch back to view mode and reload the note + // After saving, switch back to view mode and reload the note to ensure we have latest data _isEditMode = false; await LoadPageNote(); + // Ensure dialog re-renders with updated color class after note ID is set + StateHasChanged(); } } catch (TaskCanceledException) diff --git a/WebApp/Services/MarkdownHelper.cs b/WebApp/Services/MarkdownHelper.cs index 2aa8555..1ac2022 100644 --- a/WebApp/Services/MarkdownHelper.cs +++ b/WebApp/Services/MarkdownHelper.cs @@ -92,4 +92,16 @@ public static class MarkdownHelper return plainText; } + + /// + /// Gets the CSS class name for a note's color based on its ID. + /// Uses modulo 3 to cycle through 3 pastel color classes. + /// + /// The note ID. + /// CSS class name (e.g., "note-color-0", "note-color-1", "note-color-2"), or empty string if noteId is 0. + public static string GetNoteColorClass(int noteId) + { + if (noteId == 0) return string.Empty; + return $"note-color-{noteId % 3}"; + } } diff --git a/WebApp/wwwroot/app.css b/WebApp/wwwroot/app.css index 2ac96bc3..d6bb642 100644 --- a/WebApp/wwwroot/app.css +++ b/WebApp/wwwroot/app.css @@ -229,4 +229,17 @@ .markdown-content img { max-width: 100%; height: auto; +} + +/* Note color classes - pastel background colors */ +.note-color-0 { + background-color: #e3f2fd; +} + +.note-color-1 { + background-color: #fff9e6; +} + +.note-color-2 { + background-color: #f3e5f5; } \ No newline at end of file