refactor: remove auto dismissal of whats new toast and move it to the bottom left

This commit is contained in:
Andrew Bastin
2024-06-28 15:05:16 +03:00
parent 7deb49b244
commit fd60c630fd
2 changed files with 16 additions and 12 deletions

View File

@@ -98,7 +98,7 @@
"twitter": "Twitter", "twitter": "Twitter",
"type_a_command_search": "Type a command or search…", "type_a_command_search": "Type a command or search…",
"we_use_cookies": "We use cookies", "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?", "whats_new": "What's new?",
"see_whats_new": "See whats new", "see_whats_new": "See whats new",
"wiki": "Wiki" "wiki": "Wiki"

View File

@@ -1,12 +1,11 @@
import { toast as sonner } from "@hoppscotch/ui" import { toast as sonner } from "@hoppscotch/ui"
import { markRaw } from "vue" import { markRaw } from "vue"
import WhatsNewDialog from "~/components/app/WhatsNewDialog.vue" import WhatsNewDialog from "~/components/app/WhatsNewDialog.vue"
import { getService } from "~/modules/dioc" import { getService } from "~/modules/dioc"
import { PersistenceService } from "~/services/persistence" import { PersistenceService } from "~/services/persistence"
import { version as hoppscotchCommonPkgVersion } from "./../../package.json" import { version as hoppscotchCommonPkgVersion } from "./../../package.json"
export const useWhatsNewDialog = async function () { export function useWhatsNewDialog() {
const persistenceService = getService(PersistenceService) const persistenceService = getService(PersistenceService)
const versionFromLocalStorage = persistenceService.getLocalConfig("hopp_v") const versionFromLocalStorage = persistenceService.getLocalConfig("hopp_v")
@@ -34,15 +33,20 @@ export const useWhatsNewDialog = async function () {
// Show the release notes during a major version update // Show the release notes during a major version update
if (majorVersionFromLocalStorage !== hoppscotchCommonPkgMajorVersion) { if (majorVersionFromLocalStorage !== hoppscotchCommonPkgMajorVersion) {
const notesUrl = await getReleaseNotes(hoppscotchCommonPkgMajorVersion) setTimeout(async () => {
if (notesUrl) { const notesUrl = await getReleaseNotes(hoppscotchCommonPkgMajorVersion)
sonner.custom(markRaw(WhatsNewDialog), {
componentProps: { if (notesUrl) {
notesUrl, sonner.custom(markRaw(WhatsNewDialog), {
version: hoppscotchCommonPkgVersion, componentProps: {
}, notesUrl,
}) version: hoppscotchCommonPkgVersion,
} },
position: "bottom-left",
duration: Infinity,
})
}
}, 10000)
} }
persistenceService.setLocalConfig("hopp_v", hoppscotchCommonPkgVersion) persistenceService.setLocalConfig("hopp_v", hoppscotchCommonPkgVersion)