import ReactOnRails from 'react-on-rails';

import UserSearchBar from '../bundles/Main/components/UserSearchBar';
import { UserMenu } from '../bundles/Main/components/UserMenu';
import { PostHoverPreviewWrapper } from '../bundles/Main/components/PostHoverPreviewWrapper';
import { UserHoverPreviewWrapper } from '../bundles/Main/components/UserHoverPreviewWrapper';
import { TrackedObjectsChart } from '../bundles/Main/components/TrackedObjectsChart';
import { initCollapsibleSections } from '../bundles/UI/collapsibleSections';
import { IpAddressInput } from '../bundles/UI/components';

// This is how react_on_rails can see the components in the browser.
ReactOnRails.register({
  UserSearchBar,
  UserMenu,
  PostHoverPreviewWrapper,
  UserHoverPreviewWrapper,
  TrackedObjectsChart,
  IpAddressInput,
});

// Initialize collapsible sections
document.addEventListener('DOMContentLoaded', function () {
  initCollapsibleSections();
});
