Skip to content

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

Update ItemTypeSelector.razor (#2287)

Leendert de Borstd23a464d5806
diff --git a/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor b/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor
index 3dad101f8..084af7083 100644
--- a/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor
+++ b/apps/server/AliasVault.Client/Main/Components/Items/ItemTypeSelector.razor
@@ -6,30 +6,26 @@
@inject IStringLocalizerFactory LocalizerFactory
<div class="relative mb-4">
- <div class="w-full px-4 py-3 bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-800 rounded-lg flex items-center gap-2">
+ <div class="relative w-full px-4 py-3 bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-800 rounded-lg flex items-center gap-2">
<button type="button"
@onclick="ToggleDropdown"
@onclick:preventDefault="true"
- class="flex-1 flex items-center justify-between hover:opacity-80 transition-opacity">
- <div class="flex items-center gap-2">
- <span class="text-primary-600 dark:text-primary-400">
- @GetTypeIcon(SelectedType)
- </span>
- <span class="text-primary-700 dark:text-primary-300 font-medium text-sm">
- @(IsEditMode ? Localizer["Editing"] : Localizer["Creating"]) @GetTypeDisplayName(SelectedType)
- </span>
- </div>
- <svg class="w-4 h-4 text-primary-500 transition-transform @(ShowDropdown ? "rotate-180" : "")"
- fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
- </svg>
- </button>
+ class="peer absolute inset-0 rounded-lg"
+ aria-label="@SharedLocalizer["ItemTypeLabel"]"></button>
+ <div class="relative flex items-center gap-2 min-w-0 pointer-events-none peer-hover:opacity-80 transition-opacity">
+ <span class="shrink-0 text-primary-600 dark:text-primary-400">
+ @GetTypeIcon(SelectedType)
+ </span>
+ <span class="text-primary-700 dark:text-primary-300 font-medium text-sm truncate">
+ @GetTypeDisplayName(SelectedType)
+ </span>
+ </div>
@if (SelectedType == ItemType.Alias && !IsEditMode && OnRegenerateAlias.HasDelegate)
{
<button type="button"
@onclick="HandleRegenerate"
@onclick:preventDefault="true"
- class="flex-shrink-0 p-1.5 text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/40 rounded transition-colors"
+ class="relative flex-shrink-0 -my-1 p-1.5 text-primary-600 dark:text-primary-400 hover:text-primary-800 dark:hover:text-primary-300 hover:bg-primary-300 dark:hover:bg-primary-900/40 rounded transition-colors"
title="@Localizer["RegenerateAlias"]">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M23 4v6h-6"/>
@@ -37,6 +33,15 @@
</svg>
</button>
}
+ <div class="relative flex-1 flex items-center justify-end gap-1 min-w-0 pointer-events-none peer-hover:opacity-80 transition-opacity">
+ <span class="text-xs text-primary-600/80 dark:text-primary-400/80 truncate">
+ @SharedLocalizer["ItemTypeLabel"]
+ </span>
+ <svg class="w-4 h-4 shrink-0 text-primary-500 transition-transform @(ShowDropdown ? "rotate-180" : "")"
+ fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
+ </svg>
+ </div>
</div>
@if (ShowDropdown)
@@ -53,7 +58,7 @@
<span class="@(SelectedType == itemType ? "text-primary-600 dark:text-primary-400" : "text-gray-500 dark:text-gray-400")">
@GetTypeIcon(itemType)
</span>
- <span class="font-medium">
+ <span class="font-medium text-sm">
@GetTypeDisplayName(itemType)
</span>
@if (SelectedType == itemType)
@@ -71,6 +76,8 @@
@code {
private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Items.ItemTypeSelector", "AliasVault.Client");
+ private IStringLocalizer SharedLocalizer => LocalizerFactory.Create("SharedResources", "AliasVault.Client");
+
/// <summary>
/// The currently selected item type.
/// </summary>
diff --git a/apps/server/AliasVault.Client/Resources/SharedResources.en.resx b/apps/server/AliasVault.Client/Resources/SharedResources.en.resx
index 25328bef8..cf30fe07e 100644
--- a/apps/server/AliasVault.Client/Resources/SharedResources.en.resx
+++ b/apps/server/AliasVault.Client/Resources/SharedResources.en.resx
@@ -391,4 +391,8 @@
<value>None</value>
<comment>Shown next to the Item label when an email is not linked to any credential. Shared between email modal and email page.</comment>
</data>
+ <data name="ItemTypeLabel" xml:space="preserve">
+ <value>Item Type</value>
+ <comment>Inline label on the item type picker</comment>
+ </data>
</root>
\ No newline at end of file
diff --git a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
index e1a4a8076..dd1a99648 100644
--- a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
+++ b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
@@ -787,6 +787,11 @@ video {
margin-right: -0.5rem;
}
+.-my-1 {
+ margin-top: -0.25rem;
+ margin-bottom: -0.25rem;
+}
+
.mx-2 {
margin-left: 0.5rem;
margin-right: 0.5rem;
@@ -1804,11 +1809,6 @@ video {
border-style: dashed;
}
-.border-amber-300 {
- --tw-border-opacity: 1;
- border-color: rgb(252 211 77 / var(--tw-border-opacity));
-}
-
.border-amber-400 {
--tw-border-opacity: 1;
border-color: rgb(251 191 36 / var(--tw-border-opacity));
@@ -2654,6 +2654,10 @@ video {
color: rgb(214 131 56 / var(--tw-text-opacity));
}
+.text-primary-600\/80 {
+ color: rgb(214 131 56 / 0.8);
+}
+
.text-primary-700 {
--tw-text-opacity: 1;
color: rgb(184 112 47 / var(--tw-text-opacity));
@@ -3028,6 +3032,11 @@ video {
background-color: rgb(251 203 116 / var(--tw-bg-opacity));
}
+.hover\:bg-primary-300:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(248 185 99 / var(--tw-bg-opacity));
+}
+
.hover\:bg-primary-500:hover {
--tw-bg-opacity: 1;
background-color: rgb(244 149 65 / var(--tw-bg-opacity));
@@ -3196,10 +3205,6 @@ video {
text-decoration-line: none;
}
-.hover\:opacity-80:hover {
- opacity: 0.8;
-}
-
.hover\:file\:bg-primary-100::file-selector-button:hover {
--tw-bg-opacity: 1;
background-color: rgb(253 222 133 / var(--tw-bg-opacity));
@@ -3365,6 +3370,10 @@ video {
opacity: 1;
}
+.peer:hover ~ .peer-hover\:opacity-80 {
+ opacity: 0.8;
+}
+
.dark\:divide-gray-600:is(.dark *) > :not([hidden]) ~ :not([hidden]) {
--tw-divide-opacity: 1;
border-color: rgb(75 85 99 / var(--tw-divide-opacity));
@@ -3491,10 +3500,6 @@ video {
background-color: rgb(120 53 15 / 0.2);
}
-.dark\:bg-amber-900\/30:is(.dark *) {
- background-color: rgb(120 53 15 / 0.3);
-}
-
.dark\:bg-blue-400:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(96 165 250 / var(--tw-bg-opacity));
@@ -3800,6 +3805,10 @@ video {
color: rgb(246 167 82 / var(--tw-text-opacity));
}
+.dark\:text-primary-400\/80:is(.dark *) {
+ color: rgb(246 167 82 / 0.8);
+}
+
.dark\:text-primary-500:is(.dark *) {
--tw-text-opacity: 1;
color: rgb(244 149 65 / var(--tw-text-opacity));