import React from 'react';
import { useSettingsPageContext } from '../../providers';
import { observer } from 'mobx-react-lite';
import { MoreActionsElement } from '../MoreActions';
import { FormPageActionsBar } from '../FormPage';

interface SettingsPageActionsBarProps {
  moreActions?: MoreActionsElement;
}

export function _SettingsPageActionsBar(props: SettingsPageActionsBarProps) {
  const state = useSettingsPageContext();

  return (
    <FormPageActionsBar
      onCancel={state.onCancel.bind(state)}
      onSave={state.handleSubmit.bind(state)}
      {...props}
    />
  );
}

export const SettingsPageActionsBar = observer(_SettingsPageActionsBar);
