feat/add row functionality done

This commit is contained in:
Mike Abebe 2023-04-05 17:13:52 +03:00
parent 764ec73e94
commit db1184ff0d
3 changed files with 9 additions and 7 deletions

View File

@ -38,7 +38,7 @@ export const Grid = ({ viewId }: { viewId: string }) => {
<GridTableRows onOpenRow={onOpenRow} allRows={rows} viewId={viewId} controller={controller} />
</table>
<GridAddRow />
<GridAddRow controller={controller} />
</div>
<GridTableCount />

View File

@ -1,7 +1,8 @@
export const useGridAddRow = () => {
function addRow() {
// create a new row
console.log('create a new row');
import { DatabaseController } from '@/appflowy_app/stores/effects/database/database_controller';
export const useGridAddRow = (controller: DatabaseController) => {
async function addRow() {
await controller.createRow();
}
return {

View File

@ -1,7 +1,8 @@
import { DatabaseController } from '@/appflowy_app/stores/effects/database/database_controller';
import AddSvg from '../../_shared/svg/AddSvg';
import { useGridAddRow } from './GridAddRow.hooks';
export const GridAddRow = () => {
const { addRow } = useGridAddRow();
export const GridAddRow = ({ controller }: { controller: DatabaseController }) => {
const { addRow } = useGridAddRow(controller);
return (
<div>