import { observer } from 'mobx-react-lite'; import React, { useEffect, useState } from 'react'; import { useVizStore } from '../../store'; import { useTranslation } from 'react-i18next'; import { ICreateField } from '../../interfaces'; import { Dialog, DialogContent, DialogFooter } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; const RenamePanel: React.FC = (props) => { const vizStore = useVizStore(); const { showRenamePanel, createField, currentEncodings } = vizStore; const { t } = useTranslation(); const [value, setValue] = useState(''); useEffect(() => { if (createField) { setValue(currentEncodings[createField.channel]?.[createField.index]?.name ?? ''); } }, [showRenamePanel]); return ( vizStore.setShowRenamePanel(false)}>

Rename Field

This action will rename this field's name in the chart.

{ setValue(e.target.value); }} />
); }; export default observer(RenamePanel);