import { FC } from 'react'; import { Button, Icon, Stack } from '@servicetitan/design-system'; import { TableCellProps, getActionCell, EditActionProps } from '../..'; import { Product } from './product'; const ViewAction: FC> = ({ tableState, dataItem, tdProps }) => { if (!tableState) { return ; } const edit = () => tableState.edit(dataItem); return ( ); }; const EditAction: FC> = ({ tableState, formState, dataItem, tdProps }) => { if (!tableState) { return ; } const save = async () => { const { hasError } = await formState.validate(); if (hasError) { return; } await tableState.saveEdit(dataItem); }; const cancel = () => tableState.cancelEdit(dataItem); return ( ); }; export const ActionsCell = getActionCell({ view: ViewAction, edit: EditAction, });