onEditFieldClick()}
- className={'flex w-[180px] cursor-pointer items-center gap-2 rounded-lg px-4 py-2 hover:bg-shade-6'}
+ className={'relative flex w-[180px] cursor-pointer items-center gap-2 rounded-lg px-3 py-1.5 hover:bg-shade-6'}
>
-
- {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 &&
}
- {cellIdentifier.fieldType === FieldType.Checkbox &&
}
+
+
{databaseStore.fields[cellIdentifier.fieldId].title}
+ {showFieldEditor && cellController && (
+
setShowFieldEditor(false)}
+ fieldInfo={fieldController.getField(cellIdentifier.fieldId)}
+ >
+ )}
{(cellIdentifier.fieldType === FieldType.SingleSelect ||
@@ -60,7 +59,7 @@ export const EditCellWrapper = ({
cellIdentifier.fieldType === FieldType.Checklist) && (
{(data as SelectOptionCellDataPB | undefined)?.select_options?.map((option, index) => (
-
+
{option?.name || ''}
)) || ''}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditFieldPopup.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditFieldPopup.tsx
new file mode 100644
index 0000000000..9b02590135
--- /dev/null
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditFieldPopup.tsx
@@ -0,0 +1,80 @@
+import { useEffect, useRef, useState } from 'react';
+import useOutsideClick from '$app/components/_shared/useOutsideClick';
+import { TrashSvg } from '$app/components/_shared/svg/TrashSvg';
+import { CellController } from '$app/stores/effects/database/cell/cell_controller';
+import { FieldType } from '@/services/backend';
+import { FieldTypeIcon } from '$app/components/board/EditBoardRow/FieldTypeIcon';
+import { FieldTypeName } from '$app/components/board/EditBoardRow/FieldTypeName';
+import { useTranslation } from 'react-i18next';
+import { TypeOptionController } from '$app/stores/effects/database/field/type_option/type_option_controller';
+import { Some } from 'ts-results';
+import { FieldInfo } from '$app/stores/effects/database/field/field_controller';
+
+export const EditFieldPopup = ({
+ viewId,
+ fieldName,
+ onOutsideClick,
+ fieldType,
+ cellController,
+ fieldInfo,
+}: {
+ viewId: string;
+ fieldName: string;
+ onOutsideClick?: () => void;
+ fieldType: FieldType;
+ cellController: CellController
;
+ fieldInfo: FieldInfo | undefined;
+}) => {
+ const { t } = useTranslation('');
+ const ref = useRef(null);
+ const [name, setName] = useState('');
+ useOutsideClick(ref, async () => {
+ await save();
+ onOutsideClick && onOutsideClick();
+ });
+
+ useEffect(() => {
+ setName(fieldName);
+ }, [fieldName]);
+
+ const save = async () => {
+ if (!fieldInfo) return;
+ const controller = new TypeOptionController(viewId, Some(fieldInfo));
+ await controller.initialize();
+ await controller.setFieldName(name);
+ };
+
+ return (
+
+
+ setName(e.target.value)}
+ onBlur={() => save()}
+ className={'border-shades-3 flex-1 rounded border bg-main-selector p-1'}
+ />
+
+
+
+
+
+ );
+};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditRow.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditRow.tsx
index e9374947a2..fb04a6f06f 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditRow.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/EditRow.tsx
@@ -4,6 +4,7 @@ import { DatabaseController } from '$app/stores/effects/database/database_contro
import { RowInfo } from '$app/stores/effects/database/row/row_cache';
import { EditCellWrapper } from '$app/components/board/EditBoardRow/EditCellWrapper';
import AddSvg from '$app/components/_shared/svg/AddSvg';
+import { useTranslation } from 'react-i18next';
export const EditRow = ({
onClose,
@@ -17,6 +18,7 @@ export const EditRow = ({
rowInfo: RowInfo;
}) => {
const { cells, onNewColumnClick } = useRow(viewId, controller, rowInfo);
+ const { t } = useTranslation('');
return (
@@ -26,10 +28,11 @@ export const EditRow = ({
-
+
{cells.map((cell, cellIndex) => (
- New Column
+ {t('grid.field.newColumn')}
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/FieldTypeIcon.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/FieldTypeIcon.tsx
new file mode 100644
index 0000000000..8c82601cba
--- /dev/null
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/FieldTypeIcon.tsx
@@ -0,0 +1,24 @@
+import { FieldType } 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 { CheckboxSvg } from '$app/components/_shared/svg/CheckboxSvg';
+
+export const FieldTypeIcon = ({ fieldType }: { fieldType: FieldType }) => {
+ return (
+ <>
+ {fieldType === FieldType.RichText && }
+ {fieldType === FieldType.Number && }
+ {fieldType === FieldType.DateTime && }
+ {fieldType === FieldType.SingleSelect && }
+ {fieldType === FieldType.MultiSelect && }
+ {fieldType === FieldType.Checklist && }
+ {fieldType === FieldType.URL && }
+ {fieldType === FieldType.Checkbox && }
+ >
+ );
+};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/FieldTypeName.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/FieldTypeName.tsx
new file mode 100644
index 0000000000..4e52da0a7c
--- /dev/null
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/EditBoardRow/FieldTypeName.tsx
@@ -0,0 +1,18 @@
+import { FieldType } from '@/services/backend';
+import { useTranslation } from 'react-i18next';
+
+export const FieldTypeName = ({ fieldType }: { fieldType: FieldType }) => {
+ const { t } = useTranslation('');
+ return (
+ <>
+ {fieldType === FieldType.RichText && t('grid.field.textFieldName')}
+ {fieldType === FieldType.Number && t('grid.field.numberFieldName')}
+ {fieldType === FieldType.DateTime && t('grid.field.dateFieldName')}
+ {fieldType === FieldType.SingleSelect && t('grid.field.singleSelectFieldName')}
+ {fieldType === FieldType.MultiSelect && t('grid.field.multiSelectFieldName')}
+ {fieldType === FieldType.Checklist && t('grid.field.checklistFieldName')}
+ {fieldType === FieldType.URL && t('grid.field.urlFieldName')}
+ {fieldType === FieldType.Checkbox && t('grid.field.checkboxFieldName')}
+ >
+ );
+};
diff --git a/frontend/appflowy_tauri/tailwind.config.cjs b/frontend/appflowy_tauri/tailwind.config.cjs
index d251c99f6e..1857a9b9f3 100644
--- a/frontend/appflowy_tauri/tailwind.config.cjs
+++ b/frontend/appflowy_tauri/tailwind.config.cjs
@@ -41,6 +41,9 @@ module.exports = {
fiol: '#2C144B',
},
},
+ boxShadow: {
+ md: '0px 0px 20px rgba(0, 0, 0, 0.1);',
+ },
},
},
plugins: [],