All files / src/widget EC3Provider.tsx

36.36% Statements 4/11
0% Branches 0/4
0% Functions 0/2
36.36% Lines 4/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35          4x 4x 4x             4x                                        
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
import type { UiItemsProvider, Widget } from "@itwin/appui-react";
import { StagePanelLocation, StagePanelSection, StageUsage } from "@itwin/appui-react";
import React from "react";
import { EC3WidgetComponent } from "../components/EC3WidgetComponent";
import type { EC3WidgetProps } from "../components/EC3WidgetProps";
 
/**
 * EC3 Widget UI Provider
 * @beta
 */
export class EC3Provider implements UiItemsProvider {
  public readonly id = "EC3Provider";
 
  constructor(private readonly _props: EC3WidgetProps) {}
 
  public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): ReadonlyArray<Widget> {
    const widgets: Widget[] = [];
    Iif (location === StagePanelLocation.Left && section === StagePanelSection.Start && stageUsage === StageUsage.General) {
      const newEC3Widget: Widget = {
        id: "EC3Widget",
        label: "EC3",
        content: <EC3WidgetComponent {...this._props} />,
      };
 
      widgets.push(newEC3Widget);
    }
 
    return widgets;
  }
}