Răsfoiți Sursa

fix: homepage databases are not fully displayed

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 9 luni în urmă
părinte
comite
3cc76a8f87
2 a modificat fișierele cu 6 adăugiri și 3 ștergeri
  1. 2 1
      client/src/pages/home/DatabaseCard.tsx
  2. 4 2
      client/src/pages/home/Home.tsx

+ 2 - 1
client/src/pages/home/DatabaseCard.tsx

@@ -10,6 +10,7 @@ import { rootContext, authContext } from '@/context';
 import { DatabaseObject } from '@server/types';
 import { DatabaseObject } from '@server/types';
 import CreateDatabaseDialog from '../dialogs/CreateDatabaseDialog';
 import CreateDatabaseDialog from '../dialogs/CreateDatabaseDialog';
 import CustomToolTip from '@/components/customToolTip/CustomToolTip';
 import CustomToolTip from '@/components/customToolTip/CustomToolTip';
+import { CREATE_DB } from './Home';
 
 
 const useStyles = makeStyles((theme: Theme) => ({
 const useStyles = makeStyles((theme: Theme) => ({
   wrapper: {
   wrapper: {
@@ -131,7 +132,7 @@ const DatabaseCard: FC<DatabaseCardProps> = ({
   };
   };
 
 
   // empty database => create new database
   // empty database => create new database
-  if (database.name === 'new') {
+  if (database.name === CREATE_DB.name) {
     return (
     return (
       <section
       <section
         className={`${wrapperClass} ${classes.wrapper} ${classes.create}`}
         className={`${wrapperClass} ${classes.wrapper} ${classes.create}`}

+ 4 - 2
client/src/pages/home/Home.tsx

@@ -30,6 +30,8 @@ const useStyles = makeStyles((theme: Theme) => ({
   },
   },
 }));
 }));
 
 
+export const CREATE_DB = { name: '___new___', collections: [], createdTime: 0 };
+
 const Home = () => {
 const Home = () => {
   useNavigationHook(ALL_ROUTER_TYPES.HOME);
   useNavigationHook(ALL_ROUTER_TYPES.HOME);
   const {
   const {
@@ -106,10 +108,10 @@ const Home = () => {
               );
               );
             })}
             })}
             <DatabaseCard
             <DatabaseCard
-              database={{ name: 'new', collections: [], createdTime: 0 }}
+              database={CREATE_DB}
               setDatabase={setDatabase}
               setDatabase={setDatabase}
               dropDatabase={dropDatabase}
               dropDatabase={dropDatabase}
-              key={'new'}
+              key={CREATE_DB.name}
             />
             />
           </div>
           </div>
         )}
         )}