import { Tenant } from '@/services/data/tuples/tenant-types' ; import { useForceUpdate } from '@/widgets/basic/utils' ; import { TuplePropertyInput , TuplePropertyLabel } from '@/widgets/tuple-workbench/tuple-editor' ; import { useTupleEventBus } from '@/widgets/tuple-workbench/tuple-event-bus' ; import { TupleEventTypes , TupleState } from '@/widgets/tuple-workbench/tuple-event-bus-types' ; import React , { ChangeEvent } from 'react' ; const TenantEditor = ( props ) => { const { tenant } = props ; const { fire } = useTupleEventBus ( ) ; const forceUpdate = useForceUpdate ( ) ; const onPropChange = ( prop ) => ( event ) => { if ( tenant [ prop ] !== event . target . value ) { tenant [ prop ] = event . target . value ; fire ( TupleEventTypes . CHANGE_TUPLE_STATE , TupleState . CHANGED ) ; forceUpdate ( ) ; } } ; return < > < TuplePropertyLabel > Zone Name : < /TuplePropertyLabel> < TuplePropertyInput value = { tenant . name || '' } onChange = { onPropChange ( 'name' ) } / > < />; } ; export const renderEditor = ( tenant ) => { return < TenantEditor tenant = { tenant } />; } ;