Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Advitya17 committed Jan 23, 2024
1 parent b712aac commit cd5a501
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
Separator,
Spinner,
Stack,
Text,
getTheme
Text
} from "@fluentui/react";
import { FluentUIStyles } from "@responsible-ai/core-ui";
import { localization } from "@responsible-ai/localization";
Expand Down Expand Up @@ -101,7 +100,6 @@ export class FlyoutObjectDetection extends React.Component<
odIncorrect,
item.index
);
const theme = getTheme();
return (
<FocusZone>
<Panel
Expand Down Expand Up @@ -155,32 +153,7 @@ export class FlyoutObjectDetection extends React.Component<
/>
</Stack.Item>
</Stack>
<Stack horizontal tokens={FlyoutODUtils.stackTokens.large}>
<Stack horizontal tokens={FlyoutODUtils.stackTokens.medium}>
<Text variant="medium">
{localization.InterpretVision.Dashboard.trueY}
</Text>
<div
style={{
backgroundColor: theme.palette.green,
height: 20,
width: 20
}}
/>
</Stack>
<Stack horizontal tokens={FlyoutODUtils.stackTokens.medium}>
<Text variant="medium">
{localization.InterpretVision.Dashboard.predictedY}
</Text>
<div
style={{
backgroundColor: theme.palette.magenta,
height: 20,
width: 20
}}
/>
</Stack>
</Stack>
<FlyoutODUtils.ColorLegend />
<Stack>
<Stack.Item className={classNames.imageContainer}>
<Stack.Item id="canvasToolsDiv">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export const stackTokens = {
medium: { childrenGap: "l1" }
};

const theme = getTheme();

export class DetectionDetails extends React.Component<IDetectionDetailsProps> {
public render(): React.ReactNode {
return (
Expand Down Expand Up @@ -76,6 +78,39 @@ export class DetectionDetails extends React.Component<IDetectionDetailsProps> {
}
}

export class ColorLegend extends React.Component {

Check failure on line 81 in libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetectionUtils.tsx

View workflow job for this annotation

GitHub Actions / ci-typescript (12.x)

Declare only one React component per file

Check failure on line 81 in libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetectionUtils.tsx

View workflow job for this annotation

GitHub Actions / ci-typescript (14.x)

Declare only one React component per file

Check failure on line 81 in libs/interpret-vision/src/lib/VisionExplanationDashboard/Controls/FlyoutObjectDetectionUtils.tsx

View workflow job for this annotation

GitHub Actions / ci-typescript (16.x)

Declare only one React component per file
public render(): React.ReactNode {
return (
<Stack horizontal tokens={stackTokens.large}>
<Stack horizontal tokens={stackTokens.medium}>
<Text variant="medium">
{localization.InterpretVision.Dashboard.trueY}
</Text>
<div
style={{
backgroundColor: theme.palette.green,
height: 20,
width: 20
}}
/>
</Stack>
<Stack horizontal tokens={stackTokens.medium}>
<Text variant="medium">
{localization.InterpretVision.Dashboard.predictedY}
</Text>
<div
style={{
backgroundColor: theme.palette.magenta,
height: 20,
width: 20
}}
/>
</Stack>
</Stack>
);
}
}

export const ExcessLabelLen =
localization.InterpretVision.Dashboard.prefix.length;

Expand Down Expand Up @@ -154,8 +189,6 @@ export function drawBoundingBoxes(
return;
}

const theme = getTheme();

// Ensuring object detection labels are populated
if (
!dataset.object_detection_predicted_y ||
Expand Down

0 comments on commit cd5a501

Please sign in to comment.