temp: add resources
This commit is contained in:
		
							
								
								
									
										21
									
								
								packages/resources/src/pages/message/ToastLogin.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								packages/resources/src/pages/message/ToastLogin.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
import { toast } from 'react-toastify';
 | 
			
		||||
 | 
			
		||||
// Custom message component
 | 
			
		||||
const LoginMessage = () => {
 | 
			
		||||
  const handleClick = () => {
 | 
			
		||||
    const currentUrl = window.location.href;
 | 
			
		||||
    const redirect = encodeURIComponent(currentUrl);
 | 
			
		||||
    window.location.href = '/user/login?redirect=' + redirect;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <div className='msg-container' onClick={handleClick} style={{ cursor: 'pointer' }}>
 | 
			
		||||
      <p className='msg-title'>Please login</p>
 | 
			
		||||
      <p className='msg-description'>Click here to go to the login page.</p>
 | 
			
		||||
    </div>
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const toastLogin = () => {
 | 
			
		||||
  toast.info(<LoginMessage />);
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										5
									
								
								packages/resources/src/pages/message/toastify.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								packages/resources/src/pages/message/toastify.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
import { toast } from 'react-toastify';
 | 
			
		||||
 | 
			
		||||
export const toastify = (message: string, type: 'success' | 'error' | 'warning' | 'info') => {
 | 
			
		||||
  toast(message, { type });
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user