Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: manage access button placement

varonixeaca8ceaa72a
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index a06ce43df7..931fa3cd84 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -84,6 +84,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
+ IconButton,
Pagination,
Sheet,
SheetContent,
@@ -2747,6 +2748,22 @@ const OverviewPageContent = () => {
<div className="flex flex-col gap-3 overflow-hidden dashboard:flex-row dashboard:items-center">
<div className="flex flex-1 items-center gap-x-3 overflow-hidden whitespace-nowrap dashboard:mr-auto">
<div className="flex shrink-0 items-center gap-2">
+ {canManageCurrentFolderAccess && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Manage Access"
+ className="relative"
+ size="md"
+ variant="outline"
+ onClick={handleCurrentFolderAccessOpen}
+ >
+ <UsersIcon />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>Manage Access</TooltipContent>
+ </Tooltip>
+ )}
<EnvironmentSelect
selectedEnvs={filteredEnvs}
setSelectedEnvs={setFilteredEnvs}
@@ -2756,25 +2773,7 @@ const OverviewPageContent = () => {
}
/>
</div>
- <FolderBreadcrumb secretPath={secretPath}>
- {canManageCurrentFolderAccess && (
- <>
- <Divider orientation="vertical" className="mx-1 h-4 shrink-0" />
- <Button
- className="group h-fit shrink-0 p-1 text-muted transition-colors hover:text-foreground"
- variant="ghost"
- size="sm"
- aria-label="Manage Access"
- onClick={handleCurrentFolderAccessOpen}
- >
- <div className="flex items-center gap-2 text-mineshaft-100/80 transition-all group-hover:text-mineshaft-50">
- <UsersIcon className="size-4" />
- Manage Access
- </div>
- </Button>
- </>
- )}
- </FolderBreadcrumb>
+ <FolderBreadcrumb secretPath={secretPath} />
</div>
<div className="flex flex-wrap items-center gap-3">
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/FolderBreadcrumb/FolderBreadcrumb.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/FolderBreadcrumb/FolderBreadcrumb.tsx
index d87a74943e..53405a8dea 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/FolderBreadcrumb/FolderBreadcrumb.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/FolderBreadcrumb/FolderBreadcrumb.tsx
@@ -23,8 +23,6 @@ import { useTimedReset } from "@app/hooks";
type Props = {
secretPath?: string;
- // Rendered inline after the copy button; measured so the path collapses before it collides.
- children?: React.ReactNode;
};
type Measurements = {
@@ -33,21 +31,18 @@ type Measurements = {
ellipsisWidth: number;
folderIconWidth: number;
separatorWidth: number;
- trailingWidth: number;
};
-export function FolderBreadcrumb({ secretPath = "", children }: Props) {
+export function FolderBreadcrumb({ secretPath = "" }: Props) {
const containerRef = useRef<HTMLDivElement>(null);
const measureContainerRef = useRef<HTMLDivElement>(null);
- const trailingRef = useRef<HTMLDivElement>(null);
const [measurements, setMeasurements] = useState<Measurements>({
containerWidth: 0,
segmentWidths: [],
ellipsisWidth: 0,
folderIconWidth: 0,
- separatorWidth: 0,
- trailingWidth: 0
+ separatorWidth: 0
});
const folderPaths = useMemo(() => (secretPath || "").split("/").filter(Boolean), [secretPath]);
@@ -74,7 +69,6 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
const segments = measureContainer.querySelectorAll("[data-measure='segment']");
const segmentWidths = Array.from(segments).map((el) => el.getBoundingClientRect().width);
- const trailingWidth = trailingRef.current?.getBoundingClientRect().width ?? 0;
setMeasurements((prev) => {
// Only update if values changed to prevent unnecessary re-renders
@@ -83,8 +77,7 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
segmentWidths,
ellipsisWidth: ellipsis?.getBoundingClientRect().width ?? 0,
folderIconWidth: folderIcon?.getBoundingClientRect().width ?? 0,
- separatorWidth: separator?.getBoundingClientRect().width ?? 0,
- trailingWidth
+ separatorWidth: separator?.getBoundingClientRect().width ?? 0
};
if (
@@ -92,7 +85,6 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
prev.ellipsisWidth === newMeasurements.ellipsisWidth &&
prev.folderIconWidth === newMeasurements.folderIconWidth &&
prev.separatorWidth === newMeasurements.separatorWidth &&
- prev.trailingWidth === newMeasurements.trailingWidth &&
prev.segmentWidths.length === newMeasurements.segmentWidths.length &&
prev.segmentWidths.every((w, i) => w === newMeasurements.segmentWidths[i])
) {
@@ -117,9 +109,6 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
measureElements();
});
observer.observe(element);
- // The trailing actions are optional and permission-gated, so the reserved footprint
- // changes after mount; without watching it the path collapses at the wrong point.
- if (trailingRef.current) observer.observe(trailingRef.current);
return () => {
observer.disconnect();
};
@@ -127,14 +116,8 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
// Calculate visible segments based on actual measurements
const { startCount, endCount, needsEllipsis } = useMemo(() => {
- const {
- containerWidth,
- segmentWidths,
- ellipsisWidth,
- folderIconWidth,
- separatorWidth,
- trailingWidth
- } = measurements;
+ const { containerWidth, segmentWidths, ellipsisWidth, folderIconWidth, separatorWidth } =
+ measurements;
// Before measurements are ready, show minimal state to prevent overflow
if (segmentWidths.length === 0 || containerWidth === 0) {
@@ -151,11 +134,12 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
(sum, w) => sum + w + separatorWidth + GAP * 2,
0
);
- // The trailing group (copy button plus any caller-supplied actions) is a non-shrinking
- // sibling after the breadcrumb, so the path has to collapse before it reaches that group.
- // Its width is measured rather than assumed, because it depends on the caller's actions.
- const trailingReserve = trailingWidth > 0 ? trailingWidth + GAP : 0;
- const availableWidth = containerWidth - folderIconWidth - GAP - trailingReserve;
+ // The copy-path button is a fixed-width sibling after the breadcrumb; subtract its
+ // footprint so the path collapses before it would collide with the button.
+ // v3 IconButton size="xs" => h-7 w-7 = 28px (border-box); GAP covers the gap before it.
+ const COPY_BUTTON_WIDTH = 28;
+ const copyButtonReserve = folderPaths.length > 0 ? COPY_BUTTON_WIDTH + GAP : 0;
+ const availableWidth = containerWidth - folderIconWidth - GAP - copyButtonReserve;
// If everything fits, show all
if (totalSegmentWidth <= availableWidth) {
@@ -380,33 +364,30 @@ export function FolderBreadcrumb({ secretPath = "", children }: Props) {
</BreadcrumbList>
</Breadcrumb>
- {/* Trailing actions (pinned outside the clip flow so they're always visible) */}
- <div ref={trailingRef} className="flex shrink-0 items-center gap-1">
- {folderPaths.length > 0 && (
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost-muted"
- size="xs"
- className="shrink-0"
- aria-label="Copy folder path"
- onClick={async () => {
- try {
- await navigator.clipboard.writeText(fullPath);
- setIsCopied(true);
- } catch {
- // clipboard unavailable (denied or insecure context); keep the un-copied state
- }
- }}
- >
- {isCopied ? <Check /> : <Copy />}
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>{isCopied ? "Copied" : "Copy path"}</TooltipContent>
- </Tooltip>
- )}
- {children}
- </div>
+ {/* Copy current folder path (pinned outside the clip flow so it's always visible) */}
+ {folderPaths.length > 0 && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ variant="ghost-muted"
+ size="xs"
+ className="shrink-0"
+ aria-label="Copy folder path"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(fullPath);
+ setIsCopied(true);
+ } catch {
+ // clipboard unavailable (denied or insecure context); keep the un-copied state
+ }
+ }}
+ >
+ {isCopied ? <Check /> : <Copy />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{isCopied ? "Copied" : "Copy path"}</TooltipContent>
+ </Tooltip>
+ )}
</div>
);
}