Skip to content

Commit bfdacf3

Browse files
authored
fix(ui): reposition compliance card export menu (#10933)
1 parent adc1dbf commit bfdacf3

5 files changed

Lines changed: 50 additions & 36 deletions

File tree

ui/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to the **Prowler UI** are documented in this file.
44

5+
## [1.25.1] (Prowler v5.25.1)
6+
7+
### 🐞 Fixed
8+
9+
- Compliance page export menu now scales on small screens, and frameworks load on first render without requiring a manual scan re-selection [(#10918)](https://github.com/prowler-cloud/prowler/pull/10918)
10+
11+
---
12+
513
## [1.25.0] (Prowler v5.25.0)
614

715
### 🚀 Added

ui/app/(prowler)/compliance/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export default async function Compliance({
166166
>
167167
<SSRComplianceGrid
168168
searchParams={resolvedSearchParams}
169+
scanId={selectedScanId}
169170
selectedScan={selectedScanData}
170171
/>
171172
</Suspense>
@@ -179,12 +180,13 @@ export default async function Compliance({
179180

180181
const SSRComplianceGrid = async ({
181182
searchParams,
183+
scanId,
182184
selectedScan,
183185
}: {
184186
searchParams: SearchParamsProps;
187+
scanId: string | null;
185188
selectedScan?: ScanEntity;
186189
}) => {
187-
const scanId = searchParams.scanId?.toString() || "";
188190
const regionFilter = searchParams["filter[region__in]"]?.toString() || "";
189191

190192
// Only fetch compliance data if we have a valid scanId
@@ -247,7 +249,7 @@ const SSRComplianceGrid = async ({
247249
<ComplianceOverviewPanel>
248250
<ComplianceOverviewGrid
249251
frameworks={frameworks}
250-
scanId={scanId}
252+
scanId={scanId ?? ""}
251253
selectedScan={selectedScan}
252254
latestCisIds={latestCisIds}
253255
/>

ui/components/compliance/compliance-card.tsx

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,50 +89,50 @@ export const ComplianceCard: React.FC<ComplianceCardProps> = ({
8989
<Card
9090
variant="base"
9191
padding="md"
92-
className="cursor-pointer transition-shadow hover:shadow-md"
92+
className="relative cursor-pointer transition-shadow hover:shadow-md"
9393
onClick={navigateToDetail}
9494
>
95+
<div
96+
className="absolute top-2 right-2 z-10"
97+
onClick={(e) => e.stopPropagation()}
98+
onKeyDown={(e) => {
99+
if (e.key === "Enter" || e.key === " ") {
100+
e.stopPropagation();
101+
}
102+
}}
103+
role="group"
104+
tabIndex={0}
105+
>
106+
<ComplianceDownloadContainer
107+
compact
108+
orientation="column"
109+
buttonWidth="icon"
110+
presentation="dropdown"
111+
scanId={scanId}
112+
complianceId={complianceId}
113+
reportType={getReportTypeForCompliance(
114+
title,
115+
complianceId,
116+
isLatestCisForProvider,
117+
)}
118+
disabled={hasRegionFilter}
119+
/>
120+
</div>
95121
<CardContent className="p-0">
96122
<div className="flex w-full flex-col gap-3 sm:flex-row sm:items-start">
97-
<div className="flex shrink-0 items-center justify-between sm:flex-col sm:items-start sm:gap-2">
123+
<div className="flex shrink-0 items-center sm:flex-col sm:items-start sm:gap-2">
98124
{getComplianceIcon(title) && (
99125
<Image
100126
src={getComplianceIcon(title)}
101127
alt={`${title} logo`}
102128
className="h-10 w-10 min-w-10 self-start rounded-md border border-gray-300 bg-white object-contain p-1"
103129
/>
104130
)}
105-
<div
106-
className="shrink-0"
107-
onClick={(e) => e.stopPropagation()}
108-
onKeyDown={(e) => {
109-
if (e.key === "Enter" || e.key === " ") {
110-
e.stopPropagation();
111-
}
112-
}}
113-
role="group"
114-
tabIndex={0}
115-
>
116-
<ComplianceDownloadContainer
117-
compact
118-
orientation="column"
119-
buttonWidth="icon"
120-
presentation="dropdown"
121-
scanId={scanId}
122-
complianceId={complianceId}
123-
reportType={getReportTypeForCompliance(
124-
title,
125-
complianceId,
126-
isLatestCisForProvider,
127-
)}
128-
disabled={hasRegionFilter}
129-
/>
130-
</div>
131131
</div>
132132
<div className="flex w-full min-w-0 flex-col gap-3">
133133
<Tooltip>
134134
<TooltipTrigger asChild>
135-
<h4 className="text-small truncate leading-5 font-bold">
135+
<h4 className="text-small truncate pr-9 leading-5 font-bold">
136136
{formatTitle(title)}
137137
{version ? ` - ${version}` : ""}
138138
</h4>

ui/components/compliance/compliance-download-container.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe("ComplianceDownloadContainer", () => {
7070
const trigger = screen.getByRole("button", {
7171
name: "Open compliance export actions",
7272
});
73-
expect(trigger.className).toContain("border-text-neutral-secondary");
73+
expect(trigger.className).toContain("rounded-md");
7474
});
7575

7676
it("should open export actions from the compact trigger", async () => {

ui/components/shadcn/dropdown/action-dropdown.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ import {
1515

1616
const ACTION_TRIGGER_STYLES = {
1717
table: "hover:bg-bg-neutral-tertiary rounded-full p-1 transition-colors",
18-
bordered:
19-
"hover:bg-bg-neutral-tertiary rounded-full border border-text-neutral-secondary p-2 transition-colors",
18+
bordered: "hover:bg-bg-neutral-tertiary rounded-md p-1.5 transition-colors",
2019
} as const;
2120

2221
type ActionDropdownVariant = keyof typeof ACTION_TRIGGER_STYLES;
2322

2423
interface ActionDropdownProps {
2524
/** The dropdown trigger element. Defaults to a vertical dots icon button */
2625
trigger?: ReactNode;
27-
/** Trigger style variant. "table" = no border, "bordered" = circular border */
26+
/** Trigger style variant. "table" = compact pill, "bordered" = card action */
2827
variant?: ActionDropdownVariant;
2928
/** Alignment of the dropdown content */
3029
align?: "start" | "center" | "end";
@@ -62,7 +61,12 @@ export function ActionDropdown({
6261
aria-label={ariaLabel}
6362
className={ACTION_TRIGGER_STYLES[variant]}
6463
>
65-
<EllipsisVertical className="text-text-neutral-secondary size-6" />
64+
<EllipsisVertical
65+
className={cn(
66+
"text-text-neutral-secondary",
67+
variant === "bordered" ? "size-5" : "size-6",
68+
)}
69+
/>
6670
</button>
6771
)}
6872
</DropdownMenuTrigger>

0 commit comments

Comments
 (0)