From 850954efdf9c8d72710283698f24c205a9f53c62 Mon Sep 17 00:00:00 2001 From: nivedin Date: Wed, 29 May 2024 14:07:45 +0530 Subject: [PATCH] chore: minoir ui and code refactor --- .../src/components/app/Interceptor.vue | 2 +- .../src/newstore/settings.ts | 95 ++++++++----------- .../hoppscotch-common/src/pages/settings.vue | 5 +- 3 files changed, 44 insertions(+), 58 deletions(-) diff --git a/packages/hoppscotch-common/src/components/app/Interceptor.vue b/packages/hoppscotch-common/src/components/app/Interceptor.vue index ed939816c..d66e14087 100644 --- a/packages/hoppscotch-common/src/components/app/Interceptor.vue +++ b/packages/hoppscotch-common/src/components/app/Interceptor.vue @@ -20,7 +20,7 @@ :label="unref(interceptor.name(t))" :selected="interceptorSelection === interceptor.interceptorID" :class="{ - 'px-0 hover:bg-transparent': !isTooltipComponent, + '!px-0 hover:bg-transparent': !isTooltipComponent, }" @change="interceptorSelection = interceptor.interceptorID" /> diff --git a/packages/hoppscotch-common/src/newstore/settings.ts b/packages/hoppscotch-common/src/newstore/settings.ts index 351f2c33d..eb582f2f1 100644 --- a/packages/hoppscotch-common/src/newstore/settings.ts +++ b/packages/hoppscotch-common/src/newstore/settings.ts @@ -1,8 +1,6 @@ import { cloneDeep, defaultsDeep, has } from "lodash-es" import { Observable } from "rxjs" import { distinctUntilChanged, pluck } from "rxjs/operators" -import { nextTick } from "vue" -import { platform } from "~/platform" import type { KeysMatching } from "~/types/ts-utils" import DispatchingStore, { defineDispatchers } from "./DispatchingStore" @@ -70,61 +68,52 @@ export type SettingsDef = { HAS_OPENED_SPOTLIGHT: boolean } -export const getDefaultSettings = (): SettingsDef => { - const defaultSettings: SettingsDef = { - syncCollections: true, - syncHistory: true, - syncEnvironments: true, +export const getDefaultSettings = (): SettingsDef => ({ + syncCollections: true, + syncHistory: true, + syncEnvironments: true, - WRAP_LINES: { - httpRequestBody: true, - httpResponseBody: true, - httpHeaders: true, - httpParams: true, - httpUrlEncoded: true, - httpPreRequest: true, - httpTest: true, - httpRequestVariables: true, - graphqlQuery: true, - graphqlResponseBody: true, - graphqlHeaders: false, - graphqlVariables: false, - graphqlSchema: true, - importCurl: true, - codeGen: true, - cookie: true, - }, + WRAP_LINES: { + httpRequestBody: true, + httpResponseBody: true, + httpHeaders: true, + httpParams: true, + httpUrlEncoded: true, + httpPreRequest: true, + httpTest: true, + httpRequestVariables: true, + graphqlQuery: true, + graphqlResponseBody: true, + graphqlHeaders: false, + graphqlVariables: false, + graphqlSchema: true, + importCurl: true, + codeGen: true, + cookie: true, + }, - CURRENT_INTERCEPTOR_ID: "", + // Set empty because interceptor module will set the default value + CURRENT_INTERCEPTOR_ID: "", - // TODO: Interceptor related settings should move under the interceptor systems - PROXY_URL: "https://proxy.hoppscotch.io/", - URL_EXCLUDES: { - auth: true, - httpUser: true, - httpPassword: true, - bearerToken: true, - oauth2Token: true, - }, - THEME_COLOR: "indigo", - BG_COLOR: "system", - TELEMETRY_ENABLED: true, - EXPAND_NAVIGATION: false, - SIDEBAR: true, - SIDEBAR_ON_LEFT: false, - COLUMN_LAYOUT: true, + // TODO: Interceptor related settings should move under the interceptor systems + PROXY_URL: "https://proxy.hoppscotch.io/", + URL_EXCLUDES: { + auth: true, + httpUser: true, + httpPassword: true, + bearerToken: true, + oauth2Token: true, + }, + THEME_COLOR: "indigo", + BG_COLOR: "system", + TELEMETRY_ENABLED: true, + EXPAND_NAVIGATION: false, + SIDEBAR: true, + SIDEBAR_ON_LEFT: false, + COLUMN_LAYOUT: true, - HAS_OPENED_SPOTLIGHT: false, - } - - // Wait for platform to initialize before setting CURRENT_INTERCEPTOR_ID - nextTick(() => { - defaultSettings.CURRENT_INTERCEPTOR_ID = - platform?.interceptors.default || "browser" - }) - - return defaultSettings -} + HAS_OPENED_SPOTLIGHT: false, +}) type ApplySettingPayload = { [K in keyof SettingsDef]: { diff --git a/packages/hoppscotch-common/src/pages/settings.vue b/packages/hoppscotch-common/src/pages/settings.vue index 42772c9bc..cab99e319 100644 --- a/packages/hoppscotch-common/src/pages/settings.vue +++ b/packages/hoppscotch-common/src/pages/settings.vue @@ -98,13 +98,10 @@

-
+

{{ t("settings.interceptor") }}

-

- {{ interceptorService.currentInterceptor.value?.interceptorID }} -