From 8c6411887c6285a9216780f67cdb957421b5c106 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 2 May 2024 14:52:20 +0200 Subject: [PATCH] renaming --- apps/remix-ide/src/app.js | 4 +- .../templates-selection-plugin.tsx} | 266 +----------------- .../plugins/templates-selection/templates.ts | 258 +++++++++++++++++ 3 files changed, 265 insertions(+), 263 deletions(-) rename apps/remix-ide/src/app/plugins/{templates-selection.tsx => templates-selection/templates-selection-plugin.tsx} (50%) create mode 100644 apps/remix-ide/src/app/plugins/templates-selection/templates.ts diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 64faf3a39b..a3722c7572 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -61,7 +61,7 @@ import { Matomo } from './app/plugins/matomo' import {SolCoder} from './app/plugins/solcoderAI' -import {TemplatesSelection} from './app/plugins/templates-selection' +import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin' const isElectron = require('is-electron') @@ -317,7 +317,7 @@ class AppComponent { // ----------------- run script after each compilation results ----------- const pluginStateLogger = new PluginStateLogger() - const templateSelection = new TemplatesSelection() + const templateSelection = new TemplatesSelectionPlugin() this.engine.register([ permissionHandler, diff --git a/apps/remix-ide/src/app/plugins/templates-selection.tsx b/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx similarity index 50% rename from apps/remix-ide/src/app/plugins/templates-selection.tsx rename to apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx index 4d3df29a33..569cb98bfe 100644 --- a/apps/remix-ide/src/app/plugins/templates-selection.tsx +++ b/apps/remix-ide/src/app/plugins/templates-selection/templates-selection-plugin.tsx @@ -9,6 +9,7 @@ import { RemixUIGridSection } from '@remix-ui/remix-ui-grid-section' import { RemixUIGridCell } from '@remix-ui/remix-ui-grid-cell' import isElectron from 'is-electron' import type { TemplateGroup } from '@remix-ui/workspace' +import { templates } from './templates' //@ts-ignore const _paq = (window._paq = window._paq || []) @@ -22,7 +23,7 @@ const profile = { events: [] } -export class TemplatesSelection extends ViewPlugin { +export class TemplatesSelectionPlugin extends ViewPlugin { templates: Array dispatch: React.Dispatch = () => { } constructor() { @@ -77,263 +78,6 @@ export class TemplatesSelection extends ViewPlugin { upgradeable: transparentRadioRef.current.checked ? transparentRadioRef.current.value : uupsRadioRef.current.checked ? uupsRadioRef.current.value : false } */ - this.templates = [ - { - name: "Generic", - items: [ - { value: "remixDefault", displayName: window._intl.formatMessage({ id: 'filePanel.basic' }) }, - { value: "blank", displayName: window._intl.formatMessage({ id: 'filePanel.blank' }) } - ] - }, - { - name: "OpenZeppelin", - items: [ - { - value: "ozerc20", - displayName: "ERC20" - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)" - }, - { - value: "ozerc1155", - displayName: "ERC1155" - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - mintable: true - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - mintable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - mintable: true - } - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - mintable: true, - burnable: true - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - mintable: true, - burnable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - mintable: true, - burnable: true - } - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - mintable: true, - pausable: true - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - mintable: true, - pausable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - mintable: true, - pausable: true - } - } - ] - }, - { - name: "OpenZeppelin Proxy", - items: [ - { - value: "ozerc20", - displayName: "ERC20", - opts: { - upgradeable: 'uups' - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - upgradeable: 'uups' - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - upgradeable: 'uups' - } - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - upgradeable: 'uups', - mintable: true - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - upgradeable: 'uups', - mintable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - upgradeable: 'uups', - mintable: true - } - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - upgradeable: 'uups', - mintable: true, - burnable: true - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - upgradeable: 'uups', - mintable: true, - burnable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - upgradeable: 'uups', - mintable: true, - burnable: true - } - }, - { - value: "ozerc20", - displayName: "ERC20", - opts: { - upgradeable: 'uups', - mintable: true, - pausable: true - } - }, - { - value: "ozerc721", - displayName: "ERC721 (NFT)", - opts: { - upgradeable: 'uups', - mintable: true, - pausable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - upgradeable: 'uups', - mintable: true, - pausable: true - } - }, - { - value: "ozerc1155", - displayName: "ERC1155", - opts: { - upgradeable: 'uups', - mintable: true, - burnable: true, - pausable: true - } - } - ] - }, - { - name: "OxProject", - items: [ - { value: "zeroxErc20", displayName: "ERC20" } - ] - }, - { - name: "Gnosis Safe", - items: [ - { value: "gnosisSafeMultisig", displayName: window._intl.formatMessage({ id: 'filePanel.multiSigWallet' }) } - ] - }, - { - name: "Circom ZKP", - items: [ - { value: "semaphore", displayName: window._intl.formatMessage({ id: 'filePanel.semaphore' }) }, - { value: "hashchecker", displayName: window._intl.formatMessage({ id: 'filePanel.hashchecker' }) }, - { value: "rln", displayName: window._intl.formatMessage({ id: 'filePanel.rln' }) } - ] - }, - { - name: "Generic ZKP", - items: [ - { value: "sindriScripts", displayName: window._intl.formatMessage({ id: 'filePanel.addscriptsindri' }) }, - ] - }, - { - name: "Uniswap V4", - items: [ - { value: "uniswapV4Template", displayName: window._intl.formatMessage({ id: 'filePanel.uniswapV4Template' }) }, - { value: "breakthroughLabsUniswapv4Hooks", displayName: window._intl.formatMessage({ id: 'filePanel.breakthroughLabsUniswapv4Hooks' }) }, - { value: "uniswapV4HookBookMultiSigSwapHook", displayName: window._intl.formatMessage({ id: 'filePanel.uniswapV4HookBookMultiSigSwapHook' }) } - ] - }, - { - name: "Solidity CREATE2", - items: [ - { value: "contractCreate2Factory", displayName: window._intl.formatMessage({ id: 'filePanel.addcreate2solidityfactory' }) }, - { value: "contractDeployerScripts", displayName: window._intl.formatMessage({ id: 'filePanel.addscriptdeployer' }) } - ] - }, - { - name: "Contract Verification", - items: [ - { value: "etherscanScripts", displayName: window._intl.formatMessage({ id: 'filePanel.addscriptetherscan' }) }, - ] - } - ] - const createWorkspace = async (item) => { const defaultName = await this.call('filePanel', 'getAvailableWorkspaceName', item.displayName) @@ -366,7 +110,7 @@ export class TemplatesSelection extends ViewPlugin { }, initGit) } - const addToExistingWorkspace = async (item) => { + const addToCurrentWorkspace = async (item) => { this.emit('addTemplateToWorkspaceReducerEvent', item.value, item.opts, false, (e, data) => { if (e) { const modal: AppModal = { @@ -397,7 +141,7 @@ export class TemplatesSelection extends ViewPlugin { > { - this.templates.map(template => { + templates(window._intl).map(template => { return {item.displayName} {JSON.stringify(item.opts)} -
+
})} diff --git a/apps/remix-ide/src/app/plugins/templates-selection/templates.ts b/apps/remix-ide/src/app/plugins/templates-selection/templates.ts new file mode 100644 index 0000000000..8312611b1a --- /dev/null +++ b/apps/remix-ide/src/app/plugins/templates-selection/templates.ts @@ -0,0 +1,258 @@ +export const templates = (intl) => { + return [ + { + name: "Generic", + items: [ + { value: "remixDefault", displayName: intl.formatMessage({ id: 'filePanel.basic' }) }, + { value: "blank", displayName: intl.formatMessage({ id: 'filePanel.blank' }) } + ] + }, + { + name: "OpenZeppelin", + items: [ + { + value: "ozerc20", + displayName: "ERC20" + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)" + }, + { + value: "ozerc1155", + displayName: "ERC1155" + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + mintable: true + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + mintable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + mintable: true + } + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + mintable: true, + burnable: true + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + mintable: true, + burnable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + mintable: true, + burnable: true + } + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + mintable: true, + pausable: true + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + mintable: true, + pausable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + mintable: true, + pausable: true + } + } + ] + }, + { + name: "OpenZeppelin Proxy", + items: [ + { + value: "ozerc20", + displayName: "ERC20", + opts: { + upgradeable: 'uups' + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + upgradeable: 'uups' + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + upgradeable: 'uups' + } + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + upgradeable: 'uups', + mintable: true + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + upgradeable: 'uups', + mintable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + upgradeable: 'uups', + mintable: true + } + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + upgradeable: 'uups', + mintable: true, + burnable: true + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + upgradeable: 'uups', + mintable: true, + burnable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + upgradeable: 'uups', + mintable: true, + burnable: true + } + }, + { + value: "ozerc20", + displayName: "ERC20", + opts: { + upgradeable: 'uups', + mintable: true, + pausable: true + } + }, + { + value: "ozerc721", + displayName: "ERC721 (NFT)", + opts: { + upgradeable: 'uups', + mintable: true, + pausable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + upgradeable: 'uups', + mintable: true, + pausable: true + } + }, + { + value: "ozerc1155", + displayName: "ERC1155", + opts: { + upgradeable: 'uups', + mintable: true, + burnable: true, + pausable: true + } + } + ] + }, + { + name: "OxProject", + items: [ + { value: "zeroxErc20", displayName: "ERC20" } + ] + }, + { + name: "Gnosis Safe", + items: [ + { value: "gnosisSafeMultisig", displayName: intl.formatMessage({ id: 'filePanel.multiSigWallet' }) } + ] + }, + { + name: "Circom ZKP", + items: [ + { value: "semaphore", displayName: intl.formatMessage({ id: 'filePanel.semaphore' }) }, + { value: "hashchecker", displayName: intl.formatMessage({ id: 'filePanel.hashchecker' }) }, + { value: "rln", displayName: intl.formatMessage({ id: 'filePanel.rln' }) } + ] + }, + { + name: "Generic ZKP", + items: [ + { value: "sindriScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptsindri' }) }, + ] + }, + { + name: "Uniswap V4", + items: [ + { value: "uniswapV4Template", displayName: intl.formatMessage({ id: 'filePanel.uniswapV4Template' }) }, + { value: "breakthroughLabsUniswapv4Hooks", displayName: intl.formatMessage({ id: 'filePanel.breakthroughLabsUniswapv4Hooks' }) }, + { value: "uniswapV4HookBookMultiSigSwapHook", displayName: intl.formatMessage({ id: 'filePanel.uniswapV4HookBookMultiSigSwapHook' }) } + ] + }, + { + name: "Solidity CREATE2", + items: [ + { value: "contractCreate2Factory", displayName: intl.formatMessage({ id: 'filePanel.addcreate2solidityfactory' }) }, + { value: "contractDeployerScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptdeployer' }) } + ] + }, + { + name: "Contract Verification", + items: [ + { value: "etherscanScripts", displayName: intl.formatMessage({ id: 'filePanel.addscriptetherscan' }) }, + ] + } + ] +} \ No newline at end of file