chore: initial project

This commit is contained in:
Kilu
2025-01-02 17:40:52 +08:00
commit 23472c414d
2000 changed files with 138484 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { useDatabase, useDatabaseViewId } from '@/application/database-yjs';
import { useRenderFields, GridHeader, GridTable } from '@/components/database/components/grid';
import { CircularProgress } from '@mui/material';
import React, { useEffect, useState } from 'react';
export function Grid () {
const database = useDatabase();
const viewId = useDatabaseViewId() || '';
const [scrollLeft, setScrollLeft] = useState(0);
const { fields, columnWidth } = useRenderFields();
useEffect(() => {
setScrollLeft(0);
}, [viewId]);
if (!database) {
return (
<div className={'flex w-full flex-1 flex-col items-center justify-center'}>
<CircularProgress />
</div>
);
}
return (
<div className={'database-grid flex w-full flex-1 flex-col'}>
<GridHeader
scrollLeft={scrollLeft}
columnWidth={columnWidth}
columns={fields}
onScrollLeft={setScrollLeft}
/>
<div className={'grid-scroll-table w-full flex-1'}>
<GridTable
viewId={viewId}
scrollLeft={scrollLeft}
columnWidth={columnWidth}
columns={fields}
onScrollLeft={setScrollLeft}
/>
</div>
</div>
);
}
export default Grid;