Skip to content

Commit

Permalink
feat: support to move sidebar to left - fixed hoppscotch#1933
Browse files Browse the repository at this point in the history
  • Loading branch information
liyasthomas committed Nov 4, 2021
1 parent 45e508f commit d3a1898
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 111 deletions.
37 changes: 23 additions & 14 deletions packages/hoppscotch-app/components/app/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
<div class="flex">
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
:title="LEFT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
:title="EXPAND_NAVIGATION ? $t('hide.sidebar') : $t('show.sidebar')"
svg="sidebar"
:class="{ 'transform -rotate-180': !LEFT_SIDEBAR }"
@click.native="LEFT_SIDEBAR = !LEFT_SIDEBAR"
class="transform"
:class="{ '-rotate-180': !EXPAND_NAVIGATION }"
@click.native="EXPAND_NAVIGATION = !EXPAND_NAVIGATION"
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
Expand Down Expand Up @@ -133,14 +134,21 @@
:class="{ 'rotate-90': !COLUMN_LAYOUT }"
@click.native="COLUMN_LAYOUT = !COLUMN_LAYOUT"
/>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
:title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
svg="sidebar"
class="transform rotate-180"
:class="{ 'rotate-360': !RIGHT_SIDEBAR }"
@click.native="RIGHT_SIDEBAR = !RIGHT_SIDEBAR"
/>
<span
class="transform transition"
:class="{
'rotate-180': SIDEBAR_ON_LEFT,
}"
>
<ButtonSecondary
v-tippy="{ theme: 'tooltip' }"
:title="SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
svg="sidebar"
class="transform"
:class="{ 'rotate-180': !SIDEBAR }"
@click.native="SIDEBAR = !SIDEBAR"
/>
</span>
</div>
</div>
<AppShortcuts :show="showShortcuts" @close="showShortcuts = false" />
Expand Down Expand Up @@ -168,10 +176,11 @@ export default defineComponent({
})
return {
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
EXPAND_NAVIGATION: useSetting("EXPAND_NAVIGATION"),
SIDEBAR: useSetting("SIDEBAR"),
ZEN_MODE: useSetting("ZEN_MODE"),
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
SIDEBAR_ON_LEFT: useSetting("SIDEBAR_ON_LEFT"),
navigatorShare: !!navigator.share,
Expand All @@ -181,7 +190,7 @@ export default defineComponent({
},
watch: {
ZEN_MODE() {
this.LEFT_SIDEBAR = !this.ZEN_MODE
this.EXPAND_NAVIGATION = !this.ZEN_MODE
},
},
methods: {
Expand Down
6 changes: 3 additions & 3 deletions packages/hoppscotch-app/components/app/Sidenav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<div v-if="navigation.svg">
<SmartIcon :name="navigation.svg" class="svg-icons" />
</div>
<span v-if="LEFT_SIDEBAR">{{ navigation.title }}</span>
<span v-if="EXPAND_NAVIGATION">{{ navigation.title }}</span>
<tippy
v-if="!LEFT_SIDEBAR"
v-if="!EXPAND_NAVIGATION"
:placement="windowInnerWidth.x.value >= 768 ? 'right' : 'bottom'"
theme="tooltip"
:content="navigation.title"
Expand All @@ -35,7 +35,7 @@ export default defineComponent({
setup() {
return {
windowInnerWidth: useWindowSize(),
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
EXPAND_NAVIGATION: useSetting("EXPAND_NAVIGATION"),
}
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion packages/hoppscotch-app/components/button/Secondary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'border border-divider hover:border-dividerDark focus-visible:border-dividerDark':
outline,
},
{ 'bg-primaryDark': filled },
{ '!bg-primaryDark': filled },
]"
:disabled="disabled"
tabindex="0"
Expand Down
19 changes: 9 additions & 10 deletions packages/hoppscotch-app/components/realtime/Mqtt.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<template>
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:rtl="SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768"
:class="{
'!flex-row-reverse': SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768,
}"
:horizontal="!(windowInnerWidth.x.value >= 768)"
>
<Pane class="hide-scrollbar !overflow-auto">
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:horizontal="COLUMN_LAYOUT"
>
<Pane size="75" min-size="65" class="hide-scrollbar !overflow-auto">
<Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
<Pane class="hide-scrollbar !overflow-auto">
<AppSection label="request">
<div class="bg-primary flex p-4 top-0 z-10 sticky">
Expand Down Expand Up @@ -60,8 +59,7 @@
</Splitpanes>
</Pane>
<Pane
v-if="RIGHT_SIDEBAR"
max-size="35"
v-if="SIDEBAR"
size="25"
min-size="20"
class="hide-scrollbar !overflow-auto"
Expand Down Expand Up @@ -160,8 +158,9 @@ export default defineComponent({
setup() {
return {
windowInnerWidth: useWindowSize(),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
SIDEBAR: useSetting("SIDEBAR"),
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
SIDEBAR_ON_LEFT: useSetting("SIDEBAR_ON_LEFT"),
}
},
data() {
Expand Down
19 changes: 9 additions & 10 deletions packages/hoppscotch-app/components/realtime/Socketio.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<template>
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:rtl="SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768"
:class="{
'!flex-row-reverse': SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768,
}"
:horizontal="!(windowInnerWidth.x.value >= 768)"
>
<Pane class="hide-scrollbar !overflow-auto">
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:horizontal="COLUMN_LAYOUT"
>
<Pane size="75" min-size="65" class="hide-scrollbar !overflow-auto">
<Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
<Pane class="hide-scrollbar !overflow-auto">
<AppSection label="request">
<div class="bg-primary flex p-4 top-0 z-10 sticky">
Expand Down Expand Up @@ -127,8 +126,7 @@
</Splitpanes>
</Pane>
<Pane
v-if="RIGHT_SIDEBAR"
max-size="35"
v-if="SIDEBAR"
size="25"
min-size="20"
class="hide-scrollbar !overflow-auto"
Expand Down Expand Up @@ -233,8 +231,9 @@ export default defineComponent({
setup() {
return {
windowInnerWidth: useWindowSize(),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
SIDEBAR: useSetting("SIDEBAR"),
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
SIDEBAR_ON_LEFT: useSetting("SIDEBAR_ON_LEFT"),
socketIoClients,
}
},
Expand Down
6 changes: 1 addition & 5 deletions packages/hoppscotch-app/components/realtime/Sse.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<template>
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:horizontal="COLUMN_LAYOUT"
>
<Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
<Pane class="hide-scrollbar !overflow-auto">
<div class="bg-primary flex p-4 top-0 z-10 sticky">
<div class="space-x-2 flex-1 inline-flex">
Expand Down
19 changes: 9 additions & 10 deletions packages/hoppscotch-app/components/realtime/Websocket.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<template>
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:rtl="SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768"
:class="{
'!flex-row-reverse': SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768,
}"
:horizontal="!(windowInnerWidth.x.value >= 768)"
>
<Pane class="hide-scrollbar !overflow-auto">
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:horizontal="COLUMN_LAYOUT"
>
<Pane size="75" min-size="65" class="hide-scrollbar !overflow-auto">
<Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
<Pane class="hide-scrollbar !overflow-auto">
<AppSection label="request">
<div class="bg-primary flex p-4 top-0 z-10 sticky">
Expand Down Expand Up @@ -175,8 +174,7 @@
</Splitpanes>
</Pane>
<Pane
v-if="RIGHT_SIDEBAR"
max-size="35"
v-if="SIDEBAR"
size="25"
min-size="20"
class="hide-scrollbar !overflow-auto"
Expand Down Expand Up @@ -231,8 +229,9 @@ export default defineComponent({
setup() {
return {
windowInnerWidth: useWindowSize(),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
SIDEBAR: useSetting("SIDEBAR"),
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
SIDEBAR_ON_LEFT: useSetting("SIDEBAR_ON_LEFT"),
}
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion packages/hoppscotch-app/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { defineActionHandler } from "~/helpers/actions"
import useWindowSize from "~/helpers/utils/useWindowSize"
function appLayout() {
const rightSidebar = useSetting("RIGHT_SIDEBAR")
const rightSidebar = useSetting("SIDEBAR")
const columnLayout = useSetting("COLUMN_LAYOUT")
const windowInnerWidth = useWindowSize()
Expand Down
3 changes: 2 additions & 1 deletion packages/hoppscotch-app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@
"account_name_description": "This is your display name.",
"background": "Background",
"black_mode": "Black",
"sidebar_on_left": "Sidebar on left",
"change_font_size": "Change font size",
"choose_language": "Choose language",
"dark_mode": "Dark",
Expand All @@ -347,7 +348,7 @@
"interceptor_description": "Middleware between application and APIs.",
"language": "Language",
"light_mode": "Light",
"navigation_sidebar": "Navigation sidebar",
"expand_navigation": "Expand navigation",
"official_proxy_hosting": "Official Proxy is hosted by Hoppscotch.",
"profile": "Profile",
"profile_description": "Update you profile details",
Expand Down
12 changes: 6 additions & 6 deletions packages/hoppscotch-app/newstore/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export type SettingsType = {

PROXY_ENABLED: boolean
PROXY_URL: string
PROXY_KEY: string
EXTENSIONS_ENABLED: boolean
URL_EXCLUDES: {
auth: boolean
Expand All @@ -47,8 +46,9 @@ export type SettingsType = {
THEME_COLOR: HoppAccentColor
BG_COLOR: HoppBgColor
TELEMETRY_ENABLED: boolean
LEFT_SIDEBAR: boolean
RIGHT_SIDEBAR: boolean
EXPAND_NAVIGATION: boolean
SIDEBAR: boolean
SIDEBAR_ON_LEFT: boolean
ZEN_MODE: boolean
FONT_SIZE: HoppFontSize
COLUMN_LAYOUT: boolean
Expand All @@ -61,7 +61,6 @@ export const defaultSettings: SettingsType = {

PROXY_ENABLED: false,
PROXY_URL: "https://proxy.hoppscotch.io/",
PROXY_KEY: "",
EXTENSIONS_ENABLED: true,
URL_EXCLUDES: {
auth: true,
Expand All @@ -73,8 +72,9 @@ export const defaultSettings: SettingsType = {
THEME_COLOR: "indigo",
BG_COLOR: "system",
TELEMETRY_ENABLED: true,
LEFT_SIDEBAR: true,
RIGHT_SIDEBAR: true,
EXPAND_NAVIGATION: true,
SIDEBAR: true,
SIDEBAR_ON_LEFT: false,
ZEN_MODE: false,
FONT_SIZE: "small",
COLUMN_LAYOUT: true,
Expand Down
19 changes: 9 additions & 10 deletions packages/hoppscotch-app/pages/documentation.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<template>
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:rtl="SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768"
:class="{
'!flex-row-reverse': SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768,
}"
:horizontal="!(windowInnerWidth.x.value >= 768)"
>
<Pane class="hide-scrollbar !overflow-auto">
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:horizontal="COLUMN_LAYOUT"
>
<Pane size="75" min-size="65" class="hide-scrollbar !overflow-auto">
<Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
<Pane class="hide-scrollbar !overflow-auto">
<AppSection label="import">
<div class="flex p-4 items-start justify-between">
Expand Down Expand Up @@ -157,8 +156,7 @@
</Splitpanes>
</Pane>
<Pane
v-if="RIGHT_SIDEBAR"
max-size="35"
v-if="SIDEBAR"
size="25"
min-size="20"
class="hide-scrollbar !overflow-auto"
Expand Down Expand Up @@ -193,9 +191,10 @@ export default defineComponent({
setup() {
return {
windowInnerWidth: useWindowSize(),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
SIDEBAR: useSetting("SIDEBAR"),
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
currentUser: useReadonlyStream(currentUser$, null),
SIDEBAR_ON_LEFT: useSetting("SIDEBAR_ON_LEFT"),
}
},
data() {
Expand Down
19 changes: 9 additions & 10 deletions packages/hoppscotch-app/pages/graphql.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<template>
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:rtl="SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768"
:class="{
'!flex-row-reverse': SIDEBAR_ON_LEFT && windowInnerWidth.x.value >= 768,
}"
:horizontal="!(windowInnerWidth.x.value >= 768)"
>
<Pane class="hide-scrollbar !overflow-auto">
<Splitpanes
class="smart-splitter"
:dbl-click-splitter="false"
:horizontal="COLUMN_LAYOUT"
>
<Pane size="75" min-size="65" class="hide-scrollbar !overflow-auto">
<Splitpanes class="smart-splitter" :horizontal="COLUMN_LAYOUT">
<Pane class="hide-scrollbar !overflow-auto">
<GraphqlRequest :conn="gqlConn" />
<GraphqlRequestOptions :conn="gqlConn" />
Expand All @@ -20,8 +19,7 @@
</Splitpanes>
</Pane>
<Pane
v-if="RIGHT_SIDEBAR"
max-size="35"
v-if="SIDEBAR"
size="25"
min-size="20"
class="hide-scrollbar !overflow-auto"
Expand Down Expand Up @@ -62,8 +60,9 @@ export default defineComponent({
return {
windowInnerWidth: useWindowSize(),
RIGHT_SIDEBAR: useSetting("RIGHT_SIDEBAR"),
SIDEBAR: useSetting("SIDEBAR"),
COLUMN_LAYOUT: useSetting("COLUMN_LAYOUT"),
SIDEBAR_ON_LEFT: useSetting("SIDEBAR_ON_LEFT"),
gqlConn,
}
},
Expand Down
Loading

0 comments on commit d3a1898

Please sign in to comment.