Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.1 KB
Raw Blame
import { t } from 'i18next';
import { PanelBottom, PanelRight } from 'lucide-react';

import { useBuilderStateContext } from '@/app/builder/builder-hooks';
import { Button } from '@/components/ui/button';

type StepDataPanelViewToggleProps = {
  disabled?: boolean;
  className?: string;
};

const StepDataPanelViewToggle = ({
  disabled = false,
  className,
}: StepDataPanelViewToggleProps) => {
  const [stepDataPanelView, setStepDataPanelView] = useBuilderStateContext(
    (state) => [state.stepDataPanelView, state.setStepDataPanelView],
  );

  const isSplit = stepDataPanelView === 'split';
  const ToggleIcon = isSplit ? PanelBottom : PanelRight;
  const toggleLabel = isSplit ? t('Bottom Panel') : t('Side by Side');

  return (
    <Button
      type="button"
      variant="ghost"
      size="sm"
      onClick={() => setStepDataPanelView(isSplit ? 'drawer' : 'split')}
      disabled={disabled}
      className={className}
      aria-label={toggleLabel}
    >
      <ToggleIcon className="size-4" />
      <span>{toggleLabel}</span>
    </Button>
  );
};

StepDataPanelViewToggle.displayName = 'StepDataPanelViewToggle';
export { StepDataPanelViewToggle };