Skip to content

Commit

Permalink
🚀 Add hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovizuete committed Oct 5, 2022
1 parent 05bad0a commit 4a707aa
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"monaco-editor": "0.34.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-hotkeys-hook": "3.4.7",
"react-split": "2.0.14"
},
"devDependencies": {
Expand Down
17 changes: 17 additions & 0 deletions src/components/QueryForm/QueryForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "@blueprintjs/core";
import { Popover2 } from "@blueprintjs/popover2";
import { Allotment } from "allotment";
import { useHotkeys } from "react-hotkeys-hook";

import { GitHubIcon } from "../svgs/GitHub";
import Editor from "./components/Editor";
Expand Down Expand Up @@ -50,6 +51,22 @@ export default function QueryForm(props: QueryFormParams) {
handleOnAddParameter,
} = useQueryFormParamaterHandler({ params, setParams });

useHotkeys(
"ctrl+enter, cmd+enter",
() => {
runQuery();
},
[runQuery]
);

useHotkeys(
"ctrl+shift+p, cmd+shift+p",
() => {
handleOnAddParameter();
},
[handleOnAddParameter]
);

return (
<>
<Allotment vertical>
Expand Down
6 changes: 5 additions & 1 deletion src/components/Result/TableResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ export default function TableResult({ result }: Params) {
<div className="border border-gray-300 overflow-auto h-full">
<Table2
numRows={result.rows}
selectionModes={SelectionModes.NONE}
selectionModes={SelectionModes.ROWS_ONLY}
className="h-full"
enableColumnResizing={false}
enableColumnReordering={false}
enableRowResizing={false}
enableRowReordering={false}
>
{tableDatasetComponents}
</Table2>
Expand Down

0 comments on commit 4a707aa

Please sign in to comment.