Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update folder UI (#1404)
Leendert de Borstb8c11e02fd18
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Items/FolderCard.tsx b/apps/browser-extension/src/entrypoints/popup/components/Items/FolderCard.tsxdeleted file mode 100644index 94918dd35..000000000--- a/apps/browser-extension/src/entrypoints/popup/components/Items/FolderCard.tsx+++ /dev/null@@ -1,66 +0,0 @@-import React from 'react';--type FolderWithCount = {- id: string;- name: string;- itemCount: number;-};--type FolderCardProps = {- folder: FolderWithCount;- onClick: () => void;-};--/**- * FolderCard component- *- * This component displays a folder card with a folder icon, name, and item count.- * It allows the user to navigate into the folder when clicked.- */-const FolderCard: React.FC<FolderCardProps> = ({ folder, onClick }) => {- return (- <li>- <button- onClick={onClick}- className="w-full p-2 border dark:border-gray-600 rounded flex items-center bg-white dark:bg-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500"- >- {/* Folder Icon */}- <div className="w-8 h-8 mr-2 flex-shrink-0 flex items-center justify-center">- <svg- className="w-7 h-7 text-orange-500 dark:text-orange-400"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- >- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />- </svg>- </div>-- <div className="text-left flex-1">- <p className="font-medium text-gray-900 dark:text-white">{folder.name}</p>- <p className="text-sm text-gray-600 dark:text-gray-400">- {folder.itemCount} {folder.itemCount === 1 ? 'item' : 'items'}- </p>- </div>-- {/* Chevron Right Icon */}- <svg- className="w-5 h-5 text-gray-400 dark:text-gray-500 flex-shrink-0"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- >- <polyline points="9 18 15 12 9 6" />- </svg>- </button>- </li>- );-};--export default FolderCard;diff --git a/apps/browser-extension/src/entrypoints/popup/components/Items/FolderPill.tsx b/apps/browser-extension/src/entrypoints/popup/components/Items/FolderPill.tsxnew file mode 100644index 000000000..7bae6db34--- /dev/null+++ b/apps/browser-extension/src/entrypoints/popup/components/Items/FolderPill.tsx@@ -0,0 +1,45 @@+import React from 'react';++type FolderWithCount = {+ id: string;+ name: string;+ itemCount: number;+};++interface IFolderPillProps {+ folder: FolderWithCount;+ onClick: () => void;+}++/**+ * FolderPill component+ *+ * Displays a folder as a compact pill/tag that can be clicked to navigate into.+ * Designed to be displayed inline with other folder pills.+ */+const FolderPill: React.FC<IFolderPillProps> = ({ folder, onClick }) => {+ return (+ <button+ onClick={onClick}+ className="inline-flex items-center gap-1.5 px-3 py-1.5 bg-gray-100 dark:bg-gray-700/50 hover:bg-gray-200 dark:hover:bg-gray-600/50 border border-gray-200 dark:border-gray-600 rounded-full text-sm transition-colors focus:outline-none focus:ring-2 focus:ring-orange-500/50"+ >+ <svg+ className="w-3.5 h-3.5 text-orange-500 dark:text-orange-400 flex-shrink-0"+ 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 className="text-gray-700 dark:text-gray-200 font-medium truncate max-w-[120px]">+ {folder.name}+ </span>+ {folder.itemCount > 0 && (+ <span className="text-gray-400 dark:text-gray-500 text-xs">+ {folder.itemCount}+ </span>+ )}+ </button>+ );+};++export default FolderPill;diff --git a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsx b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsxindex 3c387c57f..9d71c7de7 100644--- a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsx+++ b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemsList.tsx@@ -5,7 +5,7 @@ import { useNavigate } from 'react-router-dom';import FolderModal from '@/entrypoints/popup/components/Folders/FolderModal';import HeaderButton from '@/entrypoints/popup/components/HeaderButton';import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';-import FolderCard from '@/entrypoints/popup/components/Items/FolderCard';+import FolderPill from '@/entrypoints/popup/components/Items/FolderPill';import ItemCard from '@/entrypoints/popup/components/Items/ItemCard';import LoadingSpinner from '@/entrypoints/popup/components/LoadingSpinner';import ReloadButton from '@/entrypoints/popup/components/ReloadButton';@@ -407,7 +407,7 @@ const ItemsList: React.FC = () => {<h2 className="flex items-baseline gap-1.5">{getFilterTitle()}<span className="text-sm text-gray-500 dark:text-gray-400">- ({folders.length > 0 ? `${folders.length} ${t('items.folders')}, ` : ''}{filteredItems.length} {t('items.items')})+ ({filteredItems.length})</span></h2><svg@@ -554,52 +554,40 @@ const ItemsList: React.FC = () => {</div>) : (<>- {/* Folders section (only show at root level when not searching) */}- {!currentFolderId && !searchTerm && (- <div className="space-y-2 mb-4">- <div className="flex items-center justify-between">- <h3 className="text-sm font-medium text-gray-700 dark:text-gray-300">- {t('items.folders')}- </h3>- <button- onClick={handleAddFolder}- className="text-xs text-orange-600 dark:text-orange-400 hover:text-orange-700 dark:hover:text-orange-300 focus:outline-none"- >- + {t('items.newFolder')}- </button>- </div>- {folders.length > 0 && (- <ul className="space-y-2">- {folders.map(folder => (- <FolderCard- key={folder.id}- folder={folder}- onClick={() => handleFolderClick(folder.id, folder.name)}- />- ))}- </ul>- )}+ {/* Folders as inline pills (only show at root level when not searching) */}+ {!currentFolderId && !searchTerm && folders.length > 0 && (+ <div className="flex flex-wrap items-center gap-2 mb-4">+ {folders.map(folder => (+ <FolderPill+ key={folder.id}+ folder={folder}+ onClick={() => handleFolderClick(folder.id, folder.name)}+ />+ ))}+ <button+ onClick={handleAddFolder}+ className="inline-flex items-center gap-1 px-2.5 py-1.5 text-xs text-gray-500 dark:text-gray-400 hover:text-orange-600 dark:hover:text-orange-400 hover:bg-gray-100 dark:hover:bg-gray-700/50 rounded-full transition-colors focus:outline-none"+ >+ <svg className="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">+ <line x1="12" y1="5" x2="12" y2="19" />+ <line x1="5" y1="12" x2="19" y2="12" />+ </svg>+ {t('items.newFolder')}+ </button></div>)}{/* Items */}{filteredItems.length > 0 && (- <div className="space-y-2">- {folders.length > 0 && (- <h3 className="text-sm font-medium text-gray-700 dark:text-gray-300">- {t('items.items')}- </h3>- )}- <ul className="space-y-2">- {filteredItems.map(item => (- <ItemCard- key={item.Id}- item={item}- showFolderPath={!!searchTerm && !!item.FolderPath}- />- ))}- </ul>- </div>+ <ul className="space-y-2">+ {filteredItems.map(item => (+ <ItemCard+ key={item.Id}+ item={item}+ showFolderPath={!!searchTerm && !!item.FolderPath}+ />+ ))}+ </ul>)}{/* Recently Deleted link (only show at root level when not searching) */}