import { Button, DialogContent, Table } from '@mui/material'; import Translate from '@mui/icons-material/Translate'; import React, { useCallback } from 'react'; import { useCellDataI18nRaw, useLang, useOption, useSetLang, useUiTranslator, useUpdateCellData, } from '../../core/components/hooks'; import DraftSwitch from '../DraftSwitch'; import SelectLang from './SelectLang'; const I18nDialog = ({ nodeId, onClose, }: { nodeId: string; onClose: () => void; }) => { const currentLang = useLang(); const languages = useOption('languages'); const { t } = useUiTranslator(); const setLang = useSetLang(); const dataI18n = useCellDataI18nRaw(nodeId); const updateCellData = useUpdateCellData(nodeId); const reset = useCallback( (lang: string) => { updateCellData(null, { lang, }); }, [updateCellData] ); const defaultLangLabel = languages?.[0]?.label; return (

{languages?.map((l, index) => { const data = dataI18n?.[l.lang]; const isCurrent = currentLang === l.lang; const hasData = Boolean(data); return ( ); })}
{hasData ? '✔️' : ' '} {hasData && index !== 0 ? ( ) : null}
); }; export default I18nDialog;