Files
rhema-together/web/app/utils/dialogStack.ts
T
vhaudiquet 2216f37422 feat: pick the room model from a catalog dialog
The room model was a free-text field. It now opens a dialog that lists the provider's live catalog through the same adapter a turn uses, with context, output, price, and vision from models.dev. Rows filter by text, vision, or free price, and a custom id remains available when the provider lists nothing.

The dialog is nested over room settings, so BaseDialog now gives Escape and the focus trap to the top dialog only. Clearing the model stores NULL, which returns the room to the provider's default.
2026-11-28 17:21:48 +01:00

22 lines
524 B
TypeScript

const stack: symbol[] = []
let savedOverflow = ''
export function pushDialog(id: symbol) {
if (stack.length === 0) {
savedOverflow = document.body.style.overflow
document.body.style.overflow = 'hidden'
}
stack.push(id)
}
export function removeDialog(id: symbol) {
const index = stack.indexOf(id)
if (index === -1) return
stack.splice(index, 1)
if (stack.length === 0) document.body.style.overflow = savedOverflow
}
export function isTopDialog(id: symbol) {
return stack[stack.length - 1] === id
}