- Replace single-file 8441-line HTML with Vue 3 SPA - Pinia stores: auth, oils, recipes, diary, ui - Composables: useApi, useDialog, useSmartPaste, useOilTranslation - 6 shared components: RecipeCard, RecipeDetailOverlay, TagPicker, etc. - 9 page views: RecipeSearch, RecipeManager, Inventory, OilReference, etc. - 14 Cypress E2E test specs (113 tests), all passing - Multi-stage Dockerfile (Node build + Python runtime) - Demo video generation scripts (TTS + subtitles + screen recording) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1014 B
JavaScript
44 lines
1014 B
JavaScript
import { reactive } from 'vue'
|
|
|
|
export const dialogState = reactive({
|
|
visible: false,
|
|
type: 'alert', // 'alert', 'confirm', 'prompt'
|
|
message: '',
|
|
defaultValue: '',
|
|
resolve: null
|
|
})
|
|
|
|
export function showAlert(msg) {
|
|
return new Promise(resolve => {
|
|
dialogState.visible = true
|
|
dialogState.type = 'alert'
|
|
dialogState.message = msg
|
|
dialogState.resolve = resolve
|
|
})
|
|
}
|
|
|
|
export function showConfirm(msg) {
|
|
return new Promise(resolve => {
|
|
dialogState.visible = true
|
|
dialogState.type = 'confirm'
|
|
dialogState.message = msg
|
|
dialogState.resolve = resolve
|
|
})
|
|
}
|
|
|
|
export function showPrompt(msg, defaultVal = '') {
|
|
return new Promise(resolve => {
|
|
dialogState.visible = true
|
|
dialogState.type = 'prompt'
|
|
dialogState.message = msg
|
|
dialogState.defaultValue = defaultVal
|
|
dialogState.resolve = resolve
|
|
})
|
|
}
|
|
|
|
export function closeDialog(result) {
|
|
dialogState.visible = false
|
|
if (dialogState.resolve) dialogState.resolve(result)
|
|
dialogState.resolve = null
|
|
}
|