mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
- Remove nested git repository from bugulma/frontend/.git - Add all frontend files to main repository tracking - Convert from separate frontend/backend repos to unified monorepo - Preserve all frontend code and development history as tracked files - Eliminate nested repository complexity for simpler development workflow This creates a proper monorepo structure with frontend and backend coexisting in the same repository for easier development and deployment.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { useCallback } from 'react';
|
|
|
|
export type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
|
|
interface ToastOptions {
|
|
title?: string;
|
|
description?: string;
|
|
duration?: number;
|
|
action?: {
|
|
label: string;
|
|
onClick: () => void;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Hook for showing toast notifications (placeholder implementation)
|
|
* In a real app, this would integrate with a toast library like react-hot-toast
|
|
*/
|
|
export function useToast() {
|
|
const toast = useCallback((type: ToastType, message: string, options: ToastOptions = {}) => {
|
|
// Placeholder implementation - in real app, integrate with toast library
|
|
console.log(`${type.toUpperCase()}: ${message}`, options);
|
|
|
|
// Could dispatch to a global toast context here
|
|
// Example: toastContext.add({ type, message, ...options });
|
|
}, []);
|
|
|
|
const success = useCallback((message: string, options?: ToastOptions) =>
|
|
toast('success', message, options), [toast]);
|
|
|
|
const error = useCallback((message: string, options?: ToastOptions) =>
|
|
toast('error', message, options), [toast]);
|
|
|
|
const warning = useCallback((message: string, options?: ToastOptions) =>
|
|
toast('warning', message, options), [toast]);
|
|
|
|
const info = useCallback((message: string, options?: ToastOptions) =>
|
|
toast('info', message, options), [toast]);
|
|
|
|
return {
|
|
toast,
|
|
success,
|
|
error,
|
|
warning,
|
|
info,
|
|
};
|
|
}
|