update template naming

pull/5370/head
yann300 2 years ago
parent a152f69d80
commit 2265adc906
  1. 6
      libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx
  2. 1
      libs/remix-ui/workspace/src/index.ts
  3. 8
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  4. 10
      libs/remix-ui/workspace/src/lib/utils/constants.ts

@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */
import React, { useEffect, useRef, useContext } from 'react' import React, { useEffect, useRef, useContext } from 'react'
import { useIntl, FormattedMessage } from 'react-intl' import { useIntl, FormattedMessage } from 'react-intl'
import { TEMPLATE_NAMES } from '@remix-ui/workspace'
import { ThemeContext} from '../themeContext' import { ThemeContext} from '../themeContext'
import Carousel from 'react-multi-carousel' import Carousel from 'react-multi-carousel'
import WorkspaceTemplate from './workspaceTemplate' import WorkspaceTemplate from './workspaceTemplate'
@ -59,8 +60,9 @@ function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) {
const createWorkspace = async (templateName) => { const createWorkspace = async (templateName) => {
await plugin.appManager.activatePlugin('filePanel') await plugin.appManager.activatePlugin('filePanel')
const timeStamp = Date.now() const timeStamp = Date.now()
await plugin.call('filePanel', 'createWorkspace', templateName + "_" + timeStamp, templateName) const templateDisplayName = TEMPLATE_NAMES[templateName]
await plugin.call('filePanel', 'setWorkspace', templateName + "_" + timeStamp) await plugin.call('filePanel', 'createWorkspace', templateDisplayName + " " + timeStamp, templateName)
await plugin.call('filePanel', 'setWorkspace', templateDisplayName + " " + timeStamp)
plugin.verticalIcons.select('filePanel') plugin.verticalIcons.select('filePanel')
_paq.push(['trackEvent', 'hometab', 'homeGetStarted', templateName]) _paq.push(['trackEvent', 'hometab', 'homeGetStarted', templateName])
} }

@ -1,3 +1,4 @@
export * from './lib/providers/FileSystemProvider' export * from './lib/providers/FileSystemProvider'
export * from './lib/contexts' export * from './lib/contexts'
export * from './lib/utils/constants'
export { FileType } from './lib/types/index' export { FileType } from './lib/types/index'

@ -5,7 +5,7 @@ import { CustomIconsToggle, CustomMenu, CustomToggle, CustomTooltip } from '@rem
import { FileExplorer } from './components/file-explorer' // eslint-disable-line import { FileExplorer } from './components/file-explorer' // eslint-disable-line
import { FileSystemContext } from './contexts' import { FileSystemContext } from './contexts'
import './css/remix-ui-workspace.css' import './css/remix-ui-workspace.css'
import { ROOT_PATH } from './utils/constants' import { ROOT_PATH, TEMPLATE_NAMES } from './utils/constants'
import { HamburgerMenu } from './components/workspace-hamburger' import { HamburgerMenu } from './components/workspace-hamburger'
const _paq = window._paq = window._paq || [] const _paq = window._paq = window._paq || []
@ -231,7 +231,7 @@ export function Workspace () {
} else displayOzCustomRef.current.style.display = 'none' } else displayOzCustomRef.current.style.display = 'none'
// @ts-ignore // @ts-ignore
workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value || 'remixDefault'}_${Date.now()}` workspaceCreateInput.current.value = `${TEMPLATE_NAMES[workspaceCreateTemplateInput.current.value || 'remixDefault']} ${Date.now()}`
} }
const handleTypingUrl = () => { const handleTypingUrl = () => {
@ -303,7 +303,7 @@ export function Workspace () {
<label id="selectWsTemplate" className="form-check-label" style={{fontWeight: "bolder"}}><FormattedMessage id='filePanel.workspace.chooseTemplate' /></label> <label id="selectWsTemplate" className="form-check-label" style={{fontWeight: "bolder"}}><FormattedMessage id='filePanel.workspace.chooseTemplate' /></label>
<select name="wstemplate" className="mb-3 form-control custom-select" id="wstemplate" defaultValue='remixDefault' ref={workspaceCreateTemplateInput} onChange={updateWsName}> <select name="wstemplate" className="mb-3 form-control custom-select" id="wstemplate" defaultValue='remixDefault' ref={workspaceCreateTemplateInput} onChange={updateWsName}>
<optgroup style={{fontSize: "medium"}} label="General"> <optgroup style={{fontSize: "medium"}} label="General">
<option style={{fontSize: "small"}} value='remixDefault'>Default</option> <option style={{fontSize: "small"}} value='remixDefault'>Basic</option>
<option style={{fontSize: "small"}} value='blank'>Blank</option> <option style={{fontSize: "small"}} value='blank'>Blank</option>
</optgroup> </optgroup>
<optgroup style={{fontSize: "medium"}} label="OpenZeppelin"> <optgroup style={{fontSize: "medium"}} label="OpenZeppelin">
@ -353,7 +353,7 @@ export function Workspace () {
</div> </div>
<label id="wsName" className="form-check-label" style={{fontWeight: "bolder"}} ><FormattedMessage id='filePanel.workspaceName' /></label> <label id="wsName" className="form-check-label" style={{fontWeight: "bolder"}} ><FormattedMessage id='filePanel.workspaceName' /></label>
<input type="text" data-id="modalDialogCustomPromptTextCreate" defaultValue={`remixDefault_${Date.now()}`} ref={workspaceCreateInput} className="form-control" /> <input type="text" data-id="modalDialogCustomPromptTextCreate" defaultValue={`Basic ${Date.now()}`} ref={workspaceCreateInput} className="form-control" />
<div className="d-flex py-2 align-items-center custom-control custom-checkbox"> <div className="d-flex py-2 align-items-center custom-control custom-checkbox">
<input <input

@ -51,3 +51,13 @@ jobs:
fail-on: 'low' fail-on: 'low'
solc-version: '0.8.2' solc-version: '0.8.2'
` `
export const TEMPLATE_NAMES = {
'remixDefault': 'Basic',
'blank': 'Blank',
'ozerc20': 'OpenZeppelin ERC20',
'ozerc721': 'OpenZeppelin ERC721',
'ozerc1155': 'OpenZeppelin ERC1155',
'zeroxErc20': '0xProject ERC20',
'gnosisSafeMultisig': 'Gnosis Safe'
}

Loading…
Cancel
Save