BoardCell.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { CellIdentifier } from '$app/stores/effects/database/cell/cell_bd_svc';
  2. import { CellCache } from '$app/stores/effects/database/cell/cell_cache';
  3. import { FieldController } from '$app/stores/effects/database/field/field_controller';
  4. import { FieldType } from '@/services/backend';
  5. import { BoardOptionsCell } from './BoardOptionsCell';
  6. import { BoardDateCell } from './BoardDateCell';
  7. import { BoardTextCell } from './BoardTextCell';
  8. import { BoardUrlCell } from '$app/components/board/BoardUrlCell';
  9. import { BoardCheckboxCell } from '$app/components/board/BoardCheckboxCell';
  10. export const BoardCell = ({
  11. cellIdentifier,
  12. cellCache,
  13. fieldController,
  14. }: {
  15. cellIdentifier: CellIdentifier;
  16. cellCache: CellCache;
  17. fieldController: FieldController;
  18. }) => {
  19. return (
  20. <>
  21. {cellIdentifier.fieldType === FieldType.SingleSelect ||
  22. cellIdentifier.fieldType === FieldType.MultiSelect ||
  23. cellIdentifier.fieldType === FieldType.Checklist ? (
  24. <BoardOptionsCell
  25. cellIdentifier={cellIdentifier}
  26. cellCache={cellCache}
  27. fieldController={fieldController}
  28. ></BoardOptionsCell>
  29. ) : cellIdentifier.fieldType === FieldType.DateTime ? (
  30. <BoardDateCell
  31. cellIdentifier={cellIdentifier}
  32. cellCache={cellCache}
  33. fieldController={fieldController}
  34. ></BoardDateCell>
  35. ) : cellIdentifier.fieldType === FieldType.URL ? (
  36. <BoardUrlCell
  37. cellIdentifier={cellIdentifier}
  38. cellCache={cellCache}
  39. fieldController={fieldController}
  40. ></BoardUrlCell>
  41. ) : cellIdentifier.fieldType === FieldType.Checkbox ? (
  42. <BoardCheckboxCell
  43. cellIdentifier={cellIdentifier}
  44. cellCache={cellCache}
  45. fieldController={fieldController}
  46. ></BoardCheckboxCell>
  47. ) : (
  48. <BoardTextCell
  49. cellIdentifier={cellIdentifier}
  50. cellCache={cellCache}
  51. fieldController={fieldController}
  52. ></BoardTextCell>
  53. )}
  54. </>
  55. );
  56. };