Skip to content

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

Update folder breadcrumb UI, show folder breadcrumb in item details page (#1695)

Leendert de Borst685926737413
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderBreadcrumb.tsx b/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderBreadcrumb.tsx
index 229c8520a..5d632d0dc 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderBreadcrumb.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/Folders/FolderBreadcrumb.tsx
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
-import { useNavigate } from 'react-router-dom';
+import { useNavigate, useLocation } from 'react-router-dom';
import { useDb } from '@/entrypoints/popup/context/DbContext';
@@ -31,7 +31,8 @@ type FolderBreadcrumbProps = {
/**
* Displays a breadcrumb navigation trail for folder hierarchy.
- * Shows "Root > Parent Folder > Current Folder" with clickable links.
+ * Shows the path to the current location, excluding the current page itself.
+ * Example: If viewing "Client A" folder, shows "Items > Work > Projects" (not including "Client A")
*/
const FolderBreadcrumb: React.FC<FolderBreadcrumbProps> = ({
folderId,
@@ -40,10 +41,12 @@ const FolderBreadcrumb: React.FC<FolderBreadcrumbProps> = ({
}) => {
const { t } = useTranslation();
const navigate = useNavigate();
+ const location = useLocation();
const dbContext = useDb();
/**
* Compute breadcrumb trail based on current folder.
+ * Excludes the current folder if we're viewing it (to avoid duplication with page title).
*/
const breadcrumbs = useMemo((): Breadcrumb[] => {
if (!folderId || !dbContext?.sqliteClient) {
@@ -52,14 +55,34 @@ const FolderBreadcrumb: React.FC<FolderBreadcrumbProps> = ({
const allFolders = dbContext.sqliteClient.folders.getAll();
const folderNames = getFolderPath(folderId, allFolders);
const folderIds = getFolderIdPath(folderId, allFolders);
- return folderNames.map((name, index) => ({
+ const fullPath = folderNames.map((name, index) => ({
name,
id: folderIds[index]
}));
- }, [folderId, dbContext?.sqliteClient]);
- // Don't render anything if no breadcrumbs
- if (breadcrumbs.length === 0) {
+ /*
+ * If we're on the folder view page for this folder, exclude it from breadcrumbs
+ * (it's already shown as the page title)
+ */
+ const currentFolderPath = `/items/folder/${folderId}`;
+ if (location.pathname === currentFolderPath && fullPath.length > 0) {
+ return fullPath.slice(0, -1); // Remove last item (current folder)
+ }
+
+ return fullPath;
+ }, [folderId, dbContext?.sqliteClient, location.pathname]);
+
+ /*
+ * Check if we're currently on the root items page.
+ * Match both /items and /items/ (with or without trailing slash)
+ */
+ const isOnRootPage = location.pathname === '/items' || location.pathname === '/items/';
+
+ /*
+ * Don't render anything if:
+ * - No breadcrumbs AND we're on the root page (would just show redundant "Items")
+ */
+ if (breadcrumbs.length === 0 && isOnRootPage) {
return null;
}
@@ -67,32 +90,42 @@ const FolderBreadcrumb: React.FC<FolderBreadcrumbProps> = ({
return (
<div className="mb-3 flex items-center gap-1 text-sm text-gray-600 dark:text-gray-400 overflow-x-auto">
- <button
- onClick={() => navigate(rootPath)}
- className="hover:text-orange-600 dark:hover:text-orange-400 transition-colors flex-shrink-0"
- >
- {rootLabelText}
- </button>
- {breadcrumbs.map((crumb, index) => (
- <React.Fragment key={crumb.id}>
- <svg className="w-4 h-4 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <polyline points="9 6 15 12 9 18" />
+ {isOnRootPage ? (
+ <span className="text-gray-900 dark:text-white font-medium flex-shrink-0 flex items-center gap-1">
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
+ </svg>
+ {rootLabelText}
+ </span>
+ ) : (
+ <button
+ onClick={() => navigate(rootPath)}
+ className="hover:text-orange-600 dark:hover:text-orange-400 transition-colors flex-shrink-0 flex items-center gap-1"
+ >
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
</svg>
- {index < breadcrumbs.length - 1 ? (
+ {rootLabelText}
+ </button>
+ )}
+ {breadcrumbs.map((crumb) => {
+ const crumbPath = `/items/folder/${crumb.id}`;
+
+ return (
+ <React.Fragment key={crumb.id}>
+ <svg className="w-4 h-4 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <polyline points="9 6 15 12 9 18" />
+ </svg>
<button
- onClick={() => navigate(`/items/folder/${crumb.id}`)}
+ onClick={() => navigate(crumbPath)}
className="hover:text-orange-600 dark:hover:text-orange-400 transition-colors truncate"
title={crumb.name}
>
{crumb.name}
</button>
- ) : (
- <span className="text-gray-900 dark:text-white font-medium truncate" title={crumb.name}>
- {crumb.name}
- </span>
- )}
- </React.Fragment>
- ))}
+ </React.Fragment>
+ );
+ })}
</div>
);
};
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemDetails.tsx b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemDetails.tsx
index 1bc7a8e52..d7a3d246c 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/items/ItemDetails.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/items/ItemDetails.tsx
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate, useParams } from 'react-router-dom';
+import FolderBreadcrumb from '@/entrypoints/popup/components/Folders/FolderBreadcrumb';
import HeaderButton from '@/entrypoints/popup/components/HeaderButton';
import { HeaderIconType } from '@/entrypoints/popup/components/Icons/HeaderIcons';
import {
@@ -118,6 +119,9 @@ const ItemDetails: React.FC = (): React.ReactElement => {
return (
<div className="space-y-4">
+ {/* Folder breadcrumb navigation */}
+ <FolderBreadcrumb folderId={item.FolderId} />
+
{/* Header with name, logo, and URLs */}
<div className="flex justify-between items-start">
<div className="flex items-start gap-3">