From 14abf1223fb09aead4a3d49c9e6875efbf28982b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Fri, 24 Apr 2026 07:49:05 +0300 Subject: [PATCH] feat: implement App layout and server-side paginated DataGrid for table views --- frontend/package-lock.json | 1 + frontend/package.json | 1 + frontend/src/App.tsx | 40 ++++++++++++++++--------- frontend/src/components/MainContent.tsx | 21 +++++++++---- 4 files changed, 44 insertions(+), 19 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index cc0daac..428f062 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "frontend", "version": "0.0.0", "dependencies": { + "@emotion/cache": "^11.14.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", "@monaco-editor/react": "^4.7.0", diff --git a/frontend/package.json b/frontend/package.json index 5132e2e..1dfcc0e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@emotion/cache": "^11.14.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", "@monaco-editor/react": "^4.7.0", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 3a19c65..a2eabf1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,5 +1,7 @@ import React, { useMemo, useEffect } from 'react'; import { ThemeProvider, CssBaseline, Box } from '@mui/material'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; import { getTheme } from './theme/theme'; import { useAppStore } from './store/useAppStore'; import Sidebar from './components/Sidebar.tsx'; @@ -8,6 +10,12 @@ import Header from './components/Header.tsx'; import Login from './components/Login.tsx'; import NavigationRail from './components/NavigationRail.tsx'; +// Create emotion cache to handle the :first-child warning and ensure proper style injection +const cache = createCache({ + key: 'mui', + prepend: true, +}); + const App: React.FC = () => { const { darkMode, connected, activeTab, setActiveTab } = useAppStore(); const theme = useMemo(() => getTheme(darkMode ? 'dark' : 'light'), [darkMode]); @@ -22,25 +30,29 @@ const App: React.FC = () => { if (!connected) { return ( - - - - + + + + + + ); } return ( - - - - - {activeTab === 'explorer' && } - -
- + + + + + + {activeTab === 'explorer' && } + +
+ + - - + + ); }; diff --git a/frontend/src/components/MainContent.tsx b/frontend/src/components/MainContent.tsx index f4bb3a1..f9a09fa 100644 --- a/frontend/src/components/MainContent.tsx +++ b/frontend/src/components/MainContent.tsx @@ -41,8 +41,8 @@ const MainContent: React.FC = () => { field: col.Field, headerName: col.Field, type: type, - flex: 1, - minWidth: 150, + width: 200, + minWidth: 100, valueGetter: (value: any) => { if ((type === 'date' || type === 'dateTime') && value && typeof value === 'string') { return new Date(value); @@ -109,14 +109,14 @@ const MainContent: React.FC = () => { } return ( - + {activeDatabase}.{activeTable} - + {loadingSchema ? ( @@ -133,13 +133,24 @@ const MainContent: React.FC = () => { pageSizeOptions={[25, 50, 100]} sx={{ border: 'none', + width: '100%', + height: '100%', '& .MuiDataGrid-cell:focus': { outline: 'none', }, '& .MuiDataGrid-columnHeader:focus': { outline: 'none', }, - height: '100%', + '& .MuiDataGrid-row:nth-of-type(even)': { + bgcolor: (theme) => theme.palette.mode === 'light' + ? 'rgba(0, 0, 0, 0.03)' + : 'rgba(255, 255, 255, 0.03)', + }, + '& .MuiDataGrid-row:hover': { + bgcolor: (theme) => theme.palette.mode === 'light' + ? 'rgba(0, 97, 255, 0.08)' + : 'rgba(0, 97, 255, 0.15)', + }, }} slotProps={{ loadingOverlay: {