diff --git a/src/metamath/ui/MM_cmp_user_stmt.res b/src/metamath/ui/MM_cmp_user_stmt.res index 3c390edc..0b21ceca 100644 --- a/src/metamath/ui/MM_cmp_user_stmt.res +++ b/src/metamath/ui/MM_cmp_user_stmt.res @@ -21,10 +21,11 @@ let rndIconButton = ( ~active:bool=true, ~title:option=?, ~color:option=Some("primary"), + ~key:option=?, () ) => { - onClick()} ?color> icon + onClick()} ?color> icon } @@ -830,6 +831,12 @@ let make = React.memoCustomCompareProps( ({ setState(setNewText(_, newText)) } + let actJstfEditRequested = () => { + if (stmt.typ == P) { + onJstfEditRequested() + } + } + let before = (str:string, pos:int):string => str->Js.String2.substring(~from=0,~to_=pos) let after = (str:string, pos:int):string => str->Js.String2.substringToEnd(~from=pos+1) @@ -1310,8 +1317,8 @@ let make = React.memoCustomCompareProps( ({ && stmt.proofTreeDto->Belt.Option.isSome && stmt.src->Belt.Option.isSome - let rndJstf = (~rndDeleteButton:bool, ~textFieldWidth:string):reElem => { - if (stmt.jstfEditMode) { + let rndJstf = (~isInline:bool, ~textFieldWidth:string):reElem => { + if (stmt.jstfEditMode && stmt.typ == P) { } else { - let jstfText = if (stmt.jstfText == "") { " " } else { stmt.jstfText } - let padding = if (jstfText->Js_string2.trim == "") { "10px 30px" } else { "1px" } + let jstfText = if (stmt.typ == E) { "HYP" } else { stmt.jstfText } + let padding = if (jstfText->Js_string2.trim == "") { "11px 15px" } else { "1px" } Belt.Int.toString ++ "px"}, + ~marginTop=stmtPartMarginTop, () ) alignItems=#center > { - if (jstfText->Js_string2.trim == "" || !rndDeleteButton) { + if (isInline) { } else { - - { - rndIconButton(~icon=, + let btns = [] + if (jstfText->Js_string2.trim != "") { + btns->Js.Array2.push( + rndIconButton(~icon=, ~key="d", ~onClick=actJstfDeleted, ~title="Delete justification", ~color=None, () ) - } - { - rndIconButton(~icon=, - ~onClick=actToggleInfoExpanded, ~title="Hide justification", ~color=None, () + )->ignore + } + btns->Js.Array2.push( + rndIconButton(~icon=, ~key="h", + ~onClick=actToggleInfoExpanded, ~title="Hide justification", ~color=None, () + ) + )->ignore + if (visualizationIsAvailable) { + btns->Js.Array2.push( + rndIconButton( + ~icon=, + ~key="v", + ~onClick=actToggleVisExpanded, ~title="Show/Hide visualization", ~color=None, () ) - } - { - if (visualizationIsAvailable) { - rndIconButton( - ~icon=, - ~onClick=actToggleVisExpanded, ~title="Show/Hide visualization", ~color=None, () - ) - } else { - React.null - } - } + )->ignore + } + + { btns->React.array } } } @@ -1420,7 +1430,7 @@ let make = React.memoCustomCompareProps( ({ None } else { let jstf = if (!viewOptions.showJstf && (state.infoExpanded || stmt.jstfEditMode)) { - Some(rndJstf(~rndDeleteButton=true, ~textFieldWidth="600px")) + Some(rndJstf(~isInline=false, ~textFieldWidth="600px")) } else { None } @@ -1549,7 +1559,7 @@ let make = React.memoCustomCompareProps( ({ let rndJstfTd = (tdStyle) => { if (viewOptions.showJstf) { - {rndJstf(~rndDeleteButton=false, ~textFieldWidth="150px")} + {rndJstf(~isInline=true, ~textFieldWidth="150px")} } else { React.null } @@ -1557,7 +1567,7 @@ let make = React.memoCustomCompareProps( ({ let rndJstfRow = () => { if (viewOptions.showJstf) { - rndJstf(~rndDeleteButton=false, ~textFieldWidth="150px") + rndJstf(~isInline=true, ~textFieldWidth="150px") } else { }