feat: add Turkish and English localization files and initialize main application component
This commit is contained in:
@@ -68,7 +68,8 @@ import {
|
|||||||
Language as HostIcon,
|
Language as HostIcon,
|
||||||
Launch as LaunchIcon,
|
Launch as LaunchIcon,
|
||||||
Handyman as ToolsIcon,
|
Handyman as ToolsIcon,
|
||||||
Restore as ResetIcon
|
Restore as ResetIcon,
|
||||||
|
Search as SearchIcon
|
||||||
} from '@mui/icons-material'
|
} from '@mui/icons-material'
|
||||||
import Swal from 'sweetalert2'
|
import Swal from 'sweetalert2'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
@@ -117,6 +118,7 @@ function App(): JSX.Element {
|
|||||||
mariadb: { status: 'stopped' }
|
mariadb: { status: 'stopped' }
|
||||||
})
|
})
|
||||||
const [activeTab, setActiveTab] = useState('dashboard')
|
const [activeTab, setActiveTab] = useState('dashboard')
|
||||||
|
const [projectSearch, setProjectSearch] = useState('')
|
||||||
const [settingsTab, setSettingsTab] = useState(0)
|
const [settingsTab, setSettingsTab] = useState(0)
|
||||||
const [dashboardTab, setDashboardTab] = useState(0)
|
const [dashboardTab, setDashboardTab] = useState(0)
|
||||||
const [projects, setProjects] = useState<any[]>([])
|
const [projects, setProjects] = useState<any[]>([])
|
||||||
@@ -1536,10 +1538,40 @@ function App(): JSX.Element {
|
|||||||
|
|
||||||
{activeTab === 'projects' && (
|
{activeTab === 'projects' && (
|
||||||
<Box>
|
<Box>
|
||||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
|
<Box sx={{ display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, gap: 2, alignItems: { xs: 'stretch', sm: 'center' }, mb: 3 }}>
|
||||||
<Typography variant="h5" sx={{ fontWeight: 'medium' }}>
|
<Typography variant="h5" sx={{ fontWeight: 'medium', flexGrow: 1 }}>
|
||||||
{t('projects.title')}
|
{t('projects.title')}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<TextField
|
||||||
|
size="small"
|
||||||
|
placeholder={t('projects.search')}
|
||||||
|
value={projectSearch}
|
||||||
|
onChange={(e) => setProjectSearch(e.target.value)}
|
||||||
|
sx={{
|
||||||
|
minWidth: { sm: 300 },
|
||||||
|
bgcolor: 'rgba(255, 255, 255, 0.03)',
|
||||||
|
borderRadius: 1,
|
||||||
|
'& .MuiOutlinedInput-root': {
|
||||||
|
color: '#fff',
|
||||||
|
'& fieldset': { borderColor: 'rgba(255, 255, 255, 0.1)' },
|
||||||
|
'&:hover fieldset': { borderColor: 'rgba(255, 255, 255, 0.2)' },
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
InputProps={{
|
||||||
|
startAdornment: (
|
||||||
|
<InputAdornment position="start">
|
||||||
|
<SearchIcon sx={{ color: 'rgba(255, 255, 255, 0.3)' }} />
|
||||||
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
endAdornment: projectSearch && (
|
||||||
|
<InputAdornment position="end">
|
||||||
|
<IconButton size="small" onClick={() => setProjectSearch('')} sx={{ color: 'rgba(255, 255, 255, 0.3)' }}>
|
||||||
|
<CloseIcon fontSize="small" />
|
||||||
|
</IconButton>
|
||||||
|
</InputAdornment>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Button variant="contained" startIcon={<ProjectIcon />} onClick={() => setIsProjectDialogOpen(true)}>
|
<Button variant="contained" startIcon={<ProjectIcon />} onClick={() => setIsProjectDialogOpen(true)}>
|
||||||
{t('projects.add_new')}
|
{t('projects.add_new')}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1549,9 +1581,26 @@ function App(): JSX.Element {
|
|||||||
<Paper sx={{ p: 4, textAlign: 'center', bgcolor: 'rgba(255, 255, 255, 0.03)' }}>
|
<Paper sx={{ p: 4, textAlign: 'center', bgcolor: 'rgba(255, 255, 255, 0.03)' }}>
|
||||||
<Typography variant="body1" color="text.secondary">{t('projects.empty')}</Typography>
|
<Typography variant="body1" color="text.secondary">{t('projects.empty')}</Typography>
|
||||||
</Paper>
|
</Paper>
|
||||||
) : (
|
) : (() => {
|
||||||
|
const filteredProjects = projects.filter(p =>
|
||||||
|
p.name.toLowerCase().includes(projectSearch.toLowerCase()) ||
|
||||||
|
p.host.toLowerCase().includes(projectSearch.toLowerCase())
|
||||||
|
);
|
||||||
|
|
||||||
|
if (filteredProjects.length === 0) {
|
||||||
|
return (
|
||||||
|
<Paper sx={{ p: 6, textAlign: 'center', bgcolor: 'rgba(255, 255, 255, 0.02)', border: '1px dashed rgba(255, 255, 255, 0.1)' }}>
|
||||||
|
<SearchIcon sx={{ fontSize: 48, color: 'rgba(255, 255, 255, 0.1)', mb: 2 }} />
|
||||||
|
<Typography variant="h6" sx={{ color: 'rgba(255, 255, 255, 0.4)' }}>
|
||||||
|
{t('common.not_found', 'Eşleşen proje bulunamadı')}
|
||||||
|
</Typography>
|
||||||
|
</Paper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
{projects.map((project) => (
|
{filteredProjects.map((project) => (
|
||||||
<Grid item xs={12} md={6} key={project.id}>
|
<Grid item xs={12} md={6} key={project.id}>
|
||||||
<Paper
|
<Paper
|
||||||
elevation={0}
|
elevation={0}
|
||||||
@@ -1668,7 +1717,8 @@ function App(): JSX.Element {
|
|||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)
|
||||||
|
})()}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
"projects": {
|
"projects": {
|
||||||
"title": "My Projects",
|
"title": "My Projects",
|
||||||
"add_new": "Add New Project",
|
"add_new": "Add New Project",
|
||||||
|
"search": "Search for project or host...",
|
||||||
"edit": "Edit Project",
|
"edit": "Edit Project",
|
||||||
"empty": "No projects added yet.",
|
"empty": "No projects added yet.",
|
||||||
"name": "Project Name",
|
"name": "Project Name",
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
"projects": {
|
"projects": {
|
||||||
"title": "Projelerim",
|
"title": "Projelerim",
|
||||||
"add_new": "Yeni Proje Ekle",
|
"add_new": "Yeni Proje Ekle",
|
||||||
|
"search": "Proje veya host ara...",
|
||||||
"edit": "Proje Düzenle",
|
"edit": "Proje Düzenle",
|
||||||
"empty": "Henüz bir proje eklenmemiş.",
|
"empty": "Henüz bir proje eklenmemiş.",
|
||||||
"name": "Proje Adı",
|
"name": "Proje Adı",
|
||||||
@@ -77,7 +78,8 @@
|
|||||||
"added": "Proje başarıyla eklendi.",
|
"added": "Proje başarıyla eklendi.",
|
||||||
"updated": "Proje başarıyla güncellendi.",
|
"updated": "Proje başarıyla güncellendi.",
|
||||||
"deleted": "Proje silindi.",
|
"deleted": "Proje silindi.",
|
||||||
"delete_confirm": "Bu projeyi silmek istediğinize emin misiniz? Dosyalarınız silinmez, sadece listeden kaldırılır."
|
"delete_confirm": "Bu projeyi silmek istediğinize emin misiniz? Dosyalarınız silinmez, sadece listeden kaldırılır.",
|
||||||
|
"browse" : "Gözat"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"general": "Genel Ayarlar",
|
"general": "Genel Ayarlar",
|
||||||
|
|||||||
Reference in New Issue
Block a user