BoardOptionsCell.tsx 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import { SelectOptionCellDataPB } from '@/services/backend';
  2. import { useCell } from '../_shared/database-hooks/useCell';
  3. import { CellIdentifier } from '$app/stores/effects/database/cell/cell_bd_svc';
  4. import { CellCache } from '$app/stores/effects/database/cell/cell_cache';
  5. import { FieldController } from '$app/stores/effects/database/field/field_controller';
  6. import { getBgColor } from '$app/components/_shared/getColor';
  7. export const BoardOptionsCell = ({
  8. cellIdentifier,
  9. cellCache,
  10. fieldController,
  11. }: {
  12. cellIdentifier: CellIdentifier;
  13. cellCache: CellCache;
  14. fieldController: FieldController;
  15. }) => {
  16. const { data } = useCell(cellIdentifier, cellCache, fieldController);
  17. return (
  18. <div className={'flex flex-wrap items-center gap-2 py-2 text-xs text-black'}>
  19. {(data as SelectOptionCellDataPB | undefined)?.select_options?.map((option, index) => (
  20. <div className={`${getBgColor(option.color)} rounded px-2 py-0.5`} key={index}>
  21. {option?.name || ''}
  22. </div>
  23. )) || ''}
  24. &nbsp;
  25. </div>
  26. );
  27. };