From dfdb6f488077a0d643a79daac4969f36bc87905e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 30 Jul 2024 14:47:55 +0200 Subject: [PATCH] rm unused file --- .../src/app/plugins/templates-selection.tsx | 472 ------------------ 1 file changed, 472 deletions(-) delete mode 100644 apps/remix-ide/src/app/plugins/templates-selection.tsx diff --git a/apps/remix-ide/src/app/plugins/templates-selection.tsx b/apps/remix-ide/src/app/plugins/templates-selection.tsx deleted file mode 100644 index a68b47fb75..0000000000 --- a/apps/remix-ide/src/app/plugins/templates-selection.tsx +++ /dev/null @@ -1,472 +0,0 @@ - -import React from 'react' -import { FormattedMessage, useIntl } from 'react-intl' -import { AppModal } from '@remix-ui/app' -import { ViewPlugin } from '@remixproject/engine-web' -import { PluginViewWrapper } from '@remix-ui/helper' -import { RemixUIGridView } from '@remix-ui/remix-ui-grid-view' -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' - -//@ts-ignore -const _paq = (window._paq = window._paq || []) - -const profile = { - name: 'templateSelection', - displayName: 'Template Selection', - description: 'templateSelection', - location: 'mainPanel', - methods: [], - events: [] -} - -export class TemplatesSelection extends ViewPlugin { - templates: Array - dispatch: React.Dispatch = () => { } - constructor() { - super(profile) - } - - async onActivation() { - this.handleThemeChange() - await this.call('tabs', 'focus', 'remixGuide') - this.renderComponent() - _paq.push(['trackEvent', 'plugin', 'activated', 'remixGuide']) - } - - onDeactivation(): void { - } - - private handleThemeChange() { - this.on('theme', 'themeChanged', (theme: any) => { - this.renderComponent() - }) - } - - setDispatch(dispatch: React.Dispatch): void { - this.dispatch = dispatch - this.renderComponent() - } - - render() { - return ( -
- -
- ) - } - - renderComponent() { - this.dispatch({ - ...this, - }) - } - - updateComponent() { - /* - const opts = { - // @ts-ignore: Object is possibly 'null'. - mintable: mintableCheckboxRef.current.checked, - // @ts-ignore: Object is possibly 'null'. - burnable: burnableCheckboxRef.current.checked, - // @ts-ignore: Object is possibly 'null'. - pausable: pausableCheckboxRef.current.checked, - // @ts-ignore: Object is possibly 'null'. - 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) - - const username = await this.call('settings', 'get', 'settings/github-user-name') - const email = await this.call('settings', 'get', 'settings/github-email') - const gitNotSet = !username || !email - let workspaceName = defaultName - let initGit = false - const modal: AppModal = { - id: 'TemplatesSelection', - title: window._intl.formatMessage({ id: !isElectron() ? 'filePanel.workspace.create': 'filePanel.workspace.create.desktop' }), - message: await createModalMessage(defaultName, gitNotSet, (value) => workspaceName = value, (value) => initGit = !!value), - okLabel: window._intl.formatMessage({ id: !isElectron() ? 'filePanel.ok':'filePanel.selectFolder' }), - } - const modalResult = await this.call('notification', 'modal', modal) - if (!modalResult) return - this.emit('createWorkspaceReducerEvent', workspaceName, item.value, item.opts, false, (e, data) => { - if (e) { - const modal: AppModal = { - id: 'TemplatesSelection', - title: window._intl.formatMessage({ id: !isElectron() ? 'filePanel.workspace.create': 'filePanel.workspace.create.desktop' }), - message: e.message, - okLabel: window._intl.formatMessage({ id: 'filePanel.ok' }), - cancelLabel: window._intl.formatMessage({ id: 'filePanel.cancel' }) - } - this.call('notification', 'modal', modal) - console.error(e) - } - - }, initGit) - } - - const addToExistingWorkspace = async (item) => { - this.emit('addTemplateToWorkspaceReducerEvent', item.value, item.opts, false, (e, data) => { - if (e) { - const modal: AppModal = { - id: 'TemplatesSelection', - title: window._intl.formatMessage({ id: !isElectron() ? 'filePanel.workspace.create': 'filePanel.workspace.create.desktop' }), - message: e.message, - okLabel: window._intl.formatMessage({ id: 'filePanel.ok' }), - cancelLabel: window._intl.formatMessage({ id: 'filePanel.cancel' }) - } - this.call('notification', 'modal', modal) - console.error(e) - } - - }) - } - - return ( - - { - - this.templates.map(template => { - return - {template.items.map(item => { - return -
- {item.displayName} - {JSON.stringify(item.opts)} -
-
-
- })} -
- })} -
- ) - } - -} - -const createModalMessage = async ( - defaultName: string, - gitConfigNotSet: boolean, - onChangeTemplateName: (name: string) => void, - onChangeInitGit: (name: string) => void) => { - - return ( - <> - - onChangeTemplateName(e.target.value)} - /> -
- onChangeInitGit(e.target.value)} - /> - -
- {gitConfigNotSet ? ( -
- -
- ) : ( - <> - )} - - ) -} -