/**
 * useSnackbar composable
 *
 * Centralized snackbar notification wrapper.
 * Eliminates the copy-pasted snackbar() function across all pages.
 * Relies on the global $snackbar in App.vue (top-center, 3s timeout).
 */

export function useSnackbar() {
  return (text: string, color = 'success') => {
    const msg = (text || '').trim() || (color === 'error' ? '操作失败' : '操作完成')
    window.$snackbar?.(msg, color)
  }
}
