<commit_before>import React, {useRef, useEffect} from 'react';
import cx from 'classnames';
import 'stockflux-components';
import { WindowHooks, Constants } from 'openfin-react-hooks';
import {
  FaChevronUp,
  FaChevronLeft,
  FaChevronRight,
  FaRegHandRock
} from 'react-icons/fa';
import AppShortcuts from './app-shortcuts/AppShortcuts';
import FreeTextSearch from './free-text-search/FreeTextSearch';
import ToolBar from './toolbar/ToolBar';
import CloseButton from './toolbar/CloseButton';
import './App.css';

const isLauncherHorizontal = (edge) => {
  return edge === Constants.ScreenEdge.TOP;
}

export default () => {
  const [edge, windowActions] = WindowHooks.useDockWindow(Constants.ScreenEdge.TOP, window.fin.Window.getCurrentSync(),
      true, { dockedWidth: 50, dockedHeight: 50 });

  const prevEdgeRef = useRef();
      useEffect(() => {
        prevEdgeRef.current = edge;
  });
  const prevEdge = prevEdgeRef.current;    

  return (
    <div className={cx('app', edge === Constants.ScreenEdge.NONE ? prevEdge : edge)} >
      {!isLauncherHorizontal(edge === Constants.ScreenEdge.NONE ? prevEdge : edge) && CloseButton}
      <AppShortcuts />
      <FreeTextSearch dockedTo={edge} />
      <ToolBar
        tools={[
          {
            label: <FaChevronUp />,
            onClick: windowActions.dockTop,
            disabled: edge === Constants.ScreenEdge.TOP
          },
          {
            label: <FaChevronLeft />,
            onClick: windowActions.dockLeft,
            disabled: edge === Constants.ScreenEdge.LEFT
          },
          {
            label: <FaChevronRight />,
            onClick: windowActions.dockRight,
            disabled: edge === Constants.ScreenEdge.RIGHT
          },
          {
            label: <FaRegHandRock />,
            className: 'drag-handle',
          }
        ]}
      />
      {isLauncherHorizontal(edge === Constants.ScreenEdge.NONE ? prevEdge : edge) && CloseButton}
    </div>
  );
};<commit_msg>PR refactor<commit_after>import React, {useRef, useEffect} from 'react';
import cx from 'classnames';
import 'stockflux-components';
import { WindowHooks, Constants } from 'openfin-react-hooks';
import {
  FaChevronUp,
  FaChevronLeft,
  FaChevronRight,
  FaRegHandRock
} from 'react-icons/fa';
import AppShortcuts from './app-shortcuts/AppShortcuts';
import FreeTextSearch from './free-text-search/FreeTextSearch';
import ToolBar from './toolbar/ToolBar';
import CloseButton from './toolbar/CloseButton';
import './App.css';

const isLauncherHorizontal = edge => edge === Constants.ScreenEdge.TOP;

export default () => {
  const [edge, windowActions] = WindowHooks.useDockWindow(Constants.ScreenEdge.TOP, window.fin.Window.getCurrentSync(),
      true, { dockedWidth: 50, dockedHeight: 50 });

  const prevEdgeRef = useRef();
  useEffect(() => {
    prevEdgeRef.current = edge;
  });
  const prevEdge = prevEdgeRef.current;    

  const edgeToBeChecked = edge === Constants.ScreenEdge.NONE ? prevEdge : edge;

  return (
    <div className={cx('app', edgeToBeChecked)} >
      {!isLauncherHorizontal(edgeToBeChecked) && CloseButton}
      <AppShortcuts />
      <FreeTextSearch dockedTo={edge} />
      <ToolBar
        tools={[
          {
            label: <FaChevronUp />,
            onClick: windowActions.dockTop,
            disabled: edge === Constants.ScreenEdge.TOP
          },
          {
            label: <FaChevronLeft />,
            onClick: windowActions.dockLeft,
            disabled: edge === Constants.ScreenEdge.LEFT
          },
          {
            label: <FaChevronRight />,
            onClick: windowActions.dockRight,
            disabled: edge === Constants.ScreenEdge.RIGHT
          },
          {
            label: <FaRegHandRock />,
            className: 'drag-handle',
          }
        ]}
      />
      {isLauncherHorizontal(edgeToBeChecked) && CloseButton}
    </div>
  );
};
{'fraction_non_alphanumeric': 0.1291314373558801, 'fraction_numerical': 0.0020497053548552396, 'mean_word_length': 2.6148148148148147, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5805858', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1141, 'n_words': 231}