import React from 'react';
import { Observable } from 'rxjs';
import { Fill } from '@workbench-stack/components';

interface Props {
  history: any;
  location: any;
  panelView: any;
  repoName?: string;
  isLightTheme: boolean;
  fetchHighlightedFileLines: (
    ctx: any,
    force?: boolean,
  ) => Observable<string[]>;
}

export const PanelView = (props: Props) => {
  return (
    <Fill name={props.panelView.id}>
      {!props.panelView.content ? null : (
        <div className="panel_view__slot">{props.panelView.content}</div>
      )}
      {props.panelView.reactElement}
      {!props.panelView.content &&
        !props.panelView.reactElement &&
        !props.panelView.locationProvider &&
        null}
    </Fill>
  );
};
