11import React , { useEffect , useState } from "react" ;
2- import { Box , Button , ButtonBase , styled , Typography , TypographyProps } from "@mui/material" ;
3- import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos" ;
2+ import { Box , Button , styled , Typography , TypographyProps } from "@mui/material" ;
43import EditIcon from "@mui/icons-material/Edit" ;
54import ImportExportIcon from "@mui/icons-material/ImportExport" ;
65import {
@@ -12,6 +11,7 @@ import {
1211 StableTypography ,
1312} from "./WSEditorTheme" ;
1413import ArgumentPropsReviewer from "./ArgumentPropsReviewer" ;
14+ import ArgNavBar , { type ArgIdx } from "./argument/ArgNavBar" ;
1515import type { CMDArg , ClsArgDefinitionMap } from "./WSEditorCommandArgumentsContent" ;
1616
1717interface CMDArgBase {
@@ -51,11 +51,6 @@ interface CMDNumberArg extends CMDArg {
5151 } ;
5252}
5353
54- interface ArgIdx {
55- var : string ;
56- displayKey : string ;
57- }
58-
5954interface ArgumentNavigationProps {
6055 commandUrl : string ;
6156 args : CMDArg [ ] ;
@@ -66,29 +61,13 @@ interface ArgumentNavigationProps {
6661 onAddSubcommand : ( arg : CMDArg , argIdxStack : ArgIdx [ ] ) => void ;
6762}
6863
69- interface ArgNavBarProps {
70- argIdxStack : ArgIdx [ ] ;
71- onChangeArgIdStack : ( end : number ) => void ;
72- }
73-
7464interface ArgumentReviewerProps {
7565 arg : CMDArg ;
7666 depth : number ;
7767 onEdit : ( ) => void ;
7868 onUnwrap : ( ) => void ;
7969}
8070
81- const NavBarItemTypography = styled ( Typography ) < TypographyProps > ( ( { theme } ) => ( {
82- color : theme . palette . primary . main ,
83- fontFamily : "'Work Sans', sans-serif" ,
84- fontSize : 14 ,
85- fontWeight : 400 ,
86- } ) ) ;
87-
88- const NavBarItemHightLightedTypography = styled ( NavBarItemTypography ) < TypographyProps > ( ( ) => ( {
89- color : "#5d64cf" ,
90- } ) ) ;
91-
9271const ArgNameTypography = styled ( Typography ) < TypographyProps > ( ( { theme } ) => ( {
9372 color : theme . palette . primary . main ,
9473 fontFamily : "'Roboto Condensed', sans-serif" ,
@@ -174,58 +153,6 @@ const spliceArgOptionsString = (arg: CMDArg, depth: number) => {
174153 return optionsString ;
175154} ;
176155
177- const ArgNavBar : React . FC < ArgNavBarProps > = ( { argIdxStack, onChangeArgIdStack } ) => {
178- return (
179- < React . Fragment >
180- < Box
181- sx = { {
182- flexGrow : 1 ,
183- display : "flex" ,
184- flexDirection : "row" ,
185- alignItems : "center" ,
186- justifyContent : "flex-start" ,
187- mt : 1 ,
188- mb : 0.5 ,
189- mr : 2 ,
190- } }
191- >
192- < ButtonBase
193- key = "Back"
194- onClick = { ( ) => {
195- onChangeArgIdStack ( 0 ) ;
196- } }
197- >
198- < ArrowBackIosIcon sx = { { fontSize : 14 } } />
199- </ ButtonBase >
200- { argIdxStack . slice ( 0 , - 1 ) . map ( ( argIdx : ArgIdx , index : number ) => (
201- < ButtonBase
202- key = { `${ index } ` }
203- onClick = { ( ) => {
204- onChangeArgIdStack ( index + 1 ) ;
205- } }
206- >
207- < NavBarItemTypography sx = { { flexShrink : 0 } } >
208- { index > 0 ? `.${ argIdx . displayKey } ` : argIdx . displayKey }
209- </ NavBarItemTypography >
210- </ ButtonBase >
211- ) ) }
212- < ButtonBase
213- key = { `${ argIdxStack . length - 1 } ` }
214- onClick = { ( ) => {
215- onChangeArgIdStack ( argIdxStack . length ) ;
216- } }
217- >
218- < NavBarItemHightLightedTypography sx = { { flexShrink : 0 } } >
219- { argIdxStack . length > 1
220- ? `.${ argIdxStack [ argIdxStack . length - 1 ] . displayKey } `
221- : argIdxStack [ argIdxStack . length - 1 ] . displayKey }
222- </ NavBarItemHightLightedTypography >
223- </ ButtonBase >
224- </ Box >
225- </ React . Fragment >
226- ) ;
227- } ;
228-
229156const ArgumentReviewer : React . FC < ArgumentReviewerProps > = ( { arg, depth, onEdit, onUnwrap } ) => {
230157 const [ choices , setChoices ] = useState < string [ ] > ( [ ] ) ;
231158
@@ -612,4 +539,4 @@ const ArgumentNavigation: React.FC<ArgumentNavigationProps> = ({
612539} ;
613540
614541export default ArgumentNavigation ;
615- export type { ArgumentNavigationProps , ArgIdx , ArgumentReviewerProps , ArgNavBarProps } ;
542+ export type { ArgumentNavigationProps , ArgumentReviewerProps } ;
0 commit comments