;
+ data: 'Yes' | 'No' | undefined;
+ cellController: CheckboxCellController;
}) => {
const toggleValue = async () => {
- await cellController?.saveCellData(!data);
+ if (data === 'Yes') {
+ await cellController?.saveCellData('No');
+ } else {
+ await cellController?.saveCellData('Yes');
+ }
};
return (
toggleValue()} className={'block px-4 py-2'}>
);
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx
index abf0b714e7..780120164e 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx
@@ -108,7 +108,11 @@ export const EditRow = ({
const onDragEnd: OnDragEndResponder = (result) => {
if (!result.destination?.index) return;
- void controller.moveField(result.source.droppableId, result.source.index, result.destination.index);
+ void controller.moveField({
+ fieldId: result.source.droppableId,
+ fromIndex: result.source.index,
+ toIndex: result.destination.index,
+ });
};
return (
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/BoardCell.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/BoardCell.tsx
index 45222f4a56..5ba97345dd 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/board/BoardCell.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/BoardCell.tsx
@@ -1,13 +1,12 @@
import { CellIdentifier } from '../../stores/effects/database/cell/cell_bd_svc';
import { CellCache } from '../../stores/effects/database/cell/cell_cache';
import { FieldController } from '../../stores/effects/database/field/field_controller';
-import { FieldType, SelectOptionCellDataPB } from '../../../services/backend';
+import { FieldType } from '../../../services/backend';
import { BoardOptionsCell } from './BoardOptionsCell';
import { BoardDateCell } from './BoardDateCell';
import { BoardTextCell } from './BoardTextCell';
import { BoardUrlCell } from '$app/components/board/BoardUrlCell';
-import { useCell } from '../_shared/database-hooks/useCell';
-import { CellOptions } from '../_shared/EditRow/CellOptions';
+import { BoardCheckboxCell } from '$app/components/board/BoardCheckboxCell';
export const BoardCell = ({
cellIdentifier,
@@ -18,19 +17,16 @@ export const BoardCell = ({
cellCache: CellCache;
fieldController: FieldController;
}) => {
- const { data, cellController } = useCell(cellIdentifier, cellCache, fieldController);
-
return (
<>
{cellIdentifier.fieldType === FieldType.SingleSelect ||
cellIdentifier.fieldType === FieldType.MultiSelect ||
cellIdentifier.fieldType === FieldType.Checklist ? (
- {
- console.log(top, left);
- }}
- />
+
) : cellIdentifier.fieldType === FieldType.DateTime ? (
+ ) : cellIdentifier.fieldType === FieldType.Checkbox ? (
+
) : (
{
+ const { data } = useCell(cellIdentifier, cellCache, fieldController);
+ return (
+
+ {data === 'Yes' ? : }
+
+ );
+};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts
index f3b0f175e4..7ab6cdd5ce 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts
@@ -12,6 +12,7 @@ import { RowInfo } from '../../stores/effects/database/row/row_cache';
import { RowController } from '../../stores/effects/database/row/row_controller';
import {
CellControllerBuilder,
+ CheckboxCellController,
DateCellController,
NumberCellController,
SelectOptionCellController,
@@ -126,6 +127,17 @@ export async function makeDateCellController(
return Some(builder.build() as DateCellController);
}
+export async function makeCheckboxCellController(
+ fieldId: string,
+ rowInfo: RowInfo,
+ databaseController: DatabaseController
+): Promise