import { AvGadget, AvPanel, AvStandardGrabbable, AvTransform, HighlightType, DefaultLanding, GrabbableStyle, renderAardvarkRoot } from '@aardvarkxr/aardvark-react'; import { EAction, EHand, g_builtinModelBox, InitialInterfaceLock, Av } from '@aardvarkxr/aardvark-shared'; import bind from 'bind-decorator'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { ImageAdder } from './imageadder'; import * as IPFS from 'ipfs'; class MenuItem extends React.Component< {displayImage, onClick}, {}> //class for items on the menu, basically just a button { constructor(props) { super(props); } public render() { return( ); } } interface ImageMenuState { imageUrls: string[]; } class ImageMenu extends React.Component< {}, ImageMenuState> //class for the whole menu, basically just renders MenuItems according to list of images { imageToDisplay: string; constructor(props) { super(props); this.state = { imageUrls: [], } this.imageToDisplay = ""; } @bind public onAddImage( url: string ) { this.setState( { imageUrls: [ ...this.state.imageUrls, url] } ); } @bind public validateUrl(url:string) { return(url && !this.state.imageUrls.includes(url) ? true : false) } public displayImage(image: string) //given to buttons, by setting the image to display we stop drawing the menu and start drawing the image, remove image undoes this, we also force an update here since we dont use state { this.imageToDisplay = image; this.forceUpdate(); } public removeImage() { this.imageToDisplay = null; this.forceUpdate(); } public render() { if (this.imageToDisplay){ //if theres an image then show that, and also a back button return(