Improve popups (#5068)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-03-27 12:57:25 +05:00 committed by GitHub
parent 9f929f0290
commit bee1986299
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,6 +23,7 @@ export interface CompAndProps {
options: { options: {
category: string category: string
overlay: boolean overlay: boolean
fixed?: boolean
} }
} }
@ -59,6 +60,7 @@ export function showPopup (
options: { options: {
category: string category: string
overlay: boolean overlay: boolean
fixed?: boolean
} = { category: 'popup', overlay: true } } = { category: 'popup', overlay: true }
): PopupResult { ): PopupResult {
const id = `${popupId++}` const id = `${popupId++}`
@ -94,7 +96,12 @@ export function closePopup (category?: string): void {
if (category !== undefined) { if (category !== undefined) {
popups = popups.filter((p) => p.options.category !== category) popups = popups.filter((p) => p.options.category !== category)
} else { } else {
popups.pop() for (let i = popups.length - 1; i >= 0; i--) {
if (popups[i].options.fixed !== true) {
popups.splice(i, 1)
break
}
}
} }
return popups return popups
}) })