update example.ts, generate-deploy-script.ts, and load-state.ts to support default generateDeployScript values for examples
This commit is contained in:
parent
b9ee504dd6
commit
11f1cf01ee
@ -4,6 +4,8 @@ import { DryRunState } from './dry-run';
|
||||
import { EditorState } from './editor';
|
||||
import { EvaluateFunctionState } from './evaluate-function';
|
||||
import { EvaluateValueState } from './evaluate-value';
|
||||
import { GenerateDeployScriptState } from './generate-deploy-script';
|
||||
|
||||
|
||||
export interface ExampleState {
|
||||
id: string;
|
||||
@ -14,4 +16,5 @@ export interface ExampleState {
|
||||
deploy: DeployState;
|
||||
evaluateFunction: EvaluateFunctionState;
|
||||
evaluateValue: EvaluateValueState;
|
||||
generateDeployScript: GenerateDeployScriptState;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples';
|
||||
import { Tool, ToolCommand } from './types';
|
||||
|
||||
export enum ActionType {
|
||||
@ -40,7 +41,8 @@ type Action =
|
||||
| ChangeToolAction
|
||||
| ChangeCommandAction
|
||||
| ChangeEntrypointAction
|
||||
| ChangeStorageAction;
|
||||
| ChangeStorageAction
|
||||
| ChangeSelectedExampleAction;
|
||||
|
||||
const DEFAULT_STATE: GenerateDeployScriptState = {
|
||||
tool: Tool.TezosClient,
|
||||
@ -56,6 +58,11 @@ export default (
|
||||
action: Action
|
||||
): GenerateDeployScriptState => {
|
||||
switch (action.type) {
|
||||
case ExamplesActionType.ChangeSelected:
|
||||
return {
|
||||
...state,
|
||||
...(!action.payload ? DEFAULT_STATE : action.payload.generateDeployScript)
|
||||
};
|
||||
case ActionType.ChangeTool:
|
||||
return {
|
||||
...state,
|
||||
|
@ -28,6 +28,7 @@ export async function loadDefaultState(appBundleDirectory: string) {
|
||||
deploy: {},
|
||||
evaluateValue: {},
|
||||
evaluateFunction: {},
|
||||
generateDeployScript: {},
|
||||
editor: {
|
||||
title: ''
|
||||
},
|
||||
@ -63,6 +64,10 @@ export async function loadDefaultState(appBundleDirectory: string) {
|
||||
...defaultState.evaluateFunction,
|
||||
...defaultExample.evaluateFunction
|
||||
};
|
||||
defaultState.generateDeployScript = {
|
||||
...defaultState.generateDeployScript,
|
||||
...defaultExample.generateDeployScript
|
||||
};
|
||||
defaultState.editor = {
|
||||
...defaultState.editor,
|
||||
...defaultExample.editor,
|
||||
|
Loading…
Reference in New Issue
Block a user