Skip to content

Commit e02cc38

Browse files
authored
Merge pull request #42 from firecamp-io/ui/storybook
monaco <= storybook
2 parents 2fbaef9 + ab60e45 commit e02cc38

File tree

51 files changed

+1840
-1209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1840
-1209
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cSpell.words": [
3-
"Auths"
3+
"Auths",
4+
"testid"
45
],
56
"[javascript]": {
67
"editor.formatOnSave": true,

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@babel/preset-react": "^7.16.7",
6161
"@babel/preset-typescript": "^7.16.7",
6262
"@babel/register": "^7.0.0",
63+
"@types/ramda": "^0.28.15",
6364
"babel-eslint": "^7.1.0",
6465
"babel-loader": "^8.2.4",
6566
"babel-plugin-add-module-exports": "^1.0.4",
@@ -126,6 +127,7 @@
126127
"prettify-xml": "^1.2.0",
127128
"pug-cli": "^1.0.0-alpha6",
128129
"querystring": "^0.2.1",
130+
"ramda": "^0.28.0",
129131
"react-file-drop": "^3.1.5"
130132
},
131133
"workspaces": [

packages/firecamp-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"react-dnd": "^16.0.0",
8888
"react-dnd-html5-backend": "^16.0.1",
8989
"react-dom": "17.0.2",
90-
"react-error-boundary": "^3.1.3",
90+
"react-error-boundary": "^3.1.4",
9191
"react-file-drop": "^3.1.5",
9292
"react-ga": "^3.1.2",
9393
"react-hook-form": "^6.8.1",

packages/firecamp-core/src/components/activity-bar/explorer/Explorer.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ import { VscNewFolder } from '@react-icons/all-files/vsc/VscNewFolder';
2323
// import { VscFileSymlinkFile } from '@react-icons/all-files/vsc/VscFileSymlinkFile';
2424
import { VscFolder } from '@react-icons/all-files/vsc/VscFolder';
2525

26-
import { useTabStore } from '../../../store/tab';
2726
import { useWorkspaceStore } from '../../../store/workspace';
2827
import { WorkspaceCollectionsProvider } from './WorkspaceCollectionsProvider';
2928
import treeRenderer from './treeItemRenderer';
3029
import AppService from '../../../services/app';
3130
import { RE } from '../../../types'
31+
import { platformEmitter as emitter } from '../../../services/platform-emitter'
32+
import { EPlatformTabs } from '../../../services/platform-emitter/events'
3233

3334
const Explorer: FC<any> = () => {
3435
const environmentRef = useRef();
3536
const treeRef = useRef();
3637

37-
const { openSavedTab } = useTabStore((s) => ({ openSavedTab: s.open.saved }), shallow);
38-
3938
let {
4039
workspace,
4140
explorer,
@@ -115,31 +114,30 @@ const Explorer: FC<any> = () => {
115114
};
116115

117116
const _openReqInTab = (request: any) => {
118-
// console.log(`node`, request);
119-
openSavedTab(request);
117+
console.log(`node`, request);
118+
emitter.emit(EPlatformTabs.openSaved, request);
120119
};
121120

122-
const _onNodeSelect = (nodeIdxs: TreeItemIndex[]) => {
123-
// console.log({ nodeIdxs });
121+
const _onNodeSelect = (nodeIndexes: TreeItemIndex[]) => {
122+
// console.log({ nodeIndexes });
124123
// return
125124

126-
let nodeIndex = nodeIdxs[0];
127-
let colItem = [...collections, ...folders, ...requests].find(
125+
let nodeIndex = nodeIndexes[0];
126+
let nodeItem = [...collections, ...folders, ...requests].find(
128127
(c) => c._meta.id == nodeIndex
129128
);
130-
// console.log({ colItem });
129+
// console.log({ nodeItem });
131130
if (
132-
colItem &&
131+
nodeItem &&
133132
[
134133
ERequestTypes.Rest,
135134
ERequestTypes.GraphQL,
136135
ERequestTypes.SocketIO,
137136
ERequestTypes.WebSocket,
138-
].includes(colItem.meta.type)
137+
].includes(nodeItem.meta.type)
139138
) {
140-
// console.log({ colItem });
141-
142-
_openReqInTab(colItem);
139+
// console.log({ nodeItem });
140+
_openReqInTab(nodeItem);
143141
}
144142
};
145143

packages/firecamp-core/src/components/common/environment/environment-widget/EnvironmentDD.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,7 @@ const EnvironmentDD: FC<IEnvironmentDD> = ({
5252
? 'Manage Workspace Environment'
5353
: 'Manage Collection Environment',
5454
onClick: () => {
55-
// if (scope === EEnvironmentScope.Workspace) {
56-
// F.appStore.environment.update.activeProject('global');
57-
// F.ModalService.open(
58-
// EModals.WORKSPACE_SETTING,
59-
// EWorkspaceSettingTabs.ENVIRONMENT
60-
// );
61-
// } else {
62-
// F.appStore.environment.update.activeProject(collectionId);
63-
// F.ModalService.open(
64-
// EModals.PROJECT_SETTING,
65-
// ECollectionSettingTabs.ENVIRONMENT,
66-
// { collectionId }
67-
// );
68-
// }
55+
6956
},
7057
},
7158
];

packages/firecamp-core/src/components/common/environment/environment-widget/WorkspaceEnvDD.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,7 @@ const WorkspaceEnvDD: FC<IWorkspaceEnvDD> = ({
6363
? 'Manage Workspace Environment'
6464
: 'Manage Collection Environment',
6565
onClick: () => {
66-
// if (scope === EEnvironmentScope.Workspace) {
67-
// F.appStore.environment.update.activeProject('global');
68-
// F.ModalService.open(
69-
// EModals.WORKSPACE_SETTING,
70-
// EWorkspaceSettingTabs.ENVIRONMENT
71-
// );
72-
// } else {
73-
// F.appStore.environment.update.activeProject(id);
74-
// F.ModalService.open(
75-
// EModals.PROJECT_SETTING,
76-
// ECollectionSettingTabs.ENVIRONMENT,
77-
// { id }
78-
// );
79-
// }
66+
8067
},
8168
},
8269
];
Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { FC, useState } from 'react';
2+
import { FallbackProps } from 'react-error-boundary';
23
import { Modal } from '@firecamp/ui-kit';
34

45
import './ErrorPopup.sass';
56

6-
const ErrorPopup: FC<IErrorPopup> = ({
7-
message = `An unexpected error occurs.
8-
We'll surely fix it out for you soon. We appreciate your patience.`,
9-
onClose = () => {},
10-
}) => {
11-
// console.log(`in error popup`, message, isOpen)
12-
7+
const ErrorPopup: FC<FallbackProps> = ({ error }) => {
138
const bg = {
149
modal: {
1510
background: '#c84a1782',
@@ -21,7 +16,7 @@ We'll surely fix it out for you soon. We appreciate your patience.`,
2116

2217
let _onClose = async () => {
2318
// on close, refresh app
24-
onClose();
19+
// onClose();
2520
// await initApp();
2621
toggleOpen(false);
2722
};
@@ -40,24 +35,10 @@ We'll surely fix it out for you soon. We appreciate your patience.`,
4035
paddingRight: '60px',
4136
}}
4237
>
43-
{message || ''}
38+
{error.message || ''}
4439
</div>
4540
</Modal>
4641
);
4742
};
4843

4944
export default ErrorPopup;
50-
51-
/**
52-
* Handle firecamp errors and show popup menu to instruct users about the same
53-
*/
54-
interface IErrorPopup {
55-
/**
56-
* Error message
57-
*/
58-
message?: string;
59-
/**
60-
* Close error popup
61-
*/
62-
onClose?: () => void;
63-
}

0 commit comments

Comments
 (0)