File size: 2,661 Bytes
693b4bc
 
 
 
74435d2
693b4bc
 
 
 
 
74435d2
693b4bc
74435d2
693b4bc
 
 
74435d2
693b4bc
74435d2
 
693b4bc
 
74435d2
 
693b4bc
 
 
 
74435d2
693b4bc
74435d2
 
693b4bc
 
74435d2
 
693b4bc
 
 
 
74435d2
693b4bc
74435d2
 
693b4bc
 
74435d2
 
693b4bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React, { useState } from 'react';
import EditorTab from './EditorTab.jsx';
import MagazineTab from './MagazineTab.jsx';
import JogTab from './JogTab.jsx';
import { FileCode, Wrench, Compass } from 'lucide-react';

export default function ControlSidebar(props) {
  const [activeTab, setActiveTab] = useState('editor'); // 'editor' | 'tools' | 'jog'

  return (
    <aside className="w-full lg:w-[520px] xl:w-[580px] bg-slate-900 border-l border-slate-800 flex flex-col h-[560px] lg:h-full z-20 shrink-0 shadow-2xl">
      {/* TABS HEADER */}
      <div className="flex border-b border-slate-800 bg-slate-950/80 p-1.5 gap-1 shrink-0">
        <button
          type="button"
          onClick={() => setActiveTab('editor')}
          className={`flex-1 py-1.5 px-2 text-xs font-semibold rounded-lg transition-all flex items-center justify-center gap-1.5 ${
            activeTab === 'editor'
              ? 'bg-blue-600 text-white shadow-sm font-bold'
              : 'text-slate-400 hover:text-slate-200 hover:bg-slate-850'
          }`}
        >
          <FileCode size={14} />
          <span>Editor & Projetos</span>
        </button>
        <button
          type="button"
          onClick={() => setActiveTab('tools')}
          className={`flex-1 py-1.5 px-2 text-xs font-semibold rounded-lg transition-all flex items-center justify-center gap-1.5 ${
            activeTab === 'tools'
              ? 'bg-blue-600 text-white shadow-sm font-bold'
              : 'text-slate-400 hover:text-slate-200 hover:bg-slate-850'
          }`}
        >
          <Wrench size={14} />
          <span>Magazine (M06)</span>
        </button>
        <button
          type="button"
          onClick={() => setActiveTab('jog')}
          className={`flex-1 py-1.5 px-2 text-xs font-semibold rounded-lg transition-all flex items-center justify-center gap-1.5 ${
            activeTab === 'jog'
              ? 'bg-blue-600 text-white shadow-sm font-bold'
              : 'text-slate-400 hover:text-slate-200 hover:bg-slate-850'
          }`}
        >
          <Compass size={14} />
          <span>JOG Manual</span>
        </button>
      </div>

      {/* ACTIVE TAB CONTENT */}
      {activeTab === 'editor' && <EditorTab {...props} />}
      {activeTab === 'tools' && (
        <MagazineTab
          activeToolNumber={props.toolNumber}
          onSelectTool={props.onSelectTool}
        />
      )}
      {activeTab === 'jog' && (
        <JogTab
          onJog={props.onJog}
          onJogHome={props.onJogHome}
          spindleState={props.spindleState}
          onToggleSpindle={props.onToggleSpindle}
        />
      )}
    </aside>
  );
}