mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-05-06 05:04:39 +00:00
* feat: push private repo # GitHub Integration Changelog ## Fixed - Fixed issue where repositories marked as private weren't being created with private visibility - Added support for changing repository visibility (public/private) when pushing to existing repositories - Fixed 404 errors when pushing files after changing repository visibility ## Added - Added clear user warnings when changing repository visibility from public to private or vice versa - Implemented delays after visibility changes to allow GitHub API to fully process the change - Added retry mechanism (up to 3 attempts with increasing delays) for pushing files after visibility changes - Added repository data refresh before pushing to ensure latest reference data ## Improved - Enhanced error logging and handling for all GitHub API operations - Updated return value handling to use actual repository URLs from the API response - Added comprehensive logging to track repository creation and update operations * cleanup * Update Workbench.client.tsx
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
import { useCallback } from 'react';
|
|
import { toast as toastify } from 'react-toastify';
|
|
|
|
// Configure standard toast settings
|
|
export const configuredToast = {
|
|
success: (message: string, options = {}) => toastify.success(message, { autoClose: 3000, ...options }),
|
|
error: (message: string, options = {}) => toastify.error(message, { autoClose: 3000, ...options }),
|
|
info: (message: string, options = {}) => toastify.info(message, { autoClose: 3000, ...options }),
|
|
warning: (message: string, options = {}) => toastify.warning(message, { autoClose: 3000, ...options }),
|
|
loading: (message: string, options = {}) => toastify.loading(message, { autoClose: 3000, ...options }),
|
|
};
|
|
|
|
// Export the original toast for cases where specific configuration is needed
|
|
export { toastify as toast };
|
|
|
|
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],
|
|
);
|
|
|
|
const info = useCallback(
|
|
(message: string, options: Omit<ToastOptions, 'type'> = {}) => {
|
|
toast(message, { ...options, type: 'info' });
|
|
},
|
|
[toast],
|
|
);
|
|
|
|
const warning = useCallback(
|
|
(message: string, options: Omit<ToastOptions, 'type'> = {}) => {
|
|
toast(message, { ...options, type: 'warning' });
|
|
},
|
|
[toast],
|
|
);
|
|
|
|
return { toast, success, error, info, warning };
|
|
}
|