feat: share and support modals

This commit is contained in:
liyasthomas
2021-08-09 17:55:30 +05:30
parent cbf99d2daf
commit aa8b4231e2
27 changed files with 425 additions and 27 deletions

View File

@@ -17,6 +17,8 @@ export type HoppAction =
| "request.method.put" // Select PUT Method
| "request.method.delete" // Select DELETE Method
| "flyouts.keybinds.toggle" // Shows the keybinds flyout
| "modals.support.toggle" // Shows the support modal
| "modals.share.toggle" // Shows the share modal
type BoundActionList = {
// eslint-disable-next-line no-unused-vars

View File

@@ -17,10 +17,49 @@ let keybindingsEnabled = true
type ModifierKeys = "ctrl" | "alt"
/* eslint-disable prettier/prettier */
type Key = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k'
| 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x'
| 'y' | 'z' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
| "up" | "down" | "left" | "right" | "?"
type Key =
| "a"
| "b"
| "c"
| "d"
| "e"
| "f"
| "g"
| "h"
| "i"
| "j"
| "k"
| "l"
| "m"
| "n"
| "o"
| "p"
| "q"
| "r"
| "s"
| "t"
| "u"
| "v"
| "w"
| "x"
| "y"
| "z"
| "0"
| "1"
| "2"
| "3"
| "4"
| "5"
| "6"
| "7"
| "8"
| "9"
| "up"
| "down"
| "left"
| "right"
| "/"
| "?"
/* eslint-enable */
type ModifierBasedShortcutKey = `${ModifierKeys}-${Key}`
@@ -44,7 +83,9 @@ export const bindings: {
"alt-p": "request.method.post",
"alt-u": "request.method.put",
"alt-x": "request.method.delete",
"?": "flyouts.keybinds.toggle",
"/": "flyouts.keybinds.toggle",
"?": "modals.support.toggle",
"ctrl-x": "modals.share.toggle",
}
/**
@@ -115,6 +156,9 @@ function getPressedKey(ev: KeyboardEvent): Key | null {
// Check if question mark
if (val === "?") return "?"
// Check if question mark
if (val === "/") return "/"
// If no other cases match, this is not a valid key
return null
}

4
helpers/support.js Normal file
View File

@@ -0,0 +1,4 @@
export const showChat = () => {
$crisp.push(["do", "chat:show"])
$crisp.push(["do", "chat:open"])
}