From 402788270165452ab56e60c0cafa4ddd87729e6f Mon Sep 17 00:00:00 2001 From: hetpatel33 Date: Sat, 12 Oct 2019 16:36:49 +0530 Subject: [PATCH 1/2] Refactor Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx : convert to ts and replace Cerebral with Overmind --- .../AliasDeploymentButton.tsx | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx index 39ceb359712..876f5b331c0 100644 --- a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx +++ b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx @@ -1,25 +1,26 @@ import React from 'react'; -import { inject, hooksObserver } from 'app/componentConnectors'; +import { useOvermind } from 'app/overmind'; import { Action } from '../../../../elements'; import { Deploy } from '../types'; type Props = { deploy: Deploy; }; -export const AliasDeploymentButton = inject('signals')( - hooksObserver( - ({ - deploy: { alias: aliases, uid: id }, - signals: { - deployment: { aliasDeployment }, - }, - }: Props & { signals: any }) => ( - 0} - onClick={() => aliasDeployment({ id })} - > - {aliases.length > 0 ? 'Aliased' : 'Alias'} - - ) - ) -); + +export const AliasDeploymentButton: React.FC = ({ + deploy: { alias: aliases, uid: id }, +}) => { + const { + actions: { + deployment: { aliasDeployment }, + }, + } = useOvermind(); + return ( + 0} + onClick={() => aliasDeployment({ id })} + > + {aliases.length > 0 ? 'Aliased' : 'Alias'} + + ); +}; From 4180ca8ea54528cc0a737243acb74f3acfc5c067 Mon Sep 17 00:00:00 2001 From: hetpatel33 Date: Sat, 12 Oct 2019 16:53:09 +0530 Subject: [PATCH 2/2] Refactor Editor/Workspace/items/Deployment/Zeit/Deploys/Actions: typechecks and remove redudant type files --- .../Actions/AliasDeploymentButton/AliasDeploymentButton.tsx | 4 ++-- .../items/Deployment/Zeit/Deploys/Actions/types.ts | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/types.ts diff --git a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx index 876f5b331c0..9937f9daecc 100644 --- a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx +++ b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { useOvermind } from 'app/overmind'; +import { ZeitDeployment } from '@codesandbox/common/lib/types'; import { Action } from '../../../../elements'; -import { Deploy } from '../types'; type Props = { - deploy: Deploy; + deploy: ZeitDeployment; }; export const AliasDeploymentButton: React.FC = ({ diff --git a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/types.ts b/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/types.ts deleted file mode 100644 index 9f00a5f9659..00000000000 --- a/packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/types.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type Deploy = { - alias: string[]; - state: string; - uid: string; - url: string; -};