feat: vertical and horizontal layout support
This commit is contained in:
1
packages/hoppscotch-app/assets/icons/columns.svg
Normal file
1
packages/hoppscotch-app/assets/icons/columns.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7m0-18H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7m0-18v18"></path></svg>
|
||||||
|
After Width: | Height: | Size: 295 B |
@@ -118,6 +118,14 @@
|
|||||||
:title="$t('request.share')"
|
:title="$t('request.share')"
|
||||||
@click.native="nativeShare()"
|
@click.native="nativeShare()"
|
||||||
/>
|
/>
|
||||||
|
<ButtonSecondary
|
||||||
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
|
:title="COLUMN_LAYOUT ? $t('layout.row') : $t('layout.column')"
|
||||||
|
svg="columns"
|
||||||
|
class="transform"
|
||||||
|
:class="{ 'rotate-90': !COLUMN_LAYOUT }"
|
||||||
|
@click.native="COLUMN_LAYOUT = !COLUMN_LAYOUT"
|
||||||
|
/>
|
||||||
<ButtonSecondary
|
<ButtonSecondary
|
||||||
v-tippy="{ theme: 'tooltip' }"
|
v-tippy="{ theme: 'tooltip' }"
|
||||||
:title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
|
:title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
|
||||||
@@ -156,6 +164,7 @@ export default defineComponent({
|
|||||||
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
|
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
ZEN_MODE: useSetting("ZEN_MODE"),
|
ZEN_MODE: useSetting("ZEN_MODE"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
|
|
||||||
navigatorShare: !!navigator.share,
|
navigatorShare: !!navigator.share,
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
||||||
>
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<AppSection label="request">
|
<AppSection label="request">
|
||||||
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
||||||
@@ -156,6 +160,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
windowInnerWidth: useWindowSize(),
|
windowInnerWidth: useWindowSize(),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
||||||
>
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<AppSection label="request">
|
<AppSection label="request">
|
||||||
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
||||||
@@ -176,6 +180,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
windowInnerWidth: useWindowSize(),
|
windowInnerWidth: useWindowSize(),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
||||||
<div class="space-x-2 flex-1 inline-flex">
|
<div class="space-x-2 flex-1 inline-flex">
|
||||||
@@ -91,9 +95,15 @@ import { Splitpanes, Pane } from "splitpanes"
|
|||||||
import "splitpanes/dist/splitpanes.css"
|
import "splitpanes/dist/splitpanes.css"
|
||||||
import debounce from "lodash/debounce"
|
import debounce from "lodash/debounce"
|
||||||
import { logHoppRequestRunToAnalytics } from "~/helpers/fb/analytics"
|
import { logHoppRequestRunToAnalytics } from "~/helpers/fb/analytics"
|
||||||
|
import { useSetting } from "~/newstore/settings"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { Splitpanes, Pane },
|
components: { Splitpanes, Pane },
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
connectionSSEState: false,
|
connectionSSEState: false,
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
||||||
>
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<AppSection label="request">
|
<AppSection label="request">
|
||||||
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
<div class="bg-primary flex p-4 top-0 z-10 sticky">
|
||||||
@@ -216,6 +220,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
windowInnerWidth: useWindowSize(),
|
windowInnerWidth: useWindowSize(),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -61,19 +61,24 @@ import useWindowSize from "~/helpers/utils/useWindowSize"
|
|||||||
|
|
||||||
function appLayout() {
|
function appLayout() {
|
||||||
const rightSidebar = useSetting("RIGHT_SIDEBAR")
|
const rightSidebar = useSetting("RIGHT_SIDEBAR")
|
||||||
|
const columnLayout = useSetting("COLUMN_LAYOUT")
|
||||||
const windowInnerWidth = useWindowSize()
|
const windowInnerWidth = useWindowSize()
|
||||||
|
|
||||||
// Initially apply
|
// Initially apply
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
if (windowInnerWidth.x.value < 768) rightSidebar.value = false
|
if (windowInnerWidth.x.value < 768) {
|
||||||
|
rightSidebar.value = false
|
||||||
|
columnLayout.value = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Listen for updates
|
// Listen for updates
|
||||||
watch(windowInnerWidth.x, () =>
|
watch(windowInnerWidth.x, () => {
|
||||||
windowInnerWidth.x.value >= 768
|
if (windowInnerWidth.x.value < 768) {
|
||||||
? (rightSidebar.value = true)
|
rightSidebar.value = false
|
||||||
: (rightSidebar.value = false)
|
columnLayout.value = true
|
||||||
)
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateThemes() {
|
function updateThemes() {
|
||||||
|
|||||||
@@ -219,6 +219,8 @@
|
|||||||
"title": "Import"
|
"title": "Import"
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
|
"column": "Column layout",
|
||||||
|
"row": "Row layout",
|
||||||
"zen_mode": "Zen mode"
|
"zen_mode": "Zen mode"
|
||||||
},
|
},
|
||||||
"modal": {
|
"modal": {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export type SettingsType = {
|
|||||||
RIGHT_SIDEBAR: boolean
|
RIGHT_SIDEBAR: boolean
|
||||||
ZEN_MODE: boolean
|
ZEN_MODE: boolean
|
||||||
FONT_SIZE: HoppFontSize
|
FONT_SIZE: HoppFontSize
|
||||||
|
COLUMN_LAYOUT: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultSettings: SettingsType = {
|
export const defaultSettings: SettingsType = {
|
||||||
@@ -78,6 +79,7 @@ export const defaultSettings: SettingsType = {
|
|||||||
RIGHT_SIDEBAR: true,
|
RIGHT_SIDEBAR: true,
|
||||||
ZEN_MODE: false,
|
ZEN_MODE: false,
|
||||||
FONT_SIZE: "small",
|
FONT_SIZE: "small",
|
||||||
|
COLUMN_LAYOUT: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
const validKeys = Object.keys(defaultSettings)
|
const validKeys = Object.keys(defaultSettings)
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
||||||
>
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<AppSection label="import">
|
<AppSection label="import">
|
||||||
<div class="flex p-4 items-start justify-between">
|
<div class="flex p-4 items-start justify-between">
|
||||||
@@ -190,6 +194,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
windowInnerWidth: useWindowSize(),
|
windowInnerWidth: useWindowSize(),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
currentUser: useReadonlyStream(currentUser$, null),
|
currentUser: useReadonlyStream(currentUser$, null),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
||||||
>
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<GraphqlRequest :conn="gqlConn" />
|
<GraphqlRequest :conn="gqlConn" />
|
||||||
<GraphqlRequestOptions :conn="gqlConn" />
|
<GraphqlRequestOptions :conn="gqlConn" />
|
||||||
@@ -59,6 +63,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
windowInnerWidth: useWindowSize(),
|
windowInnerWidth: useWindowSize(),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
gqlConn,
|
gqlConn,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
:horizontal="!(windowInnerWidth.x.value >= 768)"
|
||||||
>
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<Splitpanes class="smart-splitter" :dbl-click-splitter="false" horizontal>
|
<Splitpanes
|
||||||
|
class="smart-splitter"
|
||||||
|
:dbl-click-splitter="false"
|
||||||
|
:horizontal="COLUMN_LAYOUT"
|
||||||
|
>
|
||||||
<Pane class="hide-scrollbar !overflow-auto">
|
<Pane class="hide-scrollbar !overflow-auto">
|
||||||
<HttpRequest />
|
<HttpRequest />
|
||||||
<SmartTabs styles="sticky bg-primary top-upperPrimaryStickyFold z-10">
|
<SmartTabs styles="sticky bg-primary top-upperPrimaryStickyFold z-10">
|
||||||
@@ -279,6 +283,7 @@ export default defineComponent({
|
|||||||
null
|
null
|
||||||
),
|
),
|
||||||
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
|
||||||
|
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
|
||||||
confirmSync,
|
confirmSync,
|
||||||
syncRequest,
|
syncRequest,
|
||||||
oAuthURL,
|
oAuthURL,
|
||||||
|
|||||||
@@ -417,7 +417,6 @@ export default defineComponent({
|
|||||||
watch: {
|
watch: {
|
||||||
ZEN_MODE(ZEN_MODE) {
|
ZEN_MODE(ZEN_MODE) {
|
||||||
this.applySetting("LEFT_SIDEBAR", !ZEN_MODE)
|
this.applySetting("LEFT_SIDEBAR", !ZEN_MODE)
|
||||||
// this.applySetting("RIGHT_SIDEBAR", !ZEN_MODE)
|
|
||||||
},
|
},
|
||||||
proxySettings: {
|
proxySettings: {
|
||||||
deep: true,
|
deep: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user