From 8632b34bb818f11751d05b67f7a3b49498ab86fd Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Wed, 19 Apr 2023 10:49:52 +0100 Subject: [PATCH] notify about enable full waveform #260 --- src/App.jsx | 21 +++++++++++---------- src/BottomBar.jsx | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index fb9c353a6cb..02081494ee5 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -202,16 +202,6 @@ const App = memo(() => { } }, [detectedFileFormat, outFormatLocked, setFileFormat, setOutFormatLocked]); - const toggleWaveformMode = useCallback((newMode) => { - if (waveformMode === 'waveform') { - setWaveformMode('big-waveform'); - } else if (waveformMode === 'big-waveform') { - setWaveformMode(); - } else { - setWaveformMode(newMode); - } - }, [waveformMode]); - const toggleEnableThumbnails = useCallback(() => setThumbnailsEnabled((v) => !v), []); const toggleExportConfirmEnabled = useCallback(() => setExportConfirmEnabled((v) => { @@ -253,6 +243,17 @@ const App = memo(() => { const hideAllNotifications = hideNotifications === 'all'; + const toggleWaveformMode = useCallback(() => { + if (waveformMode === 'waveform') { + setWaveformMode('big-waveform'); + } else if (waveformMode === 'big-waveform') { + setWaveformMode(); + } else { + if (!hideAllNotifications) toast.fire({ text: i18n.t('Mini-waveform has been enabled. Click again to enable full-screen waveform') }); + setWaveformMode('waveform'); + } + }, [hideAllNotifications, waveformMode]); + const toggleSafeOutputFileName = useCallback(() => setSafeOutputFileName((v) => { if (v && !hideAllNotifications) toast.fire({ icon: 'info', text: i18n.t('Output file name will not be sanitized, and any special characters will be preserved. This may cause the export to fail and can cause other funny issues. Use at your own risk!') }); return !v; diff --git a/src/BottomBar.jsx b/src/BottomBar.jsx index 44af7d9a25f..fb010d466cf 100644 --- a/src/BottomBar.jsx +++ b/src/BottomBar.jsx @@ -232,7 +232,7 @@ const BottomBar = memo(({ style={{ padding: '0 .1em', color: ['big-waveform', 'waveform'].includes(waveformMode) ? primaryTextColor : undefined }} role="button" title={t('Show waveform')} - onClick={() => toggleWaveformMode('waveform')} + onClick={() => toggleWaveformMode()} /> )} {hasVideo && (