Refactor(Execute): Support mobile mode
This commit is contained in:
@@ -16,9 +16,12 @@ const Execute = () => {
|
|||||||
const { id } = useParams()
|
const { id } = useParams()
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [compiledCode, setCompiledCode] = useState('')
|
const [compiledCode, setCompiledCode] = useState('')
|
||||||
|
const [isMobileMode, setIsMobileMode] = useState(false)
|
||||||
|
|
||||||
const render = (toolVo: ToolVo) => {
|
const render = (toolVo: ToolVo) => {
|
||||||
try {
|
try {
|
||||||
|
setIsMobileMode(toolVo.platform === 'ANDROID')
|
||||||
|
|
||||||
const baseDist = base64ToStr(toolVo.base.dist.data!)
|
const baseDist = base64ToStr(toolVo.base.dist.data!)
|
||||||
const files = base64ToFiles(toolVo.source.data!)
|
const files = base64ToFiles(toolVo.source.data!)
|
||||||
const importMap = JSON.parse(files[IMPORT_MAP_FILE_NAME].value) as IImportMap
|
const importMap = JSON.parse(files[IMPORT_MAP_FILE_NAME].value) as IImportMap
|
||||||
@@ -75,7 +78,11 @@ const Execute = () => {
|
|||||||
return (
|
return (
|
||||||
<FitFullscreen className={styles.root}>
|
<FitFullscreen className={styles.root}>
|
||||||
<Card className={styles.rootBox}>
|
<Card className={styles.rootBox}>
|
||||||
<Playground.Output.Preview.Render iframeKey={`${id}`} compiledCode={compiledCode} />
|
<Playground.Output.Preview.Render
|
||||||
|
iframeKey={`${id}`}
|
||||||
|
compiledCode={compiledCode}
|
||||||
|
mobileMode={isMobileMode}
|
||||||
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
</FitFullscreen>
|
</FitFullscreen>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user