Refactor ReceiverPage and update AGENTS.md TODOs

Updated AGENTS.md to add a technical debt TODO for modularizing
server pages by splitting large components, reducing duplication,
and centralizing shared logic.

Enhanced ReceiverPage.razor with new state variables and logic
to support a "Reject" popup feature, including state management
for visibility, submission, and validation.

Improved sharing functionality in ReceiverPage.razor by adding
error handling, user feedback, and proper state updates during
asynchronous operations to enhance maintainability and UX.
This commit is contained in:
2026-10-01 10:08:47 +02:00
parent d969dbe843
commit 01c1283622
2 changed files with 30 additions and 0 deletions

View File

@@ -241,6 +241,7 @@ Manual testing workflow:
- Refactor `EnvelopeGenerator.Server/EnvelopeGenerator.Server/Components/Pages/EnvelopeSenderPage.razor` to reduce complexity. - Refactor `EnvelopeGenerator.Server/EnvelopeGenerator.Server/Components/Pages/EnvelopeSenderPage.razor` to reduce complexity.
- Move sender dashboard business/status logic into dedicated services and extension methods (for example effective status resolution, tab classification, receiver signed/rejected detection, and grid-layout filter sanitation). - Move sender dashboard business/status logic into dedicated services and extension methods (for example effective status resolution, tab classification, receiver signed/rejected detection, and grid-layout filter sanitation).
- Keep `EnvelopeSenderPage.razor` focused on UI composition/state orchestration; avoid embedding heavy domain logic directly in the Razor component. - Keep `EnvelopeSenderPage.razor` focused on UI composition/state orchestration; avoid embedding heavy domain logic directly in the Razor component.
- Apply a modular page architecture across Server pages (starting with `EnvelopeGenerator.Server/EnvelopeGenerator.Server/Components/Pages/EnvelopeSenderPage.razor`): split large pages into smaller subcomponents/partial modules, eliminate duplicated code paths, and centralize shared UI/domain logic for maintainability.
## Database ## Database

View File

@@ -404,6 +404,12 @@
string? _shareMessage; string? _shareMessage;
bool _shareMessageIsError = false; bool _shareMessageIsError = false;
// ----- Reject popup state -----
bool _rejectPopupVisible = false;
bool _isRejectSubmitting = false;
string _rejectReason = string.Empty;
string? _rejectValidationMessage;
async Task LogoutAsync() async Task LogoutAsync()
{ {
if (_isLoggingOut || string.IsNullOrWhiteSpace(EnvelopeKey)) if (_isLoggingOut || string.IsNullOrWhiteSpace(EnvelopeKey))
@@ -469,6 +475,29 @@
return; return;
} }
_isSharing = true;
_shareMessage = null;
_shareMessageIsError = false;
await InvokeAsync(StateHasChanged);
try
{
_shareMessage = "Freigabe ist in dieser Ansicht derzeit nicht verfugbar.";
_shareMessageIsError = false;
}
catch (Exception ex)
{
Logger.LogError(ex, "Failed to share envelope {EnvelopeKey}", EnvelopeKey);
_shareMessage = "Freigabe fehlgeschlagen. Bitte versuchen Sie es erneut.";
_shareMessageIsError = true;
}
finally
{
_isSharing = false;
await InvokeAsync(StateHasChanged);
}
}
// ----- Lifecycle ----- // ----- Lifecycle -----
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {