From 85d845215f0f057e7334e9573161e3fb054f5e7a Mon Sep 17 00:00:00 2001 From: Advitya Gemawat Date: Wed, 24 Jan 2024 09:56:34 -0500 Subject: [PATCH] new file component refactor --- .../Controls/DetectionDetails.tsx | 51 +++++++++++++++++++ .../Controls/FlyoutObjectDetection.tsx | 3 +- .../Controls/FlyoutObjectDetectionUtils.tsx | 43 ---------------- 3 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/DetectionDetails.tsx diff --git a/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/DetectionDetails.tsx b/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/DetectionDetails.tsx new file mode 100644 index 0000000000..13e095c479 --- /dev/null +++ b/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/DetectionDetails.tsx @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Stack, Text } from "@fluentui/react"; +import { IVisionListItem } from "@responsible-ai/core-ui"; +import { localization } from "@responsible-ai/localization"; +import React from "react"; + +import { stackTokens } from "./FlyoutObjectDetectionUtils"; + +interface IDetectionDetailsProps { + item: IVisionListItem; // replace with actual type + correctDetections: string; + incorrectDetections: string; + } + export class DetectionDetails extends React.Component { + public render(): React.ReactNode { + return ( + + + + + {localization.InterpretVision.Dashboard.indexLabel} + {this.props.item?.index} + + + + + {localization.InterpretVision.Dashboard.correctDetections} + {this.props.correctDetections} + + + + + {localization.InterpretVision.Dashboard.incorrectDetections} + {this.props.incorrectDetections} + + + + ); + } + } \ No newline at end of file diff --git a/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetection.tsx b/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetection.tsx index 35a950b7e2..4ac826c0ed 100644 --- a/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetection.tsx +++ b/libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetection.tsx @@ -20,6 +20,7 @@ import { FluentUIStyles } from "@responsible-ai/core-ui"; import { localization } from "@responsible-ai/localization"; import * as React from "react"; import { CanvasTools } from "vott-ct"; +import { DetectionDetails } from "./DetectionDetails"; import * as FlyoutStyles from "../utils/FlyoutUtils"; import { getObjectDetectionImageAltText } from "../utils/getAltTextUtils"; @@ -123,7 +124,7 @@ export class FlyoutObjectDetection extends React.Component< verticalAlign="center" > - { - public render(): React.ReactNode { - return ( - - - - - {localization.InterpretVision.Dashboard.indexLabel} - {this.props.item?.index} - - - - - {localization.InterpretVision.Dashboard.correctDetections} - {this.props.correctDetections} - - - - - {localization.InterpretVision.Dashboard.incorrectDetections} - {this.props.incorrectDetections} - - - - ); - } -} - export class ColorLegend extends React.Component { public render(): React.ReactNode { return (