diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditBoardCell.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditBoardCell.tsx new file mode 100644 index 0000000000..be125fcea9 --- /dev/null +++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditBoardCell.tsx @@ -0,0 +1,54 @@ +import { CellIdentifier } from '$app/stores/effects/database/cell/cell_bd_svc'; +import { useCell } from '$app/components/_shared/database-hooks/useCell'; +import { CellCache } from '$app/stores/effects/database/cell/cell_cache'; +import { FieldController } from '$app/stores/effects/database/field/field_controller'; +import { FieldType, SelectOptionCellDataPB } from '@/services/backend'; +import { TextTypeSvg } from '$app/components/_shared/svg/TextTypeSvg'; +import { NumberTypeSvg } from '$app/components/_shared/svg/NumberTypeSvg'; +import { DateTypeSvg } from '$app/components/_shared/svg/DateTypeSvg'; +import { SingleSelectTypeSvg } from '$app/components/_shared/svg/SingleSelectTypeSvg'; +import { MultiSelectTypeSvg } from '$app/components/_shared/svg/MultiSelectTypeSvg'; +import { ChecklistTypeSvg } from '$app/components/_shared/svg/ChecklistTypeSvg'; +import { UrlTypeSvg } from '$app/components/_shared/svg/UrlTypeSvg'; +import { useAppSelector } from '$app/stores/store'; + +export const EditBoardCell = ({ + cellIdentifier, + cellCache, + fieldController, +}: { + cellIdentifier: CellIdentifier; + cellCache: CellCache; + fieldController: FieldController; +}) => { + const { data } = useCell(cellIdentifier, cellCache, fieldController); + const databaseStore = useAppSelector((state) => state.database); + return ( +
+
+
+ {cellIdentifier.fieldType === FieldType.RichText && } + {cellIdentifier.fieldType === FieldType.Number && } + {cellIdentifier.fieldType === FieldType.DateTime && } + {cellIdentifier.fieldType === FieldType.SingleSelect && } + {cellIdentifier.fieldType === FieldType.MultiSelect && } + {cellIdentifier.fieldType === FieldType.Checklist && } + {cellIdentifier.fieldType === FieldType.URL && } +
+ + {databaseStore.fields[cellIdentifier.fieldId].title} + +
+
+ {(cellIdentifier.fieldType === FieldType.SingleSelect || cellIdentifier.fieldType === FieldType.MultiSelect) && ( +
+ {(data as SelectOptionCellDataPB | undefined)?.select_options?.map((option, index) => ( +
{option?.name || ''}
+ )) || ''} +
+ )} + {
{data as string}
} +
+
+ ); +}; diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditBoardRow.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditBoardRow.tsx new file mode 100644 index 0000000000..e6d63cf6dd --- /dev/null +++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditBoardRow.tsx @@ -0,0 +1,41 @@ +import { CloseSvg } from '$app/components/_shared/svg/CloseSvg'; +import { useRow } from '$app/components/_shared/database-hooks/useRow'; +import { DatabaseController } from '$app/stores/effects/database/database_controller'; +import { RowInfo } from '$app/stores/effects/database/row/row_cache'; +import { EditBoardCell } from '$app/components/board/EditBoardRow/EditBoardCell'; + +export const EditBoardRow = ({ + onClose, + viewId, + controller, + rowInfo, +}: { + onClose: () => void; + viewId: string; + controller: DatabaseController; + rowInfo: RowInfo; +}) => { + const { cells } = useRow(viewId, controller, rowInfo); + + return ( +
+
+
onClose()} className={'absolute top-4 right-4'}> + +
+
+ {cells.map((cell, cellIndex) => ( + + ))} +
+
+
+ ); +};