From bd974c9535b02ee1d7d556c8a5b84fc1927723a8 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Tue, 3 May 2022 13:53:28 +0530 Subject: [PATCH] templates --- libs/remix-ui/workspace/src/lib/actions/workspace.ts | 6 +++--- libs/remix-ui/workspace/src/lib/templates/index.ts | 1 + .../src/lib/templates/{examples.ts => remixDefault.ts} | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 libs/remix-ui/workspace/src/lib/templates/index.ts rename libs/remix-ui/workspace/src/lib/templates/{examples.ts => remixDefault.ts} (99%) diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index 5ec5572adc..d461a67a2d 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -5,7 +5,7 @@ import { addInputFieldSuccess, createWorkspaceError, createWorkspaceRequest, cre import { checkSlash, checkSpecialChars } from '@remix-ui/helper' import { JSONStandardInput } from '../types' -import { examples } from '../templates/examples' +import { remixDefault } from '../templates' import { QueryParams } from '@remix-project/remix-lib' @@ -153,9 +153,9 @@ export const loadWorkspacePreset = async (template: 'gist-template' | 'code-temp case 'remixDefault': // creates a new workspace and populates it with default project template. // insert example contracts - for (const file in examples) { + for (const file in remixDefault) { try { - await workspaceProvider.set(examples[file].name, examples[file].content) + await workspaceProvider.set(remixDefault[file].name, remixDefault[file].content) } catch (error) { console.error(error) } diff --git a/libs/remix-ui/workspace/src/lib/templates/index.ts b/libs/remix-ui/workspace/src/lib/templates/index.ts new file mode 100644 index 0000000000..4739c0bdfb --- /dev/null +++ b/libs/remix-ui/workspace/src/lib/templates/index.ts @@ -0,0 +1 @@ +export { default as remixDefault } from './remixDefault' diff --git a/libs/remix-ui/workspace/src/lib/templates/examples.ts b/libs/remix-ui/workspace/src/lib/templates/remixDefault.ts similarity index 99% rename from libs/remix-ui/workspace/src/lib/templates/examples.ts rename to libs/remix-ui/workspace/src/lib/templates/remixDefault.ts index 6ccfac3160..8b596ec049 100644 --- a/libs/remix-ui/workspace/src/lib/templates/examples.ts +++ b/libs/remix-ui/workspace/src/lib/templates/remixDefault.ts @@ -392,7 +392,7 @@ For now, modules supported by Remix are ethers, web3, swarmgw, chai, remix and h For unsupported modules, an error like this will be thrown: ' module require is not supported by Remix IDE will be shown.' ` -export const examples = { +export default { storage: { name: 'contracts/1_Storage.sol', content: storage }, owner: { name: 'contracts/2_Owner.sol', content: owner }, ballot: { name: 'contracts/3_Ballot.sol', content: ballot },