2021-07-14 00:10:49 +00:00
|
|
|
import React, { FC, useCallback } from 'react';
|
2021-07-22 23:04:56 +00:00
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
2020-11-02 22:09:45 +00:00
|
|
|
import { hotKeyRefs } from '../../../common/hotkeys';
|
2021-11-17 09:44:19 +00:00
|
|
|
import { ForceToWorkspace } from '../../redux/modules/helpers';
|
2021-07-14 00:10:49 +00:00
|
|
|
import { importFile } from '../../redux/modules/import';
|
2022-01-07 14:37:17 +00:00
|
|
|
import { selectActiveWorkspace, selectSettings } from '../../redux/selectors';
|
2021-09-15 20:16:04 +00:00
|
|
|
import { Hotkey } from '../hotkey';
|
2021-07-22 23:04:56 +00:00
|
|
|
import { Pane, PaneBody, PaneHeader } from './pane';
|
2020-11-02 22:09:45 +00:00
|
|
|
|
2021-05-12 06:35:00 +00:00
|
|
|
interface Props {
|
|
|
|
handleCreateRequest: () => void;
|
|
|
|
}
|
2020-11-02 22:09:45 +00:00
|
|
|
|
2021-09-27 13:47:22 +00:00
|
|
|
export const PlaceholderRequestPane: FC<Props> = ({
|
2020-11-02 22:09:45 +00:00
|
|
|
handleCreateRequest,
|
2021-07-14 00:10:49 +00:00
|
|
|
}) => {
|
|
|
|
const dispatch = useDispatch();
|
2022-01-07 14:37:17 +00:00
|
|
|
const { hotKeyRegistry } = useSelector(selectSettings);
|
2021-07-14 00:10:49 +00:00
|
|
|
const workspaceId = useSelector(selectActiveWorkspace)?._id;
|
2021-11-17 09:44:19 +00:00
|
|
|
const handleImportFile = useCallback(() => dispatch(importFile({ workspaceId, forceToWorkspace: ForceToWorkspace.current })), [workspaceId, dispatch]);
|
2020-11-02 22:09:45 +00:00
|
|
|
|
2021-07-14 00:10:49 +00:00
|
|
|
return (
|
|
|
|
<Pane type="request">
|
|
|
|
<PaneHeader />
|
|
|
|
<PaneBody placeholder>
|
|
|
|
<div>
|
|
|
|
<table className="table--fancy">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>New Request</td>
|
|
|
|
<td className="text-right">
|
|
|
|
<code>
|
|
|
|
<Hotkey
|
|
|
|
keyBindings={hotKeyRegistry[hotKeyRefs.REQUEST_SHOW_CREATE.id]}
|
2021-08-07 08:03:56 +00:00
|
|
|
useFallbackMessage
|
|
|
|
/>
|
2021-07-14 00:10:49 +00:00
|
|
|
</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Switch Requests</td>
|
|
|
|
<td className="text-right">
|
|
|
|
<code>
|
|
|
|
<Hotkey
|
|
|
|
keyBindings={hotKeyRegistry[hotKeyRefs.REQUEST_QUICK_SWITCH.id]}
|
2021-08-07 08:03:56 +00:00
|
|
|
useFallbackMessage
|
|
|
|
/>
|
2021-07-14 00:10:49 +00:00
|
|
|
</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Edit Environments</td>
|
|
|
|
<td className="text-right">
|
|
|
|
<code>
|
|
|
|
<Hotkey
|
|
|
|
keyBindings={hotKeyRegistry[hotKeyRefs.ENVIRONMENT_SHOW_EDITOR.id]}
|
2021-08-07 08:03:56 +00:00
|
|
|
useFallbackMessage
|
|
|
|
/>
|
2021-07-14 00:10:49 +00:00
|
|
|
</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div className="text-center pane__body--placeholder__cta">
|
|
|
|
<button className="btn inline-block btn--clicky" onClick={handleImportFile}>
|
2021-07-29 15:52:17 +00:00
|
|
|
Import from File
|
2021-07-14 00:10:49 +00:00
|
|
|
</button>
|
|
|
|
<button className="btn inline-block btn--clicky" onClick={handleCreateRequest}>
|
2021-07-29 15:52:17 +00:00
|
|
|
New Request
|
2021-07-14 00:10:49 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
2020-11-02 22:09:45 +00:00
|
|
|
</div>
|
2021-07-14 00:10:49 +00:00
|
|
|
</PaneBody>
|
|
|
|
</Pane>
|
|
|
|
);
|
|
|
|
};
|