Skip to content

Commit 9937d18

Browse files
hetpatel33CompuIves
authored andcommitted
🔨 Refactored 🧠 Overmind Hacktober | Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx : refactor to replace Cerebral with Overmind (codesandbox#2742)
* Refactor Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx : convert to ts and replace Cerebral with Overmind * Refactor Editor/Workspace/items/Deployment/Zeit/Deploys/Actions: typechecks and remove redudant type files
1 parent c96b102 commit 9937d18

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

‎packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/AliasDeploymentButton/AliasDeploymentButton.tsx‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
import React from 'react';
2-
import { inject, hooksObserver } from 'app/componentConnectors';
2+
import { useOvermind } from 'app/overmind';
3+
import { ZeitDeployment } from '@codesandbox/common/lib/types';
34
import { Action } from '../../../../elements';
4-
import { Deploy } from '../types';
55

66
type Props = {
7-
deploy: Deploy;
7+
deploy: ZeitDeployment;
8+
};
9+
10+
export const AliasDeploymentButton: React.FC<Props> = ({
11+
deploy: { alias: aliases, uid: id },
12+
}) => {
13+
const {
14+
actions: {
15+
deployment: { aliasDeployment },
16+
},
17+
} = useOvermind();
18+
return (
19+
<Action
20+
disabled={aliases.length > 0}
21+
onClick={() => aliasDeployment({ id })}
22+
>
23+
{aliases.length > 0 ? 'Aliased' : 'Alias'}
24+
</Action>
25+
);
826
};
9-
export const AliasDeploymentButton = inject('signals')(
10-
hooksObserver(
11-
({
12-
deploy: { alias: aliases, uid: id },
13-
signals: {
14-
deployment: { aliasDeployment },
15-
},
16-
}: Props & { signals: any }) => (
17-
<Action
18-
disabled={aliases.length > 0}
19-
onClick={() => aliasDeployment({ id })}
20-
>
21-
{aliases.length > 0 ? 'Aliased' : 'Alias'}
22-
</Action>
23-
)
24-
)
25-
);

‎packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Zeit/Deploys/Actions/types.ts‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)