Skip to content

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

Add item listing components (#2413)

Leendert de Borstc5f3c59ba2a1
diff --git a/apps/mobile-app/constants/vault.ts b/apps/mobile-app/constants/vault.ts
index 8b8a854c0..e8771c422 100644
--- a/apps/mobile-app/constants/vault.ts
+++ b/apps/mobile-app/constants/vault.ts
@@ -1,6 +1,5 @@
/**
- * Number of days that soft-deleted items stay in the "Recently Deleted" trash
- * before being permanently pruned during vault sync. Mirrors the server-side
- * default exposed via Config.TrashRetentionDays in the Blazor client.
+ * Days a trashed item stays in "Recently Deleted" before the pruner deletes it. Re-exported from the vault registry,
+ * which also generates the value the Rust pruner uses.
*/
-export const TRASH_RETENTION_DAYS = 30;
+export { TRASH_RETENTION_DEFAULT_DAYS as TRASH_RETENTION_DAYS } from '@aliasvault/models/vault';
diff --git a/apps/server/AliasVault.Client/Main/Components/Items/ItemCard.razor b/apps/server/AliasVault.Client/Main/Components/Items/ItemCard.razor
index 12b6ffe95..745b07867 100644
--- a/apps/server/AliasVault.Client/Main/Components/Items/ItemCard.razor
+++ b/apps/server/AliasVault.Client/Main/Components/Items/ItemCard.razor
@@ -40,15 +40,6 @@
}
</div>
<div class="text-gray-500 dark:text-gray-400 break-words w-full text-sm truncate" title="@GetDisplayText()">@GetDisplayText()</div>
- @if (ShowFolderPath && !string.IsNullOrEmpty(Obj.FolderName))
- {
- <div class="text-gray-400 dark:text-gray-500 text-xs mt-1 flex items-center gap-1">
- <svg class="w-3 h-3" viewBox="0 0 24 24" fill="currentColor">
- <path d="M10 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z"/>
- </svg>
- <span class="truncate max-w-[100px]">@Obj.FolderName</span>
- </div>
- }
</div>
</div>
@@ -59,12 +50,6 @@
[Parameter]
public required ItemListEntry Obj { get; set; }
- /// <summary>
- /// Gets or sets whether to show the folder path (used when searching).
- /// </summary>
- [Parameter]
- public bool ShowFolderPath { get; set; }
-
/// <summary>
/// Gets or sets the callback raised after the item was mutated via the context menu (duplicated or deleted).
/// </summary>
diff --git a/apps/server/AliasVault.Client/Main/Models/ItemListEntry.cs b/apps/server/AliasVault.Client/Main/Models/ItemListEntry.cs
index f49c42614..1251d1b3e 100644
--- a/apps/server/AliasVault.Client/Main/Models/ItemListEntry.cs
+++ b/apps/server/AliasVault.Client/Main/Models/ItemListEntry.cs
@@ -83,9 +83,4 @@ public sealed class ItemListEntry
/// Gets or sets the folder ID this item belongs to.
/// </summary>
public Guid? FolderId { get; set; }
-
- /// <summary>
- /// Gets or sets the folder name this item belongs to.
- /// </summary>
- public string? FolderName { get; set; }
}
diff --git a/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor b/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor
index e1abcf942..7aa407a3d 100644
--- a/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor
+++ b/apps/server/AliasVault.Client/Main/Pages/Items/Home.razor
@@ -108,7 +108,7 @@ else
}
@* Folders section - show at root OR inside folders to display subfolders *@
- @if (!IsSearching && ShowFolders)
+ @if (ShowFolders)
{
<div class="flex flex-wrap items-center gap-2 mb-4">
@foreach (var folder in CurrentLevelFolders)
@@ -198,7 +198,7 @@ else
}
@foreach (var item in FilteredAndSortedItems)
{
- <ItemCard @key="item.Id" Obj="@item" ShowFolderPath="@IsSearching" OnMutated="LoadItemsAsync" />
+ <ItemCard @key="item.Id" Obj="@item" OnMutated="LoadItemsAsync" />
}
</div>
}
@@ -380,11 +380,6 @@ else
/// </summary>
private int RecentlyDeletedCount { get; set; }
- /// <summary>
- /// Gets or sets the search term.
- /// </summary>
- private string SearchTerm { get; set; } = string.Empty;
-
/// <summary>
/// Gets or sets the filter type for the items.
/// </summary>
@@ -458,11 +453,6 @@ else
/// </summary>
private bool IsInFolder => FolderId.HasValue;
- /// <summary>
- /// Gets whether we're currently searching.
- /// </summary>
- private bool IsSearching => !string.IsNullOrEmpty(SearchTerm);
-
/// <summary>
/// Gets whether all items are in folders (no items at root level but items exist in folders).
/// </summary>
@@ -488,7 +478,7 @@ else
// Show only items in this folder
filtered = filtered.Where(x => x.FolderId == FolderId);
}
- else if (!IsSearching && ShowFolders)
+ else if (ShowFolders)
{
// When showing folders (checkbox ON): only show root items (exclude items in folders)
// When not showing folders (checkbox OFF): show all items flat
diff --git a/apps/server/AliasVault.Client/Services/ItemService.cs b/apps/server/AliasVault.Client/Services/ItemService.cs
index 664eb7d1e..0f986cd68 100644
--- a/apps/server/AliasVault.Client/Services/ItemService.cs
+++ b/apps/server/AliasVault.Client/Services/ItemService.cs
@@ -525,7 +525,6 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, Conf
var items = await context.Items
.Include(x => x.FieldValues.Where(fv => !fv.IsDeleted))
.Include(x => x.Logo)
- .Include(x => x.Folder)
.Include(x => x.Passkeys.Where(p => !p.IsDeleted))
.Include(x => x.Attachments.Where(a => !a.IsDeleted))
.Include(x => x.TotpCodes.Where(t => !t.IsDeleted))
@@ -556,7 +555,6 @@ public sealed class ItemService(HttpClient httpClient, DbService dbService, Conf
HasAttachment = x.Attachments != null && x.Attachments.Any(a => !a.IsDeleted),
HasTotp = x.TotpCodes != null && x.TotpCodes.Any(t => !t.IsDeleted),
FolderId = x.FolderId,
- FolderName = x.Folder?.Name,
}).ToList();
_cachedList = list;
diff --git a/apps/web/src/components/items/ItemCard.tsx b/apps/web/src/components/items/ItemCard.tsx
new file mode 100644
index 000000000..7a221375c
--- /dev/null
+++ b/apps/web/src/components/items/ItemCard.tsx
@@ -0,0 +1,75 @@
+import { ItemTypes } from '@aliasvault/models/vault';
+import React, { useRef } from 'react';
+import { useNavigate } from 'react-router-dom';
+
+import ItemContextMenu, { type ItemContextMenuHandle } from '@/components/items/ItemContextMenu';
+import ItemIcon from '@/components/items/ItemIcon';
+import type { ItemListEntry } from '@/components/items/ItemListEntry';
+import { itemRoute } from '@/utils/ItemRoute';
+
+type ItemCardProps = {
+ entry: ItemListEntry;
+ onMutated: () => void;
+};
+
+/**
+ * The secondary line of a card.
+ * @param entry - the entry
+ */
+const getDisplayText = (entry: ItemListEntry): string => {
+ if (entry.itemType === ItemTypes.CreditCard) {
+ return entry.cardNumber && entry.cardNumber.length >= 4 ? '•••• ' + entry.cardNumber.slice(-4) : '';
+ }
+ if (entry.itemType === ItemTypes.Note) {
+ return '';
+ }
+ return entry.username ?? entry.email ?? '';
+};
+
+/**
+ * Item card in the grid view.
+ */
+const ItemCard: React.FC<ItemCardProps> = ({ entry, onMutated }) => {
+ const navigate = useNavigate();
+ const menuRef = useRef<ItemContextMenuHandle>(null);
+ const serviceName = entry.service && entry.service.length > 0 ? entry.service : 'Untitled';
+
+ return (
+ <div
+ onClick={() => navigate(itemRoute({ Id: entry.id, ManifestId: entry.manifestId }))}
+ onContextMenu={(e) => {
+ e.preventDefault(); menuRef.current?.open(e.clientX, e.clientY);
+ }}
+ className="credential-card relative group p-4 space-y-2 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 dark:bg-gray-800 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200">
+ <div className="absolute top-2 right-2">
+ <ItemContextMenu ref={menuRef} item={{ Id: entry.id, ManifestId: entry.manifestId }} itemName={entry.service} onMutated={onMutated} />
+ </div>
+ <div className="px-4 py-2 text-gray-400 rounded text-center flex flex-col items-center">
+ <div className="mb-2">
+ <ItemIcon item={entry.item} altText={serviceName} sizeClass="w-12 h-12" />
+ </div>
+ <div className="flex items-center justify-center gap-1.5 w-full">
+ <div className="text-gray-900 dark:text-gray-100 break-words truncate max-w-[150px]" title={serviceName}>{serviceName}</div>
+ {entry.hasTotp && (
+ <svg className="w-3.5 h-3.5 text-gray-500 dark:text-gray-400 flex-shrink-0" viewBox="0 -960 960 960" fill="currentColor" aria-label="Has TOTP">
+ <path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm100-200h46v-240h-36l-70 50 24 36 36-26v180Zm124 0h156v-40h-94l-2-2q21-20 34.5-34t21.5-22q18-18 27-36t9-38q0-29-22-48.5T458-600q-26 0-47 15t-29 39l40 16q5-13 14.5-20.5T458-558q15 0 24.5 8t9.5 20q0 11-4 20.5T470-486l-32 32-54 54v40Zm296 0q36 0 58-20t22-52q0-18-10-32t-28-22v-2q14-8 22-20.5t8-29.5q0-27-21-44.5T678-600q-25 0-46.5 14.5T604-550l40 16q4-12 13-19t21-7q13 0 21.5 7.5T708-534q0 14-10 22t-26 8h-18v40h20q20 0 31 8t11 22q0 13-11 22.5t-25 9.5q-17 0-26-7.5T638-436l-40 16q7 29 28.5 44.5T680-360ZM160-240h640v-480H160v480Zm0 0v-480 480Z" />
+ </svg>
+ )}
+ {entry.hasPasskey && (
+ <svg className="w-3.5 h-3.5 text-gray-500 dark:text-gray-400 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-label="Has passkey">
+ <path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4" />
+ </svg>
+ )}
+ {entry.hasAttachment && (
+ <svg className="w-3.5 h-3.5 text-gray-500 dark:text-gray-400 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-label="Has attachments">
+ <path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" />
+ </svg>
+ )}
+ </div>
+ <div className="text-gray-500 dark:text-gray-400 break-words w-full text-sm truncate" title={getDisplayText(entry)}>{getDisplayText(entry)}</div>
+ </div>
+ </div>
+ );
+};
+
+export default ItemCard;
diff --git a/apps/web/src/components/items/ItemContextMenu.tsx b/apps/web/src/components/items/ItemContextMenu.tsx
new file mode 100644
index 000000000..21dd98efe
--- /dev/null
+++ b/apps/web/src/components/items/ItemContextMenu.tsx
@@ -0,0 +1,181 @@
+import { TRASH_RETENTION_DEFAULT_DAYS } from '@aliasvault/models/vault';
+import React, { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+
+import FormModal from '@/components/shared/FormModal';
+import { useDb } from '@/context/DbContext';
+import { useNotifications } from '@/context/NotificationContext';
+import { useClickOutside } from '@/hooks/useClickOutside';
+import { useVaultMutate } from '@/hooks/useVaultMutate';
+import { itemRoute } from '@/utils/ItemRoute';
+
+import type { ItemRef } from '@aliasvault/client/database/ItemRef';
+
+/**
+ * What a parent can ask the menu to do.
+ */
+export type ItemContextMenuHandle = {
+ /** Open the menu at a cursor position. */
+ open: (x: number, y: number) => void;
+};
+
+type ItemContextMenuProps = {
+ item: ItemRef;
+ itemName: string | null;
+ onMutated: () => void;
+};
+
+/**
+ * Ellipsis menu on an item with edit, duplicate and delete.
+ */
+const ItemContextMenu = forwardRef<ItemContextMenuHandle, ItemContextMenuProps>(({ item, itemName, onMutated }, ref) => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+ const dbContext = useDb();
+ const notifications = useNotifications();
+ const { executeVaultMutationAsync } = useVaultMutate();
+ const [isOpen, setIsOpen] = useState(false);
+ const [position, setPosition] = useState<{ x: number; y: number } | null>(null);
+ const [showDeleteModal, setShowDeleteModal] = useState(false);
+ const [isDeleting, setIsDeleting] = useState(false);
+ const [isDuplicating, setIsDuplicating] = useState(false);
+ const menuRef = useRef<HTMLDivElement>(null);
+ const buttonRef = useRef<HTMLButtonElement>(null);
+
+ /**
+ * Close the menu.
+ */
+ const closeMenu = useCallback((): void => setIsOpen(false), []);
+
+ useClickOutside([menuRef, buttonRef], closeMenu, isOpen);
+
+ useImperativeHandle(ref, () => ({
+ /**
+ * Open the menu at a cursor position.
+ */
+ open: (x: number, y: number): void => {
+ setPosition({ x, y });
+ setIsOpen(true);
+ },
+ }), []);
+
+ /**
+ * Toggle the menu from the ellipsis button.
+ */
+ const toggleMenu = (e: React.MouseEvent): void => {
+ e.stopPropagation();
+ if (isOpen) {
+ closeMenu();
+ return;
+ }
+ setPosition(null);
+ setIsOpen(true);
+ };
+
+ /**
+ * Duplicate the item.
+ */
+ const duplicateItem = async (): Promise<void> => {
+ setIsOpen(false);
+ if (isDuplicating || !dbContext.sqliteClient) {
+ return;
+ }
+ setIsDuplicating(true);
+ try {
+ await executeVaultMutationAsync(async () => {
+ await dbContext.sqliteClient!.items.duplicate(item);
+ });
+ notifications.addSuccessMessage(t('sharedResources.DuplicateSuccessMessage'), true);
+ onMutated();
+ } catch (error) {
+ console.error('Failed to duplicate item:', error);
+ notifications.addErrorMessage(t('sharedResources.DuplicateErrorMessage'), true);
+ } finally {
+ setIsDuplicating(false);
+ }
+ };
+
+ /**
+ * Move the item to the trash.
+ */
+ const confirmDelete = async (): Promise<void> => {
+ if (isDeleting || !dbContext.sqliteClient) {
+ return;
+ }
+ setIsDeleting(true);
+ try {
+ await executeVaultMutationAsync(async () => {
+ await dbContext.sqliteClient!.items.trash(item);
+ });
+ notifications.addSuccessMessage(t('pages.main.items.delete.DeleteSuccessMessage'), true);
+ setShowDeleteModal(false);
+ onMutated();
+ } finally {
+ setIsDeleting(false);
+ }
+ };
+
+ const menuStyle: React.CSSProperties | undefined = position ? { left: `min(${Math.round(position.x)}px, calc(100vw - 170px))`, top: `min(${Math.round(position.y)}px, calc(100vh - 140px))` } : undefined;
+
+ return (
+ <div className="relative" onClick={(e) => e.stopPropagation()}>
+ <button
+ ref={buttonRef}
+ type="button"
+ onClick={toggleMenu}
+ aria-label={t('sharedResources.ItemOptions')}
+ aria-haspopup="menu"
+ className={`px-0.5 py-1 rounded text-gray-400 transition-opacity ${isOpen ? 'opacity-100' : 'opacity-0'} group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-primary-500`}>
+ <svg className="w-2 h-4" viewBox="0 0 12 24" fill="currentColor" aria-hidden="true">
+ <circle cx="6" cy="5" r="2" />
+ <circle cx="6" cy="12" r="2" />
+ <circle cx="6" cy="19" r="2" />
+ </svg>
+ </button>
+
+ {isOpen && (
+ <div ref={menuRef} role="menu" style={menuStyle} className={`${position ? 'fixed' : 'absolute right-0 top-full mt-1'} z-50 w-40 py-1 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 dark:bg-gray-700`}>
+ <button type="button" role="menuitem" onClick={() => navigate(itemRoute(item, true))} className="w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600">
+ {t('sharedResources.Edit')}
+ </button>
+ <button type="button" role="menuitem" onClick={duplicateItem} className="w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600">
+ {t('sharedResources.Duplicate')}
+ </button>
+ <button type="button" role="menuitem" onClick={() => {
+ setIsOpen(false); setShowDeleteModal(true);
+ }} className="w-full text-left px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-600">
+ {t('sharedResources.Delete')}
+ </button>
+ </div>
+ )}
+
+ <FormModal
+ isOpen={showDeleteModal}
+ title={t('pages.main.items.delete.DeleteItemTitle')}
+ iconBackgroundClass="bg-red-100 dark:bg-red-900/30"
+ confirmText={t('pages.main.items.delete.YesImSureButton')}
+ cancelText={t('pages.main.items.delete.NoCancelButton')}
+ confirmButtonClass="bg-red-600 hover:bg-red-700"
+ isLoading={isDeleting}
+ onConfirm={confirmDelete}
+ onClose={() => !isDeleting && setShowDeleteModal(false)}
+ icon={(
+ <svg className="h-6 w-6 text-red-600 dark:text-red-400" fill="none" viewBox="0 0 24 24" strokeWidth="1.5" stroke="currentColor">
+ <path strokeLinecap="round" strokeLinejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" />
+ </svg>
+ )}>
+ <p className="text-sm text-gray-500 dark:text-gray-400 mb-3">
+ {t('pages.main.items.delete.DeleteItemDescription', { 0: TRASH_RETENTION_DEFAULT_DAYS })}
+ </p>
+ <div className="bg-gray-50 dark:bg-gray-700/50 rounded-md p-3">
+ <p className="text-sm font-medium text-gray-900 dark:text-white break-all">{itemName ?? ''}</p>
+ </div>
+ </FormModal>
+ </div>
+ );
+});
+
+ItemContextMenu.displayName = 'ItemContextMenu';
+
+export default ItemContextMenu;
diff --git a/apps/web/src/components/items/ItemFilterDropdown.tsx b/apps/web/src/components/items/ItemFilterDropdown.tsx
new file mode 100644
index 000000000..8873e94b6
--- /dev/null
+++ b/apps/web/src/components/items/ItemFilterDropdown.tsx
@@ -0,0 +1,152 @@
+import { type ItemFilterType } from '@aliasvault/client/items/ItemFilters';
+import { ItemTypes } from '@aliasvault/models/vault';
+import React, { useCallback, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useClickOutside } from '@/hooks/useClickOutside';
+
+type ItemFilterDropdownProps = {
+ title: string;
+ count?: number;
+ activeFilter: ItemFilterType | null;
+ isRecentlyDeletedActive?: boolean;
+ recentlyDeletedCount: number;
+ showFoldersToggle: boolean;
+ showFolders: boolean;
+ titleActions?: React.ReactNode;
+ onSelectFilter: (filter: ItemFilterType) => void;
+ onSelectRecentlyDeleted: () => void;
+ onToggleShowFolders: () => void;
+};
+
+/**
+ * Page title which acts as a filter dropdown when clicked.
+ */
+const ItemFilterDropdown: React.FC<ItemFilterDropdownProps> = ({ title, count, activeFilter, isRecentlyDeletedActive = false, recentlyDeletedCount, showFoldersToggle, showFolders, titleActions, onSelectFilter, onSelectRecentlyDeleted, onToggleShowFolders }) => {
+ const { t } = useTranslation();
+ const [isOpen, setIsOpen] = useState(false);
+ const buttonRef = useRef<HTMLButtonElement>(null);
+ const menuRef = useRef<HTMLDivElement>(null);
+
+ /**
+ * Close the menu.
+ */
+ const close = useCallback((): void => setIsOpen(false), []);
+ useClickOutside([buttonRef, menuRef], close, isOpen);
+
+ /**
+ * Whether a filter is the active one.
+ */
+ const isActive = (filter: ItemFilterType): boolean => !isRecentlyDeletedActive && activeFilter === filter;
+
+ /**
+ * Pick a filter and close.
+ */
+ const pickFilter = (filter: ItemFilterType): void => {
+ setIsOpen(false);
+ onSelectFilter(filter);
+ };
+
+ /**
+ * The classes of a type/feature filter row.
+ */
+ const rowClass = (filter: ItemFilterType, withIcon: boolean): string =>
+ `w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 ${withIcon ? 'flex items-center gap-2' : ''} ${isActive(filter) ? 'bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400' : 'text-gray-700 dark:text-gray-300'}`;
+
+ /**
+ * The classes of a filter row icon.
+ */
+ const iconClass = (filter: ItemFilterType): string => `w-5 h-5 ${isActive(filter) ? 'text-orange-500 dark:text-orange-400' : 'text-gray-400 dark:text-gray-500'}`;
+
+ return (
+ <div className="relative flex items-center gap-2">
+ <button ref={buttonRef} onClick={() => setIsOpen(!isOpen)} className="flex items-center gap-2 text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none">
+ <h1 className="flex items-baseline gap-1.5 text-xl font-semibold tracking-tight text-gray-900 dark:text-white sm:text-2xl">
+ <span>{title}</span>
+ {count !== undefined && (
+ <span className="text-base text-gray-500 dark:text-gray-400">({count})</span>
+ )}
+ </h1>
+ <svg className="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <polyline points="6 9 12 15 18 9" />
+ </svg>
+ </button>
+
+ {titleActions}
+
+ {isOpen && (
+ <div ref={menuRef} className="absolute left-0 top-full z-40 mt-2 w-56 origin-top-left rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-gray-700">
+ <div className="py-1">
+ <div className={`flex items-center justify-between px-4 py-2 ${isActive('all') ? 'bg-orange-50 dark:bg-orange-900/20' : ''}`}>
+ <button onClick={() => pickFilter('all')} className={`text-left text-sm hover:text-gray-900 dark:hover:text-white ${isActive('all') ? 'text-orange-600 dark:text-orange-400' : 'text-gray-700 dark:text-gray-300'}`}>
+ {t('pages.main.items.home.FilterAllOption')}
+ </button>
+ {showFoldersToggle && (
+ <button onClick={(e) => {
+ e.stopPropagation(); setIsOpen(false); onToggleShowFolders();
+ }} className="flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">
+ <span>{t('pages.main.items.home.ShowFoldersOption')}</span>
+ <svg className={`w-5 h-5 ${showFolders ? 'text-orange-500 dark:text-orange-400' : 'text-gray-400 dark:text-gray-500'}`} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <rect x="3" y="3" width="18" height="18" rx="2" />
+ {showFolders && <polyline points="7 12 10 15 17 8" />}
+ </svg>
+ </button>
+ )}
+ </div>
+ <div className="border-t border-gray-200 dark:border-gray-600 my-1"></div>
+
+ <button onClick={() => pickFilter(ItemTypes.Login)} className={rowClass(ItemTypes.Login, true)}>
+ <svg className={iconClass(ItemTypes.Login)} fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" />
+ </svg>
+ {t('components.main.items.itemTypeSelector.TypeLogin')}
+ </button>
+ <button onClick={() => pickFilter(ItemTypes.Alias)} className={rowClass(ItemTypes.Alias, true)}>
+ <svg className={iconClass(ItemTypes.Alias)} fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
+ </svg>
+ {t('components.main.items.itemTypeSelector.TypeAlias')}
+ </button>
+ <button onClick={() => pickFilter(ItemTypes.CreditCard)} className={rowClass(ItemTypes.CreditCard, true)}>
+ <svg className={iconClass(ItemTypes.CreditCard)} fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" />
+ </svg>
+ {t('components.main.items.itemTypeSelector.TypeCreditCard')}
+ </button>
+ <button onClick={() => pickFilter(ItemTypes.Note)} className={rowClass(ItemTypes.Note, true)}>
+ <svg className={iconClass(ItemTypes.Note)} fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ {t('components.main.items.itemTypeSelector.TypeNote')}
+ </button>
+
+ <div className="border-t border-gray-200 dark:border-gray-600 my-1"></div>
+
+ <button onClick={() => pickFilter('passkeys')} className={rowClass('passkeys', false)}>
+ {t('pages.main.items.home.FilterPasskeysOption')}
+ </button>
+ <button onClick={() => pickFilter('attachments')} className={rowClass('attachments', false)}>
+ {t('pages.main.items.home.FilterAttachmentsOption')}
+ </button>
+ <button onClick={() => pickFilter('totp')} className={rowClass('totp', false)}>
+ {t('pages.main.items.home.FilterTotpOption')}
+ </button>
+
+ <div className="border-t border-gray-200 dark:border-gray-600 my-1"></div>
+
+ <button onClick={() => {
+ setIsOpen(false); onSelectRecentlyDeleted();
+ }} className={`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 flex items-center justify-between ${isRecentlyDeletedActive ? 'bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400' : 'text-gray-700 dark:text-gray-300'}`}>
+ <span>{t('pages.main.items.home.FilterRecentlyDeletedOption')}</span>
+ {recentlyDeletedCount > 0 && (
+ <span className={isRecentlyDeletedActive ? 'text-orange-500 dark:text-orange-400' : 'text-gray-400 dark:text-gray-500'}>{recentlyDeletedCount}</span>
+ )}
+ </button>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default ItemFilterDropdown;
diff --git a/apps/web/src/components/items/ItemListEntry.ts b/apps/web/src/components/items/ItemListEntry.ts
new file mode 100644
index 000000000..0e69106aa
--- /dev/null
+++ b/apps/web/src/components/items/ItemListEntry.ts
@@ -0,0 +1,63 @@
+/**
+ * Item list entry model for the item lists (the Blazor ItemListEntry), built from the vault's items.
+ */
+
+import SqliteClient from '@aliasvault/client/database/SqliteClient';
+import { FieldKey, type Item, type ItemType } from '@aliasvault/models/vault';
+
+/**
+ * One item as the lists show it.
+ */
+export type ItemListEntry = {
+ id: string;
+ manifestId: string;
+ itemType: ItemType;
+ logoDataUri: string | null;
+ service: string | null;
+ username: string | null;
+ email: string | null;
+ cardNumber: string | null;
+ createdAt: Date;
+ hasPasskey: boolean;
+ hasAttachment: boolean;
+ hasTotp: boolean;
+ folderId: string | null;
+ item: Item;
+};
+
+/**
+ * The first value of a field.
+ * @param item - the item
+ * @param fieldKey - the field key
+ */
+export function getFieldValue(item: Item, fieldKey: string): string | null {
+ const field = item.Fields?.find(f => f.FieldKey === fieldKey);
+ if (!field || !field.Value) {
+ return null;
+ }
+ const value = Array.isArray(field.Value) ? field.Value[0] : field.Value;
+ return value && value.length > 0 ? value : null;
+}
+
+/**
+ * Map a vault item to a list entry.
+ * @param item - the item
+ */
+export function toItemListEntry(item: Item): ItemListEntry {
+ return {
+ id: item.Id,
+ manifestId: item.ManifestId,
+ itemType: item.ItemType,
+ logoDataUri: item.Logo ? SqliteClient.imgSrcFromBytes(item.Logo) : null,
+ service: item.Name,
+ username: getFieldValue(item, FieldKey.LoginUsername),
+ email: getFieldValue(item, FieldKey.LoginEmail),
+ cardNumber: getFieldValue(item, FieldKey.CardNumber),
+ createdAt: new Date(item.CreatedAt),
+ hasPasskey: item.HasPasskey ?? false,
+ hasAttachment: item.HasAttachment ?? false,
+ hasTotp: item.HasTotp ?? false,
+ folderId: item.FolderId ?? null,
+ item,
+ };
+}
diff --git a/apps/web/src/components/items/ItemsTable.tsx b/apps/web/src/components/items/ItemsTable.tsx
new file mode 100644
index 000000000..57a895bd2
--- /dev/null
+++ b/apps/web/src/components/items/ItemsTable.tsx
@@ -0,0 +1,71 @@
+import { scopedKey } from '@aliasvault/client/database/ItemRef';
+import React, { useRef } from 'react';
+import { useNavigate } from 'react-router-dom';
+
+import ItemContextMenu, { type ItemContextMenuHandle } from '@/components/items/ItemContextMenu';
+import ItemIcon from '@/components/items/ItemIcon';
+import type { ItemListEntry } from '@/components/items/ItemListEntry';
+import SortableTable, { SortableTableColumn, SortableTableRow, type SortDirection, type TableColumn } from '@/components/shared/SortableTable';
+import { itemRoute } from '@/utils/ItemRoute';
+
+const TABLE_COLUMNS: TableColumn[] = [
+ { title: 'Service', propertyName: 'Service' },
+ { title: 'Username', propertyName: 'Username' },
+ { title: 'Email', propertyName: 'Email' },
+ { title: 'Created', propertyName: 'CreatedAt' },
+ { title: '', sortable: false },
+];
+
+type ItemsTableProps = {
+ entries: ItemListEntry[];
+ sortColumn: string;
+ sortDirection: SortDirection;
+ onTableSortChanged: (column: string, direction: SortDirection) => void;
+ onMutated: () => void;
+};
+
+/**
+ * Format a date as yyyy-MM-dd.
+ * @param date - the date
+ */
+const formatDate = (date: Date): string => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
+
+/**
+ * One table row.
+ */
+const ItemsTableRow: React.FC<{ entry: ItemListEntry; onMutated: () => void }> = ({ entry, onMutated }) => {
+ const navigate = useNavigate();
+ const menuRef = useRef<ItemContextMenuHandle>(null);
+
+ return (
+ <SortableTableRow className="cursor-pointer group" onClick={() => navigate(itemRoute({ Id: entry.id, ManifestId: entry.manifestId }))} onContextMenu={(e) => menuRef.current?.open(e.clientX, e.clientY)}>
+ <SortableTableColumn padding={false}>
+ <div className="flex items-center space-x-2 py-2 pl-2">
+ <ItemIcon item={entry.item} altText={entry.service ?? ''} sizeClass="w-6 h-6" />
+ <span className="font-bold ml-2">{entry.service}</span>
+ </div>
+ </SortableTableColumn>
+ <SortableTableColumn padding={false}>{entry.username}</SortableTableColumn>
+ <SortableTableColumn padding={false}>{entry.email}</SortableTableColumn>
+ <SortableTableColumn padding={false}>{formatDate(entry.createdAt)}</SortableTableColumn>
+ <SortableTableColumn padding={false}>
+ <div className="flex justify-end pr-2">
+ <ItemContextMenu ref={menuRef} item={{ Id: entry.id, ManifestId: entry.manifestId }} itemName={entry.service} onMutated={onMutated} />
+ </div>
+ </SortableTableColumn>
+ </SortableTableRow>
+ );
+};
+
+/**
+ * Items in table view.
+ */
+const ItemsTable: React.FC<ItemsTableProps> = ({ entries, sortColumn, sortDirection, onTableSortChanged, onMutated }) => (
+ <SortableTable columns={TABLE_COLUMNS} sortColumn={sortColumn} sortDirection={sortDirection} onSortChanged={onTableSortChanged}>
+ {entries.map(entry => (
+ <ItemsTableRow key={scopedKey(entry.manifestId, entry.id)} entry={entry} onMutated={onMutated} />
+ ))}
+ </SortableTable>
+);
+
+export default ItemsTable;
diff --git a/core/client/src/constants/Vault.ts b/core/client/src/constants/Vault.ts
index 8b8a854c0..e8771c422 100644
--- a/core/client/src/constants/Vault.ts
+++ b/core/client/src/constants/Vault.ts
@@ -1,6 +1,5 @@
/**
- * Number of days that soft-deleted items stay in the "Recently Deleted" trash
- * before being permanently pruned during vault sync. Mirrors the server-side
- * default exposed via Config.TrashRetentionDays in the Blazor client.
+ * Days a trashed item stays in "Recently Deleted" before the pruner deletes it. Re-exported from the vault registry,
+ * which also generates the value the Rust pruner uses.
*/
-export const TRASH_RETENTION_DAYS = 30;
+export { TRASH_RETENTION_DEFAULT_DAYS as TRASH_RETENTION_DAYS } from '@aliasvault/models/vault';