Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: improvements made to how banners are to be dismissed (#3656)

Joel Jacob Stephencf8b5975ac18
diff --git a/packages/hoppscotch-common/src/components/app/Banner.vue b/packages/hoppscotch-common/src/components/app/Banner.vue
index 7086678d3..ce76bfe5b 100644
--- a/packages/hoppscotch-common/src/components/app/Banner.vue
+++ b/packages/hoppscotch-common/src/components/app/Banner.vue
@@ -14,7 +14,7 @@
</span>
</div>
<icon-lucide-x
- v-if="dismissible"
+ v-if="banner.dismissible"
class="opacity-50 hover:cursor-pointer hover:opacity-100"
@click="emit('dismiss')"
/>
diff --git a/packages/hoppscotch-common/src/components/app/Header.vue b/packages/hoppscotch-common/src/components/app/Header.vue
index dcb7c9278..088cb5879 100644
--- a/packages/hoppscotch-common/src/components/app/Header.vue
+++ b/packages/hoppscotch-common/src/components/app/Header.vue
@@ -214,7 +214,7 @@
<AppBanner
v-if="bannerContent"
:banner="bannerContent"
- :dismissible="true"
+ :dismissable="bannerContent.dismissible"
@dismiss="dismissOfflineBanner"
/>
<TeamsModal :show="showTeamsModal" @hide-modal="showTeamsModal = false" />
@@ -295,6 +295,7 @@ const offlineBanner: BannerContent = {
text: (t) => t("helpers.offline"),
alternateText: (t) => t("helpers.offline_short"),
score: BANNER_PRIORITY_HIGH,
+ dismissible: true,
}
const network = reactive(useNetwork())
diff --git a/packages/hoppscotch-common/src/services/banner.service.ts b/packages/hoppscotch-common/src/services/banner.service.ts
index 644288ea0..3a148cfff 100644
--- a/packages/hoppscotch-common/src/services/banner.service.ts
+++ b/packages/hoppscotch-common/src/services/banner.service.ts
@@ -15,6 +15,7 @@ export type BannerContent = {
alternateText?: (t: ReturnType<typeof getI18n>) => string
// Used to determine which banner should be displayed when multiple banners are present
score: number
+ dismissible?: boolean
}
export type Banner = {
diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts
index 611eefbc8..b67970508 100644
--- a/packages/hoppscotch-sh-admin/src/components.d.ts
+++ b/packages/hoppscotch-sh-admin/src/components.d.ts
@@ -30,8 +30,10 @@ declare module '@vue/runtime-core' {
HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable']
HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs']
HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle']
+ IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']
IconLucideInbox: typeof import('~icons/lucide/inbox')['default']
+ IconLucideUser: typeof import('~icons/lucide/user')['default']
SettingsAuthProvider: typeof import('./components/settings/AuthProvider.vue')['default']
SettingsConfigurations: typeof import('./components/settings/Configurations.vue')['default']
SettingsReset: typeof import('./components/settings/Reset.vue')['default']