@ -13,6 +13,7 @@ import { calculateScrollCenter, getTargetElement } from "../scene";
import { SelectedShapeActions , ShapesSwitcher } from "./Actions" ;
import { Section } from "./Section" ;
import { RoomDialog } from "./RoomDialog" ;
import { SCROLLBAR_WIDTH , SCROLLBAR_MARGIN } from "../scene/scrollbars" ;
type MobileMenuProps = {
appState : AppState ;
@ -37,45 +38,6 @@ export function MobileMenu({
} : MobileMenuProps ) {
return (
< >
{ appState . openMenu === "canvas" ? (
< Section className = "App-mobile-menu" heading = "canvasActions" >
< div className = "App-mobile-menu-scroller panelColumn" >
< Stack.Col gap = { 4 } >
{ actionManager . renderAction ( "loadScene" ) }
{ actionManager . renderAction ( "saveScene" ) }
{ exportButton }
{ actionManager . renderAction ( "clearCanvas" ) }
< RoomDialog
isCollaborating = { appState . isCollaborating }
collaboratorCount = { appState . collaborators . size }
onRoomCreate = { onRoomCreate }
onRoomDestroy = { onRoomDestroy }
/ >
{ actionManager . renderAction ( "changeViewBackgroundColor" ) }
< fieldset >
< legend > { t ( "labels.language" ) } < / legend >
< LanguageList
onChange = { lng = > {
setLanguage ( lng ) ;
setAppState ( { } ) ;
} }
/ >
< / fieldset >
< / Stack.Col >
< / div >
< / Section >
) : appState . openMenu === "shape" &&
showSelectedShapeActions ( appState , elements ) ? (
< Section className = "App-mobile-menu" heading = "selectedShapeActions" >
< div className = "App-mobile-menu-scroller" >
< SelectedShapeActions
targetElements = { getTargetElement ( elements , appState ) }
renderAction = { actionManager . renderAction }
elementType = { appState . elementType }
/ >
< / div >
< / Section >
) : null }
< FixedSideContainer side = "top" >
< Section heading = "shapes" >
{ heading = > (
@ -98,26 +60,74 @@ export function MobileMenu({
< / Section >
< HintViewer appState = { appState } elements = { elements } / >
< / FixedSideContainer >
< footer className = "App-toolbar" >
< div className = "App-toolbar-content" >
{ actionManager . renderAction ( "toggleCanvasMenu" ) }
{ actionManager . renderAction ( "toggleEditMenu" ) }
{ actionManager . renderAction ( "undo" ) }
{ actionManager . renderAction ( "redo" ) }
{ actionManager . renderAction ( "finalize" ) }
{ actionManager . renderAction ( "deleteSelectedElements" ) }
< / div >
{ appState . scrolledOutside && (
< button
className = "scroll-back-to-content"
onClick = { ( ) = > {
setAppState ( { . . . calculateScrollCenter ( elements ) } ) ;
} }
>
{ t ( "buttons.scrollBackToContent" ) }
< / button >
) }
< / footer >
< div
className = "App-bottom-bar"
style = { {
marginBottom : SCROLLBAR_WIDTH + SCROLLBAR_MARGIN * 2 ,
marginLeft : SCROLLBAR_WIDTH + SCROLLBAR_MARGIN * 2 ,
marginRight : SCROLLBAR_WIDTH + SCROLLBAR_MARGIN * 2 ,
} }
>
< Island padding = { 3 } >
{ appState . openMenu === "canvas" ? (
< Section className = "App-mobile-menu" heading = "canvasActions" >
< div className = "panelColumn" >
< Stack.Col gap = { 4 } >
{ actionManager . renderAction ( "loadScene" ) }
{ actionManager . renderAction ( "saveScene" ) }
{ exportButton }
{ actionManager . renderAction ( "clearCanvas" ) }
< RoomDialog
isCollaborating = { appState . isCollaborating }
collaboratorCount = { appState . collaborators . size }
onRoomCreate = { onRoomCreate }
onRoomDestroy = { onRoomDestroy }
/ >
{ actionManager . renderAction ( "changeViewBackgroundColor" ) }
< fieldset >
< legend > { t ( "labels.language" ) } < / legend >
< LanguageList
onChange = { lng = > {
setLanguage ( lng ) ;
setAppState ( { } ) ;
} }
/ >
< / fieldset >
< / Stack.Col >
< / div >
< / Section >
) : appState . openMenu === "shape" &&
showSelectedShapeActions ( appState , elements ) ? (
< Section className = "App-mobile-menu" heading = "selectedShapeActions" >
< SelectedShapeActions
targetElements = { getTargetElement ( elements , appState ) }
renderAction = { actionManager . renderAction }
elementType = { appState . elementType }
/ >
< / Section >
) : null }
< footer className = "App-toolbar" >
< div className = "App-toolbar-content" >
{ actionManager . renderAction ( "toggleCanvasMenu" ) }
{ actionManager . renderAction ( "toggleEditMenu" ) }
{ actionManager . renderAction ( "undo" ) }
{ actionManager . renderAction ( "redo" ) }
{ actionManager . renderAction ( "finalize" ) }
{ actionManager . renderAction ( "deleteSelectedElements" ) }
< / div >
{ appState . scrolledOutside && (
< button
className = "scroll-back-to-content"
onClick = { ( ) = > {
setAppState ( { . . . calculateScrollCenter ( elements ) } ) ;
} }
>
{ t ( "buttons.scrollBackToContent" ) }
< / button >
) }
< / footer >
< / Island >
< / div >
< / >
) ;
}