peregrine/web/src/composables/useToast.ts
pyr0ball 6115a68550
Some checks failed
CI / Backend (Python) (push) Failing after 10s
CI / Frontend (Vue) (push) Successful in 18s
Mirror / mirror (push) Failing after 8s
feat: Vue SPA demo mode support
- useToast.ts: global reactive toast singleton for cross-component toasts
- App.vue: sticky demo mode banner + global toast slot
- router: bypass wizard gate entirely in demo mode (pre-seeded data)
- ApplyWorkspace, CompanyResearchModal: guard generate() in demo mode
- fineTune store: guard submitJob() in demo mode
- ui_switcher.py: remove Vue→Streamlit fallback in demo mode (now handled natively)

All LLM-triggering actions show a toast and no-op in demo mode.
Backend already blocks inference via DEMO_MODE env; Vue layer adds UX signal.

Closes #46
2026-04-06 00:07:26 -07:00

20 lines
543 B
TypeScript

/**
* useToast — global reactive toast singleton.
*
* Module-level ref shared across all importers; no Pinia needed for a single
* ephemeral string. Call showToast() from anywhere; App.vue renders it.
*/
import { ref } from 'vue'
const _message = ref<string | null>(null)
let _timer = 0
export function showToast(msg: string, duration = 3500): void {
clearTimeout(_timer)
_message.value = msg
_timer = window.setTimeout(() => { _message.value = null }, duration)
}
export function useToast() {
return { message: _message }
}