- 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
20 lines
543 B
TypeScript
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 }
|
|
}
|