import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import React from 'react';
import { AnalyticsContext } from '@atlaskit/analytics-next';
import { Stack } from '@atlaskit/primitives/compiled';
import { messages } from '../../../../messages';
import RelatedLinksList from '../../components/related-links-list';
var RelatedLinksResolvedView = function RelatedLinksResolvedView(_ref) {
  var _ref$incomingLinks = _ref.incomingLinks,
    incomingLinks = _ref$incomingLinks === void 0 ? [] : _ref$incomingLinks,
    _ref$outgoingLinks = _ref.outgoingLinks,
    outgoingLinks = _ref$outgoingLinks === void 0 ? [] : _ref$outgoingLinks;
  var _React$useState = React.useState(''),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    selected = _React$useState2[0],
    setSelected = _React$useState2[1];
  var handleSelectedUpdate = function handleSelectedUpdate(selectedKey) {
    setSelected(selectedKey);
  };
  return /*#__PURE__*/React.createElement(Stack, {
    space: "space.150"
  }, /*#__PURE__*/React.createElement(AnalyticsContext, {
    data: {
      component: 'relatedLinksIncoming'
    }
  }, /*#__PURE__*/React.createElement(RelatedLinksList, {
    urls: incomingLinks,
    title: messages.related_links_found_in,
    testId: "incoming-related-links-list",
    selected: selected,
    handleSelectedUpdate: handleSelectedUpdate
  })), /*#__PURE__*/React.createElement(AnalyticsContext, {
    data: {
      component: 'relatedLinksOutgoing'
    }
  }, /*#__PURE__*/React.createElement(RelatedLinksList, {
    urls: outgoingLinks,
    title: messages.related_links_includes_links_to,
    testId: "outgoing-related-links-list",
    selected: selected,
    handleSelectedUpdate: handleSelectedUpdate
  })));
};
export default RelatedLinksResolvedView;