Skip to content

Commit

Permalink
fixed lint and type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rakeshsh committed Aug 5, 2024
1 parent 65c6027 commit f5ac4a1
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/DetailsView/components/command-bar-buttons-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ import { NamedFC } from 'common/react/named-fc';
import { StartOverMenuItem } from 'DetailsView/components/start-over-component-factory';
import * as React from 'react';
import styles from './command-bar-buttons-menu.scss';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';

export type CommandBarButtonsMenuProps = {
renderExportReportButton: () => JSX.Element | null;
saveAssessmentButton?: JSX.Element | null;
loadAssessmentButton?: JSX.Element | null;
transferToAssessmentButton?: JSX.Element | null;
getStartOverMenuItem: () => StartOverMenuItem;
buttonRef?: React.RefObject<HTMLButtonElement>;
//buttonRef?: () => React.RefObject<HTMLButtonElement> | null;
buttonRef?: MyFunctionType;
hasSubMenu?: boolean;
};

export const CommandBarButtonsMenu = NamedFC<CommandBarButtonsMenuProps>(
Expand Down
4 changes: 3 additions & 1 deletion src/DetailsView/components/details-view-command-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export type TransferToAssessmentButtonFactory = (
props: TransferToAssessmentButtonProps,
) => JSX.Element | null;

export type MyFunctionType = (ref: any) => void;
export interface DetailsViewCommandBarProps {
deps: DetailsViewCommandBarDeps;
tabStoreData: TabStoreData;
Expand Down Expand Up @@ -214,7 +215,8 @@ export class DetailsViewCommandBar extends React.Component<
this.exportDialogCloseFocus = ref ?? undefined;
this.startOverDialogCloseFocus = ref ?? undefined;
this.transferToAssessmentDialogCloseFocus = ref ?? undefined;
}}
}
}
/>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/DetailsView/components/report-export-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import { InsightsCommandButton } from 'common/components/controls/insights-comma
import { FluentUIV9Icon } from 'common/icons/fluentui-v9-icons';
import { NamedFC } from 'common/react/named-fc';
import { useCommandButtonStyle } from 'DetailsView/components/command-button-styles';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';
import * as React from 'react';

export interface ReportExportButtonProps {
showReportExportDialog: () => void;
buttonRef?: React.RefObject<HTMLButtonElement>;
buttonRef?: MyFunctionType;
}

export const reportExportButtonAutomationId = 'report-export-button';
Expand Down
3 changes: 2 additions & 1 deletion src/DetailsView/components/start-over-component-factory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from 'DetailsView/components/start-over-dropdown';
import * as React from 'react';
import styles from './start-over-menu-item.scss';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';

export type StartOverFactoryDeps = {
detailsViewActionMessageCreator: DetailsViewActionMessageCreator;
Expand All @@ -28,7 +29,7 @@ export type StartOverFactoryProps = {
rightPanelConfiguration: DetailsRightPanelConfiguration;
visualizationStoreData: VisualizationStoreData;
openDialog: (dialogType: StartOverDialogType) => void;
buttonRef: React.RefObject<HTMLButtonElement>;
buttonRef: MyFunctionType;
hasSubMenu?: boolean;
};

Expand Down
5 changes: 3 additions & 2 deletions src/DetailsView/components/start-over-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useStartOverDropdownStyles } from 'DetailsView/components/start-over-dr
import * as React from 'react';

import { StartOverContextMenuKeyOptions } from './details-view-right-panel';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';

export type StartOverDropdownMenuItems = MenuItemProps & {
name: string;
Expand All @@ -32,7 +33,7 @@ export interface StartOverProps {
singleTestSuffix: string;
dropdownDirection: DropdownDirection;
openDialog: (dialogType: StartOverDialogType) => void;
buttonRef: React.RefObject<HTMLButtonElement>;
buttonRef: MyFunctionType;
allTestSuffix: string;
rightPanelOptions: StartOverContextMenuKeyOptions;
switcherStartOverPreferences: StartOverContextMenuKeyOptions;
Expand Down Expand Up @@ -103,7 +104,7 @@ export const StartOverDropdown: React.FC<StartOverProps> = props => {
icon={
<FluentUIV9Icon
iconName="ArrowClockwiseRegular"
// customClass={stylesValue.chevronIcon}
// customClass={stylesValue.chevronIcon}
/>
}
aria-label="start over menu"
Expand Down
3 changes: 2 additions & 1 deletion src/DetailsView/components/transfer-to-assessment-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InsightsCommandButton } from 'common/components/controls/insights-comma
import { FluentUIV9Icon } from 'common/icons/fluentui-v9-icons';
import { NamedFC } from 'common/react/named-fc';
import { useCommandButtonStyle } from 'DetailsView/components/command-button-styles';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';
import { DataTransferViewController } from 'DetailsView/data-transfer-view-controller';
import * as React from 'react';

Expand All @@ -13,7 +14,7 @@ export type TransferToAssessmentButtonDeps = {
};
export interface TransferToAssessmentButtonProps {
deps: TransferToAssessmentButtonDeps;
buttonRef?: React.RefObject<HTMLInputElement>;
buttonRef?: MyFunctionType;
}

export const transferToAssessmentButtonAutomationId = 'transfer-to-assessment-button';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export interface CardFooterInstanceActionButtonsProps {

export const CardFooterInstanceActionButtons = props => {
const toastRef = React.useRef(null);
const fileIssueButtonRef = React.useRef(null);
const kebabButtonRef = React.useRef(null);
const fileIssueButtonRef: any = React.useRef(null);
const kebabButtonRef: any = React.useRef(null);

const focusButtonAfterDialogClosed = (): void => {
if (props?.narrowModeStatus?.isCardFooterCollapsed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import { CreateIssueDetailsTextData } from 'common/types/create-issue-details-te
import { ToolData } from 'common/types/store-data/unified-data-interface';
import { UserConfigurationStoreData } from 'common/types/store-data/user-configuration-store';
import { DetailsViewActionMessageCreator } from 'DetailsView/actions/details-view-action-message-creator';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';
import { IssueFilingServiceProvider } from 'issue-filing/issue-filing-service-provider';
import React from 'react';

export type CardFooterMenuItem = IContextualMenuItem & IButtonProps;

export type CardFooterMenuItemsProps = {
fileIssueButtonRef: React.RefObject<HTMLButtonElement> &
fileIssueButtonRef: MyFunctionType &
React.RefObject<IContextualMenuRenderItem>;
toastRef: React.RefObject<Toast>;
issueDetailsData: CreateIssueDetailsTextData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ describe('CommandBarButtonsMenu', () => {
loadAssessmentButton: <>Load assessment button</>,
transferToAssessmentButton: <>Transfer to assessment button</>,
getStartOverMenuItem: getStartOverMenuItemMock.object,
buttonRef: {
current: {},
},
buttonRef: {} as any,
hasSubMenu: false,
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
mockReactComponents,
getMockComponentClassPropsForCall,
} from '../../../mock-helpers/mock-module-helpers';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';

jest.mock('common/components/controls/insights-command-button');

Expand All @@ -24,7 +25,7 @@ describe(ReportExportButton.displayName, () => {
showDialogMock = jest.fn();
props = {
showReportExportDialog: showDialogMock,
buttonRef: {} as React.RefObject<HTMLButtonElement>,
buttonRef: {} as MyFunctionType,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ChevronDownRegular,
} from '@fluentui/react-icons';
import { fireEvent, render } from '@testing-library/react';
import { MyFunctionType } from 'DetailsView/components/details-view-command-bar';
import { StartOverContextMenuKeyOptions } from 'DetailsView/components/details-view-right-panel';
import { StartOverDialogType } from 'DetailsView/components/start-over-dialog';
import { StartOverDropdown, StartOverProps } from 'DetailsView/components/start-over-dropdown';
Expand Down Expand Up @@ -61,7 +62,7 @@ describe('StartOverDropdownTest', () => {
switcherStartOverPreferences: { showTest: true },
dropdownDirection: 'down',
openDialog: openDialogMock.object,
buttonRef: {} as React.RefObject<HTMLButtonElement>,
buttonRef: {} as MyFunctionType,
};
});

Expand Down Expand Up @@ -97,7 +98,7 @@ describe('StartOverDropdownTest user interaction', () => {
switcherStartOverPreferences: { showTest: true },
dropdownDirection: 'down',
openDialog: openDialogMock.object,
buttonRef: {} as React.RefObject<HTMLButtonElement>,
buttonRef: {} as MyFunctionType,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { IMock, It, Mock, MockBehavior, Times } from 'typemoq';
describe(CardFooterMenuItemsBuilder, () => {
let props: CardFooterMenuItemsProps;
let deps: CardFooterMenuItemsDeps;
const fileIssueButtonRef = () => null;
const fileIssueButtonRef = {} as any;
const issueDetailsData = { snippet: 'test snipper' } as CreateIssueDetailsTextData;
const userConfigurationStoreData = {
bugService: 'test-bug-service',
Expand Down

0 comments on commit f5ac4a1

Please sign in to comment.