diff --git a/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor b/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
index ff2351581..71b4d191f 100644
--- a/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
+++ b/src/AliasVault.Client/Main/Components/Widgets/CreateNewIdentityWidget.razor
@@ -43,7 +43,7 @@
private bool IsPopupVisible = false;
private bool IsCreating = false;
private CreateModel Model = new();
- private string PopupStyle { get; set; } = "";
+ private string PopupStyle { get; set; } = string.Empty;
private ElementReference buttonRef;
private IJSObjectReference? Module;
@@ -84,6 +84,9 @@
});
}
+ ///
+ /// Toggle the popup.
+ ///
private async Task TogglePopup()
{
IsPopupVisible = !IsPopupVisible;
@@ -93,6 +96,9 @@
}
}
+ ///
+ /// Show the popup.
+ ///
private async Task ShowPopup()
{
IsPopupVisible = true;
@@ -106,23 +112,32 @@
await JsInteropService.FocusElementById("serviceName");
}
+ ///
+ /// Close the popup.
+ ///
private void ClosePopup()
{
IsPopupVisible = false;
}
+ ///
+ /// Update the popup style so that it is positioned correctly.
+ ///
private async Task UpdatePopupStyle()
{
var windowWidth = await JSRuntime.InvokeAsync("getWindowWidth");
var buttonRect = await JSRuntime.InvokeAsync("getElementRect", buttonRef);
- var popupWidth = Math.Min(400, windowWidth - 20); // 20px for some padding
- var leftPosition = Math.Max(0, Math.Min(buttonRect.Left, windowWidth - popupWidth - 10));
+ // Constrain the popup width to 400px minus some padding.
+ var popupWidth = Math.Min(400, windowWidth - 20);
- PopupStyle = $"width: {popupWidth}px; left: {leftPosition}px; top: {buttonRect.Bottom}px;";
+ PopupStyle = $"width: {popupWidth}px; top: {buttonRect.Bottom}px;";
StateHasChanged();
}
+ ///
+ /// Create the new identity.
+ ///
private async Task CreateIdentity()
{
if (IsCreating)
@@ -169,6 +184,9 @@
ClosePopup();
}
+ ///
+ /// Open the advanced mode for creating a new identity.
+ ///
private void OpenAdvancedMode()
{
NavigationManager.NavigateTo("/credentials/create");