EditorToolbar.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { ArrowLeft, Braces, Bug, CheckCircle2, Save } from "lucide-react";
  2. import { Link } from "react-router-dom";
  3. import { Button } from "@/components/ui/button";
  4. export function EditorToolbar({
  5. dirty,
  6. showJson,
  7. onShowJson,
  8. onSave,
  9. onValidate,
  10. onDebug,
  11. busy,
  12. }: {
  13. dirty: boolean;
  14. showJson: boolean;
  15. busy?: boolean;
  16. onShowJson: () => void;
  17. onSave: () => void;
  18. onValidate: () => void;
  19. onDebug: () => void;
  20. }) {
  21. return (
  22. <div className="flex flex-wrap items-center justify-between gap-3 border-b border-border bg-surface-elevated p-3">
  23. <div className="flex items-center gap-2">
  24. <Link to="/workflows" className="inline-flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground hover:bg-muted">
  25. <ArrowLeft className="h-4 w-4" />
  26. </Link>
  27. <span className="text-sm text-muted-foreground">{dirty ? "Unsaved changes" : "Saved"}</span>
  28. </div>
  29. <div className="flex flex-wrap gap-2">
  30. <Button variant="outline" onClick={onShowJson}>
  31. <Braces className="h-4 w-4" /> {showJson ? "Hide JSON" : "JSON"}
  32. </Button>
  33. <Button variant="outline" disabled={busy} onClick={onValidate}>
  34. <CheckCircle2 className="h-4 w-4" /> Validate
  35. </Button>
  36. <Button variant="outline" disabled={busy} onClick={onDebug}>
  37. <Bug className="h-4 w-4" /> Debug
  38. </Button>
  39. <Button disabled={busy} onClick={onSave}>
  40. <Save className="h-4 w-4" /> {busy ? "Working..." : "Save"}
  41. </Button>
  42. </div>
  43. </div>
  44. );
  45. }