feat: more actions & shortcuts

This commit is contained in:
liyasthomas
2021-08-11 14:16:43 +05:30
parent 384e4ce43e
commit 829e116e04
13 changed files with 256 additions and 146 deletions

View File

@@ -235,8 +235,8 @@ pre.ace_editor {
} }
.select-wrapper { .select-wrapper {
@apply flex flex-1;
@apply relative; @apply relative;
@apply w-full;
@apply cursor-pointer; @apply cursor-pointer;
&::after { &::after {
@@ -255,16 +255,18 @@ pre.ace_editor {
} }
.search-wrapper { .search-wrapper {
@apply flex flex-1;
@apply relative; @apply relative;
@apply w-full;
&::after { &::after {
@apply absolute; @apply absolute;
@apply inline-block; @apply flex;
@apply inset-y-0;
@apply items-center;
@apply justify-center;
@apply pointer-events-none; @apply pointer-events-none;
@apply font-icon; @apply font-icon;
@apply text-secondaryLight; @apply text-secondaryLight;
@apply top-2;
@apply left-3; @apply left-3;
content: "\e8b6"; content: "\e8b6";

View File

@@ -3,7 +3,6 @@
<template #content> <template #content>
<div <div
class=" class="
bg-primary
border-b border-dividerLight border-b border-dividerLight
flex flex
p-2 p-2
@@ -19,15 +18,29 @@
<ButtonSecondary icon="close" @click.native="close()" /> <ButtonSecondary icon="close" @click.native="close()" />
</div> </div>
</div> </div>
<!-- <div class="search-wrapper"> <div class="border-b border-dividerLight">
<input <div class="flex flex-col my-4 mx-6 search-wrapper">
v-model="filterText" <input
v-focus v-model="filterText"
type="search" type="search"
class="bg-primaryLight border-b border-dividerLight flex font-semibold font-mono w-full py-2 pr-2 pl-8 truncate focus:outline-none" class="
:placeholder="$t('search')" bg-primaryLight
/> border border-dividerLight
</div> --> rounded
flex
font-semibold font-mono
w-full
py-2
pr-2
pl-8
transition
truncate
focus:border-divider focus:outline-none
"
:placeholder="$t('search')"
/>
</div>
</div>
<div <div
class=" class="
divide-y divide-dividerLight divide-y divide-dividerLight

View File

@@ -21,12 +21,12 @@
bg-primaryLight bg-primaryLight
border-b border-dividerLight border-b border-dividerLight
flex flex
font-medium font-semibold
w-full w-full
py-2 py-2
px-4 px-4
focus:outline-none
appearance-none appearance-none
focus:outline-none
" "
@change="updateSelectedTeam(myTeams[$event.target.value])" @change="updateSelectedTeam(myTeams[$event.target.value])"
> >

View File

@@ -18,12 +18,12 @@
bg-primaryLight bg-primaryLight
border-b border-dividerLight border-b border-dividerLight
flex flex
font-semibold font-mono font-semibold
w-full w-full
py-2 py-2
px-4 px-4
focus:outline-none
appearance-none appearance-none
focus:outline-none
" "
> >
<option :value="-1">No environment</option> <option :value="-1">No environment</option>

View File

@@ -135,32 +135,34 @@
</SmartDeletableChip> </SmartDeletableChip>
</div> </div>
</div> </div>
<ButtonSecondary <span>
v-tippy="{ theme: 'tooltip' }" <ButtonSecondary
:title=" v-tippy="{ theme: 'tooltip' }"
param.hasOwnProperty('active') :title="
? param.active param.hasOwnProperty('active')
? $t('action.turn_off') ? param.active
: $t('action.turn_on') ? $t('action.turn_off')
: $t('action.turn_off') : $t('action.turn_on')
" : $t('action.turn_off')
:icon=" "
param.hasOwnProperty('active') :icon="
? param.active param.hasOwnProperty('active')
? 'check_box' ? param.active
: 'check_box_outline_blank' ? 'check_box'
: 'check_box' : 'check_box_outline_blank'
" : 'check_box'
color="green" "
@click.native=" color="green"
updateBodyParam(index, { @click.native="
key: param.key, updateBodyParam(index, {
value: param.value, key: param.key,
active: param.hasOwnProperty('active') ? !param.active : false, value: param.value,
}) active: param.hasOwnProperty('active') ? !param.active : false,
" })
/> "
<div> />
</span>
<span>
<label for="attachment" class="p-0"> <label for="attachment" class="p-0">
<ButtonSecondary <ButtonSecondary
class="w-full" class="w-full"
@@ -176,14 +178,16 @@
multiple multiple
@change="setRequestAttachment($event, index)" @change="setRequestAttachment($event, index)"
/> />
</div> </span>
<ButtonSecondary <span>
v-tippy="{ theme: 'tooltip' }" <ButtonSecondary
:title="$t('delete')" v-tippy="{ theme: 'tooltip' }"
icon="delete" :title="$t('delete')"
color="red" icon="delete"
@click.native="deleteBodyParam(index)" color="red"
/> @click.native="deleteBodyParam(index)"
/>
</span>
</div> </div>
<div <div
v-if="bodyParams.length === 0" v-if="bodyParams.length === 0"

View File

@@ -103,38 +103,42 @@
}) })
" "
/> />
<ButtonSecondary <span>
v-tippy="{ theme: 'tooltip' }" <ButtonSecondary
:title=" v-tippy="{ theme: 'tooltip' }"
header.hasOwnProperty('active') :title="
? header.active header.hasOwnProperty('active')
? $t('action.turn_off') ? header.active
: $t('action.turn_on') ? $t('action.turn_off')
: $t('action.turn_off') : $t('action.turn_on')
" : $t('action.turn_off')
:icon=" "
header.hasOwnProperty('active') :icon="
? header.active header.hasOwnProperty('active')
? 'check_box' ? header.active
: 'check_box_outline_blank' ? 'check_box'
: 'check_box' : 'check_box_outline_blank'
" : 'check_box'
color="green" "
@click.native=" color="green"
updateHeader(index, { @click.native="
key: header.key, updateHeader(index, {
value: header.value, key: header.key,
active: header.hasOwnProperty('active') ? !header.active : false, value: header.value,
}) active: header.hasOwnProperty('active') ? !header.active : false,
" })
/> "
<ButtonSecondary />
v-tippy="{ theme: 'tooltip' }" </span>
:title="$t('delete')" <span>
icon="delete" <ButtonSecondary
color="red" v-tippy="{ theme: 'tooltip' }"
@click.native="deleteHeader(index)" :title="$t('delete')"
/> icon="delete"
color="red"
@click.native="deleteHeader(index)"
/>
</span>
</div> </div>
<div <div
v-if="headers$.length === 0" v-if="headers$.length === 0"

View File

@@ -124,38 +124,42 @@
}) })
" "
/> />
<ButtonSecondary <span>
v-tippy="{ theme: 'tooltip' }" <ButtonSecondary
:title=" v-tippy="{ theme: 'tooltip' }"
param.hasOwnProperty('active') :title="
? param.active param.hasOwnProperty('active')
? $t('action.turn_off') ? param.active
: $t('action.turn_on') ? $t('action.turn_off')
: $t('action.turn_off') : $t('action.turn_on')
" : $t('action.turn_off')
:icon=" "
param.hasOwnProperty('active') :icon="
? param.active param.hasOwnProperty('active')
? 'check_box' ? param.active
: 'check_box_outline_blank' ? 'check_box'
: 'check_box' : 'check_box_outline_blank'
" : 'check_box'
color="green" "
@click.native=" color="green"
updateParam(index, { @click.native="
key: param.key, updateParam(index, {
value: param.value, key: param.key,
active: param.hasOwnProperty('active') ? !param.active : false, value: param.value,
}) active: param.hasOwnProperty('active') ? !param.active : false,
" })
/> "
<ButtonSecondary />
v-tippy="{ theme: 'tooltip' }" </span>
:title="$t('delete')" <span>
icon="delete" <ButtonSecondary
color="red" v-tippy="{ theme: 'tooltip' }"
@click.native="deleteParam(index)" :title="$t('delete')"
/> icon="delete"
color="red"
@click.native="deleteParam(index)"
/>
</span>
</div> </div>
<div <div
v-if="params$.length === 0" v-if="params$.length === 0"

View File

@@ -97,7 +97,7 @@
name="message" name="message"
type="text" type="text"
/> />
<div class="flex"> <span>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title=" :title="
@@ -121,8 +121,8 @@
: false : false
" "
/> />
</div> </span>
<div class="flex"> <span>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('delete')" :title="$t('delete')"
@@ -130,7 +130,7 @@
color="red" color="red"
@click.native="deleteProtocol({ index })" @click.native="deleteProtocol({ index })"
/> />
</div> </span>
</div> </div>
<div <div
v-if="protocols.length === 0" v-if="protocols.length === 0"

View File

@@ -20,11 +20,13 @@ export type HoppAction =
| "modals.search.toggle" // Shows the search modal | "modals.search.toggle" // Shows the search modal
| "modals.support.toggle" // Shows the support modal | "modals.support.toggle" // Shows the support modal
| "modals.share.toggle" // Shows the share modal | "modals.share.toggle" // Shows the share modal
| "navigation.rest.jump" // Jump to REST page | "navigation.jump.rest" // Jump to REST page
| "navigation.graphql.jump" // Jump to GraphQL page | "navigation.jump.graphql" // Jump to GraphQL page
| "navigation.realtime.jump" // Jump to realtime page | "navigation.jump.realtime" // Jump to realtime page
| "navigation.documentation.jump" // Jump to documentation page | "navigation.jump.documentation" // Jump to documentation page
| "navigation.settings.jump" // Jump to settings page | "navigation.jump.settings" // Jump to settings page
| "navigation.jump.back" // Jump to previous page
| "navigation.jump.forward" // Jump to next page
type BoundActionList = { type BoundActionList = {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars

View File

@@ -86,12 +86,14 @@ export const bindings: {
"ctrl-k": "flyouts.keybinds.toggle", "ctrl-k": "flyouts.keybinds.toggle",
"/": "modals.search.toggle", "/": "modals.search.toggle",
"?": "modals.support.toggle", "?": "modals.support.toggle",
"ctrl-x": "modals.share.toggle", "ctrl-m": "modals.share.toggle",
"alt-r": "navigation.rest.jump", "alt-r": "navigation.jump.rest",
"alt-q": "navigation.graphql.jump", "alt-q": "navigation.jump.graphql",
"alt-w": "navigation.realtime.jump", "alt-w": "navigation.jump.realtime",
"alt-d": "navigation.documentation.jump", "alt-d": "navigation.jump.documentation",
"alt-s": "navigation.settings.jump", "alt-s": "navigation.jump.settings",
"ctrl-left": "navigation.jump.back",
"ctrl-right": "navigation.jump.forward",
} }
/** /**

View File

@@ -71,6 +71,48 @@ export default [
}, },
], ],
}, },
{
section: "Navigation",
shortcuts: [
{
keys: [getPlatformSpecialKey(), "←"],
label: "shortcut.navigation.back",
},
{
keys: [getPlatformSpecialKey(), "→"],
label: "shortcut.navigation.forward",
},
{
keys: [getPlatformAlternateKey(), "R"],
label: "shortcut.navigation.rest",
},
{
keys: [getPlatformAlternateKey(), "Q"],
label: "shortcut.navigation.graphql",
},
{
keys: [getPlatformAlternateKey(), "W"],
label: "shortcut.navigation.realtime",
},
{
keys: [getPlatformAlternateKey(), "D"],
label: "shortcut.navigation.documentation",
},
{
keys: [getPlatformAlternateKey(), "S"],
label: "shortcut.navigation.settings",
},
],
},
{
section: "Miscellaneous",
shortcuts: [
{
keys: [getPlatformSpecialKey(), "M"],
label: "shortcut.miscellaneous.invite",
},
],
},
] ]
export const spotlight = [ export const spotlight = [
@@ -108,24 +150,38 @@ export const spotlight = [
{ {
section: "Navigation", section: "Navigation",
shortcuts: [ shortcuts: [
{
keys: [getPlatformSpecialKey(), "←"],
label: "shortcut.navigation.back",
action: "navigation.jump.back",
icon: "arrow_forward",
keywords: ["back", "jump", "page", "navigation"],
},
{
keys: [getPlatformSpecialKey(), "→"],
label: "shortcut.navigation.forward",
action: "navigation.jump.forward",
icon: "arrow_forward",
keywords: ["forward", "jump", "page", "navigation"],
},
{ {
keys: [getPlatformAlternateKey(), "R"], keys: [getPlatformAlternateKey(), "R"],
label: "shortcut.navigation.rest", label: "shortcut.navigation.rest",
action: "navigation.rest.jump", action: "navigation.jump.rest",
icon: "arrow_forward", icon: "arrow_forward",
keywords: ["rest", "jump", "page", "navigation"], keywords: ["rest", "jump", "page", "navigation"],
}, },
{ {
keys: [getPlatformAlternateKey(), "Q"], keys: [getPlatformAlternateKey(), "Q"],
label: "shortcut.navigation.graphql", label: "shortcut.navigation.graphql",
action: "navigation.graphql.jump", action: "navigation.jump.graphql",
icon: "arrow_forward", icon: "arrow_forward",
keywords: ["graphql", "jump", "page", "navigation"], keywords: ["graphql", "jump", "page", "navigation"],
}, },
{ {
keys: [getPlatformAlternateKey(), "W"], keys: [getPlatformAlternateKey(), "W"],
label: "shortcut.navigation.realtime", label: "shortcut.navigation.realtime",
action: "navigation.realtime.jump", action: "navigation.jump.realtime",
icon: "arrow_forward", icon: "arrow_forward",
keywords: [ keywords: [
"realtime", "realtime",
@@ -141,14 +197,14 @@ export const spotlight = [
{ {
keys: [getPlatformAlternateKey(), "D"], keys: [getPlatformAlternateKey(), "D"],
label: "shortcut.navigation.documentation", label: "shortcut.navigation.documentation",
action: "navigation.documentation.jump", action: "navigation.jump.documentation",
icon: "arrow_forward", icon: "arrow_forward",
keywords: ["documentation", "jump", "page", "navigation"], keywords: ["documentation", "jump", "page", "navigation"],
}, },
{ {
keys: [getPlatformAlternateKey(), "S"], keys: [getPlatformAlternateKey(), "S"],
label: "shortcut.navigation.settings", label: "shortcut.navigation.settings",
action: "navigation.settings.jump", action: "navigation.jump.settings",
icon: "arrow_forward", icon: "arrow_forward",
keywords: [ keywords: [
"settings", "settings",
@@ -161,4 +217,16 @@ export const spotlight = [
}, },
], ],
}, },
{
section: "Miscellaneous",
shortcuts: [
{
keys: [getPlatformSpecialKey(), "M"],
label: "shortcut.miscellaneous.invite",
action: "modals.share.toggle",
icon: "person_add_alt",
keywords: ["invite", "share", "app", "social"],
},
],
},
] ]

View File

@@ -216,11 +216,16 @@
"close_current_menu": "Close current menu" "close_current_menu": "Close current menu"
}, },
"navigation": { "navigation": {
"rest": "Go to REST", "rest": "Go to REST page",
"graphql": "Go to GraphQL", "graphql": "Go to GraphQL page",
"realtime": "Go to realtime", "realtime": "Go to Realtime page",
"documentation": "Go to documentation", "documentation": "Go to Documentation page",
"settings": "Go to settings" "settings": "Go to Settings page",
"back": "Go back to previous page",
"forward": "Go forward to next page"
},
"miscellaneous": {
"invite": "Invite people to Hoppscotch"
}, },
"send_request": "Send Request", "send_request": "Send Request",
"save_to_collections": "Save to Collections", "save_to_collections": "Save to Collections",

View File

@@ -54,21 +54,27 @@ export default defineComponent({
setup() { setup() {
hookKeybindingsListener() hookKeybindingsListener()
const router = useRouter() const router = useRouter()
defineActionHandler("navigation.rest.jump", () => { defineActionHandler("navigation.jump.rest", () => {
router.push({ path: "/" }) router.push({ path: "/" })
}) })
defineActionHandler("navigation.graphql.jump", () => { defineActionHandler("navigation.jump.graphql", () => {
router.push({ path: "/graphql" }) router.push({ path: "/graphql" })
}) })
defineActionHandler("navigation.realtime.jump", () => { defineActionHandler("navigation.jump.realtime", () => {
router.push({ path: "/realtime" }) router.push({ path: "/realtime" })
}) })
defineActionHandler("navigation.documentation.jump", () => { defineActionHandler("navigation.jump.documentation", () => {
router.push({ path: "/documentation" }) router.push({ path: "/documentation" })
}) })
defineActionHandler("navigation.settings.jump", () => { defineActionHandler("navigation.jump.settings", () => {
router.push({ path: "/settings" }) router.push({ path: "/settings" })
}) })
defineActionHandler("navigation.jump.back", () => {
router.go(-1)
})
defineActionHandler("navigation.jump.forward", () => {
router.go(1)
})
}, },
data() { data() {
return { return {