feat: initialize renderer application with theme, global styles, and core UI components
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
|||||||
Toolbar,
|
Toolbar,
|
||||||
IconButton,
|
IconButton,
|
||||||
Divider,
|
Divider,
|
||||||
GlobalStyles,
|
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Container,
|
Container,
|
||||||
Paper,
|
Paper,
|
||||||
@@ -53,7 +52,6 @@ import {
|
|||||||
Dashboard as DashboardIcon,
|
Dashboard as DashboardIcon,
|
||||||
Folder as ProjectIcon,
|
Folder as ProjectIcon,
|
||||||
Settings as SettingsIcon,
|
Settings as SettingsIcon,
|
||||||
Language as LanguageIcon,
|
|
||||||
Storage as DbIcon,
|
Storage as DbIcon,
|
||||||
Dns as ServerIcon,
|
Dns as ServerIcon,
|
||||||
Code as PhpIcon,
|
Code as PhpIcon,
|
||||||
@@ -79,6 +77,7 @@ import {
|
|||||||
import Swal from 'sweetalert2'
|
import Swal from 'sweetalert2'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { supportedLngs } from './i18n'
|
import { supportedLngs } from './i18n'
|
||||||
|
import GlobalStyles from './styles/GlobalStyles'
|
||||||
import MariaDbImportWizard from './components/MariaDbImportWizard'
|
import MariaDbImportWizard from './components/MariaDbImportWizard'
|
||||||
import MariaDbExportWizard from './components/MariaDbExportWizard'
|
import MariaDbExportWizard from './components/MariaDbExportWizard'
|
||||||
import MariaDbDatabaseManager from './components/MariaDbDatabaseManager'
|
import MariaDbDatabaseManager from './components/MariaDbDatabaseManager'
|
||||||
@@ -163,7 +162,7 @@ function App(): JSX.Element {
|
|||||||
|
|
||||||
// Log States
|
// Log States
|
||||||
const [logDialogOpen, setLogDialogOpen] = useState(false)
|
const [logDialogOpen, setLogDialogOpen] = useState(false)
|
||||||
const [selectedService, setSelectedService] = useState('')
|
const [selectedService] = useState('')
|
||||||
const [logs, setLogs] = useState<string[]>([])
|
const [logs, setLogs] = useState<string[]>([])
|
||||||
const [pmaInstalled, setPmaInstalled] = useState(false)
|
const [pmaInstalled, setPmaInstalled] = useState(false)
|
||||||
const [pmaLoading, setPmaLoading] = useState(false)
|
const [pmaLoading, setPmaLoading] = useState(false)
|
||||||
@@ -390,14 +389,6 @@ function App(): JSX.Element {
|
|||||||
}
|
}
|
||||||
}, [logs, logDialogOpen])
|
}, [logs, logDialogOpen])
|
||||||
|
|
||||||
const handleOpenNginxConfig = async () => {
|
|
||||||
if (window.api && window.api.invoke) {
|
|
||||||
const config = await window.api.invoke('nginx:config:get')
|
|
||||||
setNginxConfig(config)
|
|
||||||
setIsNginxConfigOpen(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSaveNginxConfig = async () => {
|
const handleSaveNginxConfig = async () => {
|
||||||
if (window.api && window.api.invoke) {
|
if (window.api && window.api.invoke) {
|
||||||
const result = await window.api.invoke('nginx:config:save', nginxConfig)
|
const result = await window.api.invoke('nginx:config:save', nginxConfig)
|
||||||
@@ -606,8 +597,6 @@ function App(): JSX.Element {
|
|||||||
text: t('projects.delete_confirm'),
|
text: t('projects.delete_confirm'),
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#ff4444',
|
|
||||||
cancelButtonColor: '#3085d6',
|
|
||||||
confirmButtonText: t('common.yes_delete'),
|
confirmButtonText: t('common.yes_delete'),
|
||||||
cancelButtonText: t('common.cancel'),
|
cancelButtonText: t('common.cancel'),
|
||||||
background: '#1e1e1e',
|
background: '#1e1e1e',
|
||||||
@@ -622,14 +611,6 @@ function App(): JSX.Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOpenProcessList = async (id: string) => {
|
|
||||||
setSelectedMariaDbId(id)
|
|
||||||
setIsProcessListOpen(true)
|
|
||||||
if (window.api && window.api.invoke) {
|
|
||||||
await fetchProcessList(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleTestNginxConfig = async () => {
|
const handleTestNginxConfig = async () => {
|
||||||
if (window.api && window.api.invoke) {
|
if (window.api && window.api.invoke) {
|
||||||
const result = await window.api.invoke('nginx:config:test')
|
const result = await window.api.invoke('nginx:config:test')
|
||||||
@@ -689,7 +670,6 @@ function App(): JSX.Element {
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
background: '#1e1e1e',
|
background: '#1e1e1e',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
confirmButtonColor: '#153E5E',
|
|
||||||
customClass: { popup: 'swal2-dark-popup' }
|
customClass: { popup: 'swal2-dark-popup' }
|
||||||
})
|
})
|
||||||
setIsProjectNginxConfigOpen(false)
|
setIsProjectNginxConfigOpen(false)
|
||||||
@@ -781,8 +761,6 @@ function App(): JSX.Element {
|
|||||||
title: t('mariadb_process_monitor.kill_confirm'),
|
title: t('mariadb_process_monitor.kill_confirm'),
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#d33',
|
|
||||||
cancelButtonColor: '#3085d6',
|
|
||||||
confirmButtonText: t('mariadb_process_monitor.kill_btn'),
|
confirmButtonText: t('mariadb_process_monitor.kill_btn'),
|
||||||
cancelButtonText: t('common.cancel'),
|
cancelButtonText: t('common.cancel'),
|
||||||
background: '#1a1d21',
|
background: '#1a1d21',
|
||||||
@@ -866,58 +844,8 @@ function App(): JSX.Element {
|
|||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<GlobalStyles styles={{
|
<GlobalStyles />
|
||||||
'html, body, #root': {
|
|
||||||
margin: 0,
|
|
||||||
padding: 0,
|
|
||||||
height: '100%',
|
|
||||||
width: '100%',
|
|
||||||
overflow: 'hidden',
|
|
||||||
},
|
|
||||||
'*::-webkit-scrollbar': {
|
|
||||||
width: '8px',
|
|
||||||
height: '8px',
|
|
||||||
},
|
|
||||||
'*::-webkit-scrollbar-track': {
|
|
||||||
background: 'rgba(0, 0, 0, 0.1)',
|
|
||||||
},
|
|
||||||
'*::-webkit-scrollbar-thumb': {
|
|
||||||
background: '#153E5E',
|
|
||||||
borderRadius: '10px',
|
|
||||||
border: '2px solid rgba(0, 0, 0, 0.1)',
|
|
||||||
},
|
|
||||||
'*::-webkit-scrollbar-thumb:hover': {
|
|
||||||
background: '#1a4d75',
|
|
||||||
},
|
|
||||||
'.swal2-container': {
|
|
||||||
zIndex: '9999 !important'
|
|
||||||
},
|
|
||||||
'.swal-title-small': {
|
|
||||||
fontSize: '1rem !important',
|
|
||||||
fontWeight: '800 !important',
|
|
||||||
letterSpacing: '1px !important',
|
|
||||||
color: '#fff !important',
|
|
||||||
marginTop: '10px !important'
|
|
||||||
},
|
|
||||||
'@keyframes swalLoadingDots': {
|
|
||||||
'0%': { opacity: 0.3, transform: 'scale(0.8)' },
|
|
||||||
'50%': { opacity: 1, transform: 'scale(1.2)' },
|
|
||||||
'100%': { opacity: 0.3, transform: 'scale(0.8)' }
|
|
||||||
},
|
|
||||||
'.swal2-loading-dots': {
|
|
||||||
animation: 'swalLoadingDots 1.4s infinite ease-in-out'
|
|
||||||
},
|
|
||||||
'.nginx-error-container': {
|
|
||||||
textAlign: 'left !important',
|
|
||||||
fontFamily: 'monospace !important',
|
|
||||||
fontSize: '0.8rem !important',
|
|
||||||
whiteSpace: 'pre-wrap !important',
|
|
||||||
backgroundColor: 'rgba(0,0,0,0.2) !important',
|
|
||||||
padding: '10px !important',
|
|
||||||
borderRadius: '5px !important',
|
|
||||||
border: '1px solid rgba(255,255,255,0.1) !important'
|
|
||||||
}
|
|
||||||
}} />
|
|
||||||
<Box sx={{ display: 'flex', height: '100vh', width: '100vw', overflow: 'hidden', backgroundImage: 'radial-gradient(circle at 50% 0%, #153E5E 0%, #121212 100%)', bgcolor: 'transparent' }}>
|
<Box sx={{ display: 'flex', height: '100vh', width: '100vw', overflow: 'hidden', backgroundImage: 'radial-gradient(circle at 50% 0%, #153E5E 0%, #121212 100%)', bgcolor: 'transparent' }}>
|
||||||
<AppBar
|
<AppBar
|
||||||
position="fixed"
|
position="fixed"
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ const MariaDbDatabaseManager: React.FC<MariaDbDatabaseManagerProps> = ({ version
|
|||||||
text: t('mariadb_manager.delete_db_confirm', { db: dbName }),
|
text: t('mariadb_manager.delete_db_confirm', { db: dbName }),
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#d33',
|
|
||||||
background: '#1e1e1e',
|
background: '#1e1e1e',
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
})
|
})
|
||||||
@@ -167,7 +166,6 @@ const MariaDbDatabaseManager: React.FC<MariaDbDatabaseManagerProps> = ({ version
|
|||||||
text: t('mariadb_manager.delete_user_confirm', { user: `${user}@${host}` }),
|
text: t('mariadb_manager.delete_user_confirm', { user: `${user}@${host}` }),
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#d33',
|
|
||||||
background: '#1e1e1e',
|
background: '#1e1e1e',
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,38 +2,10 @@ import React from 'react'
|
|||||||
import ReactDOM from 'react-dom/client'
|
import ReactDOM from 'react-dom/client'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import i18n from './i18n'
|
import i18n from './i18n'
|
||||||
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
import { ThemeProvider } from '@mui/material/styles'
|
||||||
import CssBaseline from '@mui/material/CssBaseline'
|
import CssBaseline from '@mui/material/CssBaseline'
|
||||||
import { I18nextProvider } from 'react-i18next'
|
import { I18nextProvider } from 'react-i18next'
|
||||||
|
import { theme } from './styles/theme'
|
||||||
const theme = createTheme({
|
|
||||||
palette: {
|
|
||||||
mode: 'dark',
|
|
||||||
primary: {
|
|
||||||
main: '#4A7CA3',
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
main: '#153E5E',
|
|
||||||
},
|
|
||||||
background: {
|
|
||||||
default: '#121212',
|
|
||||||
paper: '#1e1e1e',
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
primary: '#ffffff',
|
|
||||||
secondary: 'rgba(255, 255, 255, 0.7)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
MuiPaper: {
|
|
||||||
styleOverrides: {
|
|
||||||
root: {
|
|
||||||
backgroundImage: 'none',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// Error Boundary for better debugging
|
// Error Boundary for better debugging
|
||||||
class ErrorBoundary extends React.Component<{ children: React.ReactNode }, { hasError: boolean, error: any }> {
|
class ErrorBoundary extends React.Component<{ children: React.ReactNode }, { hasError: boolean, error: any }> {
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
import { GlobalStyles as MuiGlobalStyles } from '@mui/material'
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
'html, body, #root': {
|
||||||
|
margin: 0,
|
||||||
|
padding: 0,
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
|
overflow: 'hidden',
|
||||||
|
},
|
||||||
|
'*::-webkit-scrollbar': {
|
||||||
|
width: '8px',
|
||||||
|
height: '8px',
|
||||||
|
},
|
||||||
|
'*::-webkit-scrollbar-track': {
|
||||||
|
background: 'rgba(0, 0, 0, 0.1)',
|
||||||
|
},
|
||||||
|
'*::-webkit-scrollbar-thumb': {
|
||||||
|
background: '#153E5E',
|
||||||
|
borderRadius: '10px',
|
||||||
|
border: '2px solid rgba(0, 0, 0, 0.1)',
|
||||||
|
},
|
||||||
|
'*::-webkit-scrollbar-thumb:hover': {
|
||||||
|
background: '#1a4d75',
|
||||||
|
},
|
||||||
|
'.swal2-container': {
|
||||||
|
zIndex: '9999 !important'
|
||||||
|
},
|
||||||
|
'.swal2-popup': {
|
||||||
|
borderRadius: '16px !important',
|
||||||
|
background: '#1a1d21 !important',
|
||||||
|
border: '1px solid rgba(255,255,255,0.1) !important',
|
||||||
|
boxShadow: '0 24px 48px rgba(0,0,0,0.5) !important'
|
||||||
|
},
|
||||||
|
'.swal2-title': {
|
||||||
|
color: '#fff !important',
|
||||||
|
fontSize: '1.25rem !important',
|
||||||
|
fontWeight: '800 !important'
|
||||||
|
},
|
||||||
|
'.swal2-html-container': {
|
||||||
|
color: 'rgba(255,255,255,0.7) !important',
|
||||||
|
fontSize: '0.9rem !important'
|
||||||
|
},
|
||||||
|
'.swal2-confirm': {
|
||||||
|
backgroundColor: '#4A7CA3 !important',
|
||||||
|
color: '#fff !important',
|
||||||
|
borderRadius: '8px !important',
|
||||||
|
padding: '10px 24px !important',
|
||||||
|
fontSize: '0.8rem !important',
|
||||||
|
fontWeight: '700 !important',
|
||||||
|
textTransform: 'uppercase !important',
|
||||||
|
letterSpacing: '0.5px !important',
|
||||||
|
boxShadow: 'none !important',
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: '#5a8cb3 !important'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'.swal2-cancel': {
|
||||||
|
backgroundColor: 'rgba(255,255,255,0.05) !important',
|
||||||
|
color: 'rgba(255,255,255,0.7) !important',
|
||||||
|
borderRadius: '8px !important',
|
||||||
|
padding: '10px 24px !important',
|
||||||
|
fontSize: '0.8rem !important',
|
||||||
|
fontWeight: '700 !important',
|
||||||
|
textTransform: 'uppercase !important',
|
||||||
|
letterSpacing: '0.5px !important',
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: 'rgba(255,255,255,0.1) !important',
|
||||||
|
color: '#fff !important'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'.swal2-input': {
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.2) !important',
|
||||||
|
border: '1px solid rgba(255,255,255,0.1) !important',
|
||||||
|
borderRadius: '8px !important',
|
||||||
|
color: '#fff !important',
|
||||||
|
fontSize: '0.9rem !important',
|
||||||
|
'&:focus': {
|
||||||
|
border: '1px solid #4A7CA3 !important',
|
||||||
|
boxShadow: '0 0 0 2px rgba(74, 124, 163, 0.2) !important'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'.swal-title-small': {
|
||||||
|
fontSize: '1rem !important',
|
||||||
|
fontWeight: '800 !important',
|
||||||
|
letterSpacing: '1px !important',
|
||||||
|
color: '#fff !important',
|
||||||
|
marginTop: '10px !important'
|
||||||
|
},
|
||||||
|
'@keyframes swalLoadingDots': {
|
||||||
|
'0%': { opacity: 0.3, transform: 'scale(0.8)' },
|
||||||
|
'50%': { opacity: 1, transform: 'scale(1.2)' },
|
||||||
|
'100%': { opacity: 0.3, transform: 'scale(0.8)' }
|
||||||
|
},
|
||||||
|
'.swal2-loading-dots': {
|
||||||
|
animation: 'swalLoadingDots 1.4s infinite ease-in-out'
|
||||||
|
},
|
||||||
|
'.nginx-error-container': {
|
||||||
|
textAlign: 'left !important',
|
||||||
|
fontFamily: 'monospace !important',
|
||||||
|
fontSize: '0.8rem !important',
|
||||||
|
whiteSpace: 'pre-wrap !important',
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.2) !important',
|
||||||
|
padding: '10px !important',
|
||||||
|
borderRadius: '5px !important',
|
||||||
|
border: '1px solid rgba(255,255,255,0.1) !important'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const GlobalStyles = () => {
|
||||||
|
return <MuiGlobalStyles styles={styles} />
|
||||||
|
}
|
||||||
|
|
||||||
|
export default GlobalStyles
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { createTheme } from '@mui/material/styles'
|
||||||
|
|
||||||
|
export const theme = createTheme({
|
||||||
|
palette: {
|
||||||
|
mode: 'dark',
|
||||||
|
primary: {
|
||||||
|
main: '#4A7CA3',
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
main: '#153E5E',
|
||||||
|
},
|
||||||
|
background: {
|
||||||
|
default: '#121212',
|
||||||
|
paper: '#1e1e1e',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
primary: '#ffffff',
|
||||||
|
secondary: 'rgba(255, 255, 255, 0.7)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
MuiPaper: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {
|
||||||
|
backgroundImage: 'none',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user