lossless-cut/src/renderer/src/LastCommandsSheet.tsx

34 wiersze
1.2 KiB
TypeScript
Czysty Zwykły widok Historia

2024-02-12 06:11:36 +00:00
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import CopyClipboardButton from './components/CopyClipboardButton';
import Sheet from './components/Sheet';
2024-02-12 06:11:36 +00:00
import { FfmpegCommandLog } from './types';
2024-02-12 06:11:36 +00:00
const LastCommandsSheet = memo(({ visible, onTogglePress, ffmpegCommandLog }: {
visible: boolean, onTogglePress: () => void, ffmpegCommandLog: FfmpegCommandLog,
}) => {
const { t } = useTranslation();
return (
2024-02-07 15:31:21 +00:00
<Sheet visible={visible} onClosePress={onTogglePress} style={{ padding: '0 1em' }}>
2023-03-10 13:59:52 +00:00
<h2>{t('Last ffmpeg commands')}</h2>
{ffmpegCommandLog.length > 0 ? (
<div>
{ffmpegCommandLog.reverse().map(({ command }, i) => (
// eslint-disable-next-line react/no-array-index-key
<div key={i} style={{ whiteSpace: 'pre', margin: '5px 0' }}>
<CopyClipboardButton text={command} /> {command}
</div>
))}
</div>
) : (
<p>{t('The last executed ffmpeg commands will show up here after you run operations. You can copy them to clipboard and modify them to your needs before running on your command line.')}</p>
)}
</Sheet>
);
});
export default LastCommandsSheet;