new getting started component

pull/4774/head
Joseph Izang 7 months ago
parent 4272e7ddb7
commit c6781361fb
  1. 52
      libs/remix-ui/home-tab/src/lib/components/homeTabGettingStarted.tsx

@ -1,6 +1,17 @@
import { createWorkspace } from 'libs/remix-ui/workspace/src/lib/actions'
import React from 'react'
import { Button } from 'react-bootstrap'
import React, {useEffect, useRef, useContext} from 'react'
import {useIntl, FormattedMessage } from 'react-intl'
import {TEMPLATE_NAMES,TEMPLATE_METADATA} from '@remix-ui/workspace'
import {ThemeContext} from '../themeContext'
import Carousel from 'react-multi-carousel'
import WorkspaceTemplate from './workspaceTemplate'
import 'react-multi-carousel/lib/styles.css'
import CustomNavButtons from './customNavButtons'
import { appPlatformTypes, platformContext } from '@remix-ui/app'
export interface HomeTabGettingStartedProps {
plugin: any
}
type WorkspaceTemplate = {
gsID: string
@ -55,12 +66,43 @@ const workspaceTemplates: WorkspaceTemplate[] = [
}
]
export default function GettingStarted() {
export default function HomeTabGettingStarted() {
const createWorkspace = async (templateName) => {
if(platform === appPlatformTypes.desktop){
await plugin.call('remix-templates', 'loadTemplateInNewWindow', templateName)
return
}
let templateDisplayName = TEMPLATE_NAMES[templateName]
const metadata = TEMPLATE_METADATA[templateName]
if (metadata) {
if (metadata.type === 'git') {
await plugin.call('dGitProvider', 'clone', {url: metadata.url, branch: metadata.branch}, templateDisplayName)
} else if (metadata && metadata.type === 'plugin') {
await plugin.appManager.activatePlugin('filePanel')
templateDisplayName = await plugin.call('filePanel', 'getAvailableWorkspaceName', templateDisplayName)
await plugin.call('filePanel', 'createWorkspace', templateDisplayName, 'blank')
await plugin.call('filePanel', 'setWorkspace', templateDisplayName)
plugin.verticalIcons.select('filePanel')
await plugin.call(metadata.name, metadata.endpoint, ...metadata.params)
}
} else {
await plugin.appManager.activatePlugin('filePanel')
templateDisplayName = await plugin.call('filePanel', 'getAvailableWorkspaceName', templateDisplayName)
await plugin.call('filePanel', 'createWorkspace', templateDisplayName, templateName)
await plugin.call('filePanel', 'setWorkspace', templateDisplayName)
plugin.verticalIcons.select('filePanel')
}
_paq.push(['trackEvent', 'hometab', 'homeGetStarted', templateName])
}
return (
<div>
<span>Getting Started</span>
<div className="w-100">
<Button></Button>
<button className="btn btn-primary">Playground</button>
</div>
</div>
)

Loading…
Cancel
Save