add install ollama models , fixes
This commit is contained in:
40
app/components/ui/use-toast.ts
Normal file
40
app/components/ui/use-toast.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { useCallback } from 'react';
|
||||
import { toast as toastify } from 'react-toastify';
|
||||
|
||||
interface ToastOptions {
|
||||
type?: 'success' | 'error' | 'info' | 'warning';
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
export function useToast() {
|
||||
const toast = useCallback((message: string, options: ToastOptions = {}) => {
|
||||
const { type = 'info', duration = 3000 } = options;
|
||||
|
||||
toastify[type](message, {
|
||||
position: 'bottom-right',
|
||||
autoClose: duration,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
progress: undefined,
|
||||
theme: 'dark',
|
||||
});
|
||||
}, []);
|
||||
|
||||
const success = useCallback(
|
||||
(message: string, options: Omit<ToastOptions, 'type'> = {}) => {
|
||||
toast(message, { ...options, type: 'success' });
|
||||
},
|
||||
[toast],
|
||||
);
|
||||
|
||||
const error = useCallback(
|
||||
(message: string, options: Omit<ToastOptions, 'type'> = {}) => {
|
||||
toast(message, { ...options, type: 'error' });
|
||||
},
|
||||
[toast],
|
||||
);
|
||||
|
||||
return { toast, success, error };
|
||||
}
|
||||
Reference in New Issue
Block a user