@@ -3,6 +3,13 @@ import { ScriptData, Activity, Step } from '../types';
33import { TreeView } from './TreeView' ;
44import { BaySelector } from './BaySelector' ;
55import { LocationSelector } from './LocationSelector' ;
6+ import {
7+ LoadScriptButton ,
8+ DownloadButton ,
9+ CloneSelectedButton ,
10+ AddActivityButton ,
11+ AddStepButton
12+ } from './buttons' ;
613
714interface Bay {
815 id : string ;
@@ -113,23 +120,8 @@ export const Sidebar: React.FC<SidebarProps> = ({
113120 < div className = "file-operations-section" >
114121 < h3 className = "section-title" > File Operations</ h3 >
115122 < div className = "file-buttons" >
116- < button className = "tree-btn load-btn" onClick = { onLoadScript } >
117- < svg width = "16" height = "16" viewBox = "0 0 24 24" fill = "currentColor" >
118- < path d = "M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" />
119- </ svg >
120- Load Script
121- </ button >
122- < button
123- className = "tree-btn download-btn"
124- disabled = { ! isValid }
125- onClick = { onDownloadScript }
126- title = { ! isValid ? "Fix validation errors before downloading" : "Download script" }
127- >
128- < svg width = "16" height = "16" viewBox = "0 0 24 24" fill = "currentColor" >
129- < path d = "M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z" />
130- </ svg >
131- Download
132- </ button >
123+ < LoadScriptButton onClick = { onLoadScript } />
124+ < DownloadButton isValid = { isValid } onClick = { onDownloadScript } />
133125 </ div >
134126 </ div >
135127
@@ -168,36 +160,16 @@ export const Sidebar: React.FC<SidebarProps> = ({
168160 < div className = "edit-operations-section" >
169161 < h3 className = "section-title" > Edit Operations</ h3 >
170162 < div className = "edit-buttons" >
171- < button
172- className = "tree-btn"
173- disabled = { ! selectedNode || ! isValid }
174- onClick = { onCloneSelected }
175- >
176- < svg width = "16" height = "16" viewBox = "0 0 24 24" fill = "currentColor" >
177- < path d = "M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" />
178- </ svg >
179- Clone Selected
180- </ button >
181- < button className = "tree-btn" onClick = { onShowActivityDialog } >
182- < svg width = "16" height = "16" viewBox = "0 0 24 24" fill = "currentColor" >
183- < path d = "M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20M11,15H13V17H15V15H17V13H15V11H13V13H11V15Z" />
184- </ svg >
185- Add Activity
186- </ button >
187- < button
188- className = "tree-btn"
189- disabled = { ! parentActivityForAdd }
190- onClick = { ( ) => {
191- if ( parentActivityForAdd ) {
192- onShowStepDialog ( ) ;
193- }
194- } }
195- >
196- < svg width = "16" height = "16" viewBox = "0 0 24 24" fill = "currentColor" >
197- < path d = "M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
198- </ svg >
199- Add Step
200- </ button >
163+ < CloneSelectedButton
164+ selectedNode = { selectedNode }
165+ isValid = { isValid }
166+ onClick = { onCloneSelected }
167+ />
168+ < AddActivityButton onClick = { onShowActivityDialog } />
169+ < AddStepButton
170+ parentActivityForAdd = { parentActivityForAdd }
171+ onShowStepDialog = { onShowStepDialog }
172+ />
201173 </ div >
202174 </ div >
203175 < TreeView
0 commit comments