import { t } from '@grafana/i18n';
import { Button, Icon } from '@grafana/ui';

import { type ToolbarActionProps } from '../types';

export const EditSchemaV2Button = ({ dashboard }: ToolbarActionProps) => {
  return (
    <Button
      size="sm"
      variant="secondary"
      tooltip={t('dashboard.toolbar.new.edit-dashboard-v2-schema.tooltip', 'Edit dashboard v2 schema')}
      icon={<Icon name="brackets-curly" size="lg" type="default" />}
      onClick={() => dashboard.state.editPane.openPane('code')}
    />
  );
};
