Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor misc buttons in client app to shared button components (#220)

Leendert de Borstd5ba3a63e44e
diff --git a/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor b/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor
index 923819be7..ba6b7f4c9 100644
--- a/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor
+++ b/src/AliasVault.Client/Main/Pages/Credentials/AddEdit.razor
@@ -72,7 +72,7 @@ else
<div class="p-4 mb-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800">
<h3 class="mb-4 text-xl font-semibold dark:text-white">Login credentials</h3>
<div class="mb-4">
- <button type="button" @onclick="GenerateRandomAlias" class="px-4 py-2 text-white bg-primary-600 rounded-lg hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 dark:bg-primary-500 dark:hover:bg-primary-600 dark:focus:ring-primary-800">Generate Random Alias</button>
+ <Button OnClick="GenerateRandomAlias">Generate Random Alias</Button>
</div>
<div class="grid gap-6">
<div class="col-span-6 sm:col-span-3">
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor
index 0de9e5ded..8aa81b54f 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Security/Components/ActiveSessionsSection.razor
@@ -36,8 +36,7 @@
<td class="px-6 py-4">@session.CreatedAt.ToLocalTime().ToString("g")</td>
<td class="px-6 py-4">@session.ExpireDate.ToLocalTime().ToString("g")</td>
<td class="px-6 py-4">
- <button @onclick="() => RevokeSession(session.Id)"
- class="font-medium text-red-600 dark:text-red-500 hover:underline">Revoke (log out)</button>
+ <Button Color="danger" OnClick="() => RevokeSession(session.Id)">Revoke</Button>
</td>
</tr>
}
diff --git a/src/AliasVault.Client/Main/Pages/Settings/Vault.razor b/src/AliasVault.Client/Main/Pages/Settings/Vault.razor
index d4580262c..1e7c671d0 100644
--- a/src/AliasVault.Client/Main/Pages/Settings/Vault.razor
+++ b/src/AliasVault.Client/Main/Pages/Settings/Vault.razor
@@ -15,14 +15,10 @@
<h3 class="mb-4 text-xl font-semibold dark:text-white">Export vault</h3>
<div class="mb-4">
<div>
- <button @onclick="ExportVaultSqlite" type="button" class="px-4 py-2 text-white bg-primary-600 rounded-lg hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 dark:bg-primary-500 dark:hover:bg-primary-600 dark:focus:ring-primary-800">
- Export vault to unencrypted SQLite file
- </button>
+ <Button OnClick="ExportVaultSqlite">Export vault to unencrypted SQLite file</Button>
</div>
<div class="mt-6">
- <button @onclick="ExportVaultCsv" type="button" class="px-4 py-2 text-white bg-primary-600 rounded-lg hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 dark:bg-primary-500 dark:hover:bg-primary-600 dark:focus:ring-primary-800">
- Export vault to unencrypted CSV file
- </button>
+ <Button OnClick="ExportVaultCsv">Export vault to unencrypted CSV file</Button>
</div>
</div>
</div>
@@ -66,13 +62,13 @@ else if (!string.IsNullOrEmpty(ImportSuccessMessage))
{
try
{
- // Decode the base64 string to a byte array
+ // Decode the base64 string to a byte array.
byte[] fileBytes = Convert.FromBase64String(await DbService.ExportSqliteToBase64Async());
- // Create a memory stream from the byte array
+ // Create a memory stream from the byte array.
using (MemoryStream memoryStream = new MemoryStream(fileBytes))
{
- // Invoke JavaScript to initiate the download
+ // Invoke JavaScript to initiate the download.
await JsInteropService.DownloadFileFromStream("aliasvault-client.sqlite", memoryStream.ToArray());
}
}
@@ -90,10 +86,10 @@ else if (!string.IsNullOrEmpty(ImportSuccessMessage))
var csvBytes = CsvImportExport.CredentialCsvService.ExportCredentialsToCsv(credentials);
- // Create a memory stream from the byte array
+ // Create a memory stream from the byte array.
using (MemoryStream memoryStream = new MemoryStream(csvBytes))
{
- // Invoke JavaScript to initiate the download
+ // Invoke JavaScript to initiate the download.
await JsInteropService.DownloadFileFromStream("aliasvault-client.csv", memoryStream.ToArray());
}
}
@@ -123,7 +119,7 @@ else if (!string.IsNullOrEmpty(ImportSuccessMessage))
var fileContent = System.Text.Encoding.UTF8.GetString(buffer);
var importedCredentials = CsvImportExport.CredentialCsvService.ImportCredentialsFromCsv(fileContent);
- // Loop through the imported credentials and actually add them to the database
+ // Loop through the imported credentials and actually add them to the database.
foreach (var importedCredential in importedCredentials)
{
await CredentialService.InsertEntryAsync(importedCredential, false);