From 1b6f186ab51ecfbed125f08408c7a33a65ad8e35 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Wed, 3 Dec 2025 20:12:15 +0545 Subject: [PATCH 1/4] feat(view): Collapsible section --- src/pages/views/components/SingleView.tsx | 8 +- src/pages/views/components/ViewSection.tsx | 89 ++++++++++++++-------- 2 files changed, 61 insertions(+), 36 deletions(-) diff --git a/src/pages/views/components/SingleView.tsx b/src/pages/views/components/SingleView.tsx index c6dce2fb1..470ea946f 100644 --- a/src/pages/views/components/SingleView.tsx +++ b/src/pages/views/components/SingleView.tsx @@ -163,7 +163,7 @@ const SingleView: React.FC = ({ id }) => { // Render the main view through ViewSection to reuse its spacing/scroll styling; // rendering the raw View here caused padding/overflow glitches alongside sections. const primaryViewSection = { - title: "", + title: title || name, viewRef: { namespace: namespace || "", name: name @@ -185,7 +185,7 @@ const SingleView: React.FC = ({ id }) => { ) } > -
+
{/* Render aggregated variables once at the top */} {aggregatedVariables && aggregatedVariables.length > 0 && ( = ({ id }) => {
)} -
+
= ({ id }) => { {viewResult.sections.map((section) => (
diff --git a/src/pages/views/components/ViewSection.tsx b/src/pages/views/components/ViewSection.tsx index 4c3d8067e..81fea3fc6 100644 --- a/src/pages/views/components/ViewSection.tsx +++ b/src/pages/views/components/ViewSection.tsx @@ -1,5 +1,6 @@ -import React from "react"; +import React, { useState } from "react"; import { useQuery } from "@tanstack/react-query"; +import { IoChevronDownOutline } from "react-icons/io5"; import { getViewDataByNamespace } from "../../../api/services/views"; import View from "../../audit-report/components/View/View"; import { Icon } from "../../../ui/Icons/Icon"; @@ -16,6 +17,7 @@ const ViewSection: React.FC = ({ section, hideVariables }) => { + const [isExpanded, setIsExpanded] = useState(true); const { namespace, name } = section.viewRef; // Use prefixed search params for view variables @@ -37,50 +39,73 @@ const ViewSection: React.FC = ({ staleTime: 5 * 60 * 1000 }); - if (isLoading) { - return ( -
-
-
-
- ); - } - if (error || !sectionViewResult) { return ( <> -
+
setIsExpanded(!isExpanded)} + > + {section.icon && ( - + )} -

{section.title}

-
-
- {error instanceof Error ? error.message : "Failed to load section"} +

+ {section.title} +

+ {isExpanded && ( +
+ {error instanceof Error ? error.message : "Failed to load section"} +
+ )} ); } return ( <> -
- {section.icon && } -

{section.title}

+
setIsExpanded(!isExpanded)} + > + + {section.icon && ( + + )} +

{section.title}

- + {isExpanded && + (isLoading ? ( +
+
+
+
+ ) : ( + + ))} ); }; From 87cb15af881531c54651edc099aa9c7b9e17c513 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Wed, 3 Dec 2025 22:36:33 +0545 Subject: [PATCH 2/4] fix: Add keyboard accessibility to clickable headers --- src/pages/views/components/ViewSection.tsx | 67 +++++++++++++++------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/src/pages/views/components/ViewSection.tsx b/src/pages/views/components/ViewSection.tsx index 81fea3fc6..df7fb6096 100644 --- a/src/pages/views/components/ViewSection.tsx +++ b/src/pages/views/components/ViewSection.tsx @@ -39,12 +39,25 @@ const ViewSection: React.FC = ({ staleTime: 5 * 60 * 1000 }); + const handleHeaderKeyDown = (event: React.KeyboardEvent) => { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + setIsExpanded(!isExpanded); + } + }; + if (error || !sectionViewResult) { + const errorContentId = `section-${namespace}-${name}-error`; return ( <>
setIsExpanded(!isExpanded)} + onKeyDown={handleHeaderKeyDown} > = ({
{isExpanded && ( -
+
{error instanceof Error ? error.message : "Failed to load section"}
)} @@ -68,11 +81,18 @@ const ViewSection: React.FC = ({ ); } + const contentId = `section-${namespace}-${name}`; + return ( <>
setIsExpanded(!isExpanded)} + onKeyDown={handleHeaderKeyDown} > = ({ )}

{section.title}

- {isExpanded && - (isLoading ? ( -
-
-
-
- ) : ( - - ))} + {isExpanded && ( +
+ {isLoading ? ( +
+
+
+
+ ) : ( + + )} +
+ )} ); }; From efb101236d58f026a48a44c1069aa61474011d64 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Thu, 4 Dec 2025 13:24:44 +0545 Subject: [PATCH 3/4] fix: Prevent error message during initial load in ViewSection --- src/pages/views/components/ViewSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/views/components/ViewSection.tsx b/src/pages/views/components/ViewSection.tsx index df7fb6096..a60dcd3d8 100644 --- a/src/pages/views/components/ViewSection.tsx +++ b/src/pages/views/components/ViewSection.tsx @@ -46,7 +46,7 @@ const ViewSection: React.FC = ({ } }; - if (error || !sectionViewResult) { + if (error || (!isLoading && !sectionViewResult)) { const errorContentId = `section-${namespace}-${name}-error`; return ( <> From 3592ab42448e28e8fbde41fa9d2777d9c13e52aa Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Thu, 4 Dec 2025 13:42:34 +0545 Subject: [PATCH 4/4] fix: margin top for templating variable filter --- src/pages/audit-report/components/View/GlobalFilters.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/audit-report/components/View/GlobalFilters.tsx b/src/pages/audit-report/components/View/GlobalFilters.tsx index 15d89af1a..ade1a7875 100644 --- a/src/pages/audit-report/components/View/GlobalFilters.tsx +++ b/src/pages/audit-report/components/View/GlobalFilters.tsx @@ -72,7 +72,7 @@ const GlobalFilters: React.FC = ({ variables }) => { } return ( -
+
{filterComponents}