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: remove auto dismissal of whats new toast and move it to the bottom left

Andrew Bastinfd60c630fd5d
diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json
index 47553adc0..a964afb3a 100644
--- a/packages/hoppscotch-common/locales/en.json
+++ b/packages/hoppscotch-common/locales/en.json
@@ -98,7 +98,7 @@
"twitter": "Twitter",
"type_a_command_search": "Type a command or search…",
"we_use_cookies": "We use cookies",
- "updated_text": "Hoppscotch has been updated to the version {version} 🎉",
+ "updated_text": "Hoppscotch has been updated to v{version} 🎉",
"whats_new": "What's new?",
"see_whats_new": "See what’s new",
"wiki": "Wiki"
diff --git a/packages/hoppscotch-common/src/composables/whats-new.ts b/packages/hoppscotch-common/src/composables/whats-new.ts
index db8c8c342..9a246d1bb 100644
--- a/packages/hoppscotch-common/src/composables/whats-new.ts
+++ b/packages/hoppscotch-common/src/composables/whats-new.ts
@@ -1,12 +1,11 @@
import { toast as sonner } from "@hoppscotch/ui"
import { markRaw } from "vue"
-
import WhatsNewDialog from "~/components/app/WhatsNewDialog.vue"
import { getService } from "~/modules/dioc"
import { PersistenceService } from "~/services/persistence"
import { version as hoppscotchCommonPkgVersion } from "./../../package.json"
-export const useWhatsNewDialog = async function () {
+export function useWhatsNewDialog() {
const persistenceService = getService(PersistenceService)
const versionFromLocalStorage = persistenceService.getLocalConfig("hopp_v")
@@ -34,15 +33,20 @@ export const useWhatsNewDialog = async function () {
// Show the release notes during a major version update
if (majorVersionFromLocalStorage !== hoppscotchCommonPkgMajorVersion) {
- const notesUrl = await getReleaseNotes(hoppscotchCommonPkgMajorVersion)
- if (notesUrl) {
- sonner.custom(markRaw(WhatsNewDialog), {
- componentProps: {
- notesUrl,
- version: hoppscotchCommonPkgVersion,
- },
- })
- }
+ setTimeout(async () => {
+ const notesUrl = await getReleaseNotes(hoppscotchCommonPkgMajorVersion)
+
+ if (notesUrl) {
+ sonner.custom(markRaw(WhatsNewDialog), {
+ componentProps: {
+ notesUrl,
+ version: hoppscotchCommonPkgVersion,
+ },
+ position: "bottom-left",
+ duration: Infinity,
+ })
+ }
+ }, 10000)
}
persistenceService.setLocalConfig("hopp_v", hoppscotchCommonPkgVersion)