From e8e6bd2e13b4e74969a3f2e21507d4867d489d50 Mon Sep 17 00:00:00 2001 From: lfjnascimento Date: Tue, 26 Nov 2024 19:10:05 -0300 Subject: [PATCH] fix: remove unused accordionData type currently the AccordionBuildContent component is only being used in BuildTable, so the accordionData property no longer needs to support TPathTests --- .../Tabs/Build/BuildAccordionContent.tsx | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/dashboard/src/pages/TreeDetails/Tabs/Build/BuildAccordionContent.tsx b/dashboard/src/pages/TreeDetails/Tabs/Build/BuildAccordionContent.tsx index 31e79457..51a5899f 100644 --- a/dashboard/src/pages/TreeDetails/Tabs/Build/BuildAccordionContent.tsx +++ b/dashboard/src/pages/TreeDetails/Tabs/Build/BuildAccordionContent.tsx @@ -23,8 +23,6 @@ import { Button } from '@/components/ui/button'; import QuerySwitcher from '@/components/QuerySwitcher/QuerySwitcher'; -import type { TPathTests } from '@/types/general'; - export interface IBuildAccordionContent { testStatus: { failTests: number; @@ -116,7 +114,7 @@ const AccordBuildStatusChart = ({ }; export interface IAccordionItems { - accordionData: AccordionItemBuilds | TPathTests; + accordionData: AccordionItemBuilds; onClickShowBuild: (buildId: AccordionItemBuilds['id']) => void; openLogSheet?: () => void; } @@ -126,45 +124,42 @@ const AccordionBuildContent = ({ onClickShowBuild, openLogSheet, }: IAccordionItems): JSX.Element => { - //TODO: Fix the typing for not using as - const contentData = accordionData as AccordionItemBuilds; - const { data, status } = useBuildStatusCount( - { buildId: contentData.id ?? '' }, - { enabled: !!contentData.id }, + { buildId: accordionData.id ?? '' }, + { enabled: !!accordionData.id }, ); const onClickShowBuildHandler = useCallback( - () => onClickShowBuild(contentData.id), - [contentData.id, onClickShowBuild], + () => onClickShowBuild(accordionData.id), + [accordionData.id, onClickShowBuild], ); const links: ILinkGroup['links'] = useMemo( () => [ - contentData.kernelImage + accordionData.kernelImage ? { title: 'buildAccordion.kernelImage', icon: , - linkText: {`kernel/${contentData.kernelImage}`}, + linkText: {`kernel/${accordionData.kernelImage}`}, } : undefined, - contentData.kernelConfig + accordionData.kernelConfig ? { title: 'buildAccordion.kernelConfig', icon: , - link: contentData.kernelConfig, + link: accordionData.kernelConfig, linkText: , } : undefined, - contentData.dtb + accordionData.dtb ? { title: 'buildAccordion.dtb', icon: , - link: contentData.dtb, + link: accordionData.dtb, linkText: , } : undefined, - contentData.buildLogs + accordionData.buildLogs ? { title: 'buildAccordion.buildLogs', icon: , @@ -172,30 +167,30 @@ const AccordionBuildContent = ({ onClick: openLogSheet, } : undefined, - contentData.systemMap + accordionData.systemMap ? { title: 'buildAccordion.systemMap', icon: , - link: contentData.systemMap, + link: accordionData.systemMap, linkText: , } : undefined, - contentData.modules + accordionData.modules ? { title: 'buildAccordion.modules', icon: , - link: contentData.modules, + link: accordionData.modules, linkText: , } : undefined, ], [ - contentData.buildLogs, - contentData.dtb, - contentData.kernelConfig, - contentData.kernelImage, - contentData.modules, - contentData.systemMap, + accordionData.buildLogs, + accordionData.dtb, + accordionData.kernelConfig, + accordionData.kernelImage, + accordionData.modules, + accordionData.systemMap, openLogSheet, ], );