feature-frontend-top
commit
08899873e7
@ -0,0 +1,20 @@ |
||||
spring: |
||||
datasource: |
||||
url: jdbc:postgresql://localhost:5432/${LOCAL_DB_NAME} |
||||
driver-class-name: org.postgresql.Driver |
||||
username: ${LOCAL_DB_USER} |
||||
password: ${LOCAL_DB_PASSWORD} |
||||
jpa: |
||||
database-platform: org.hibernate.dialect.PostgreSQLDialect |
||||
properties: |
||||
hibernate: |
||||
jdbc: |
||||
lob: |
||||
non_contextual_creation: true |
||||
|
||||
server: |
||||
address: 0.0.0.0 |
||||
port: 8080 |
||||
|
||||
cors: |
||||
allowed-origins: http://${WIN_IP}:3000 |
@ -0,0 +1,29 @@ |
||||
import React from 'react'; |
||||
import { Snackbar, Alert, AlertColor } from '@mui/material'; |
||||
|
||||
interface MessageAlertProps { |
||||
open: boolean; |
||||
message: string; |
||||
severity: AlertColor; // 'error' | 'warning' | 'info' | 'success'
|
||||
onClose: (event?: React.SyntheticEvent | Event, reason?: string) => void; |
||||
duration?: number; |
||||
} |
||||
|
||||
const MessageAlert: React.FC<MessageAlertProps> = ({ |
||||
open, |
||||
message, |
||||
severity, |
||||
onClose, |
||||
duration = 6000, |
||||
}) => { |
||||
return ( |
||||
<Snackbar open={open} autoHideDuration={duration} onClose={onClose} |
||||
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} sx={{bottom: '120px'}}> |
||||
<Alert onClose={onClose} severity={severity} sx={{ width: '100%' }}> |
||||
{message} |
||||
</Alert> |
||||
</Snackbar> |
||||
); |
||||
}; |
||||
|
||||
export default MessageAlert; |
@ -0,0 +1,17 @@ |
||||
|
||||
import React, { createContext, useContext } from 'react'; |
||||
|
||||
export interface MessageContextType { |
||||
showErrorMessage: (message: string) => void; |
||||
showWarningMessage: (message: string) => void; |
||||
showSuccessMessage: (message: string) => void; |
||||
showInfoMessage: (message: string) => void; |
||||
} |
||||
|
||||
export const MessageContext = createContext<MessageContextType | undefined>(undefined); |
||||
|
||||
export const useMessage = () => { |
||||
const context = useContext(MessageContext); |
||||
if (!context) throw new Error('useMessage must be used within MessageContext.Provider'); |
||||
return context; |
||||
}; |
Loading…
Reference in new issue