From bfb82e8a21eadbe7503df8cc8424878a52177c6c Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Fri, 30 Sep 2022 12:20:59 -0500 Subject: [PATCH] autosave warning conditional on elapsed time unsaved. --- client/homebrew/pages/editPage/editPage.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 3fcdcc168..03cd87a0b 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -342,14 +342,14 @@ const EditPage = createClass({ } if(this.state.autoSaveWarning){ - console.log(this.state.unsavedTime); - setTimeout(()=>this.setState({ autoSaveWarning: false }), 4000); this.setAutosaveWarning(); + const elapsedTime = Math.round((new Date() - this.state.unsavedTime) / 1000 / 60); + const text = elapsedTime == 0 ? 'Autosave is OFF.' : `Autosave has been turned off, and you haven't saved for ${elapsedTime} minutes.`; return Reminder...
- Autosave has been turned off, and you haven't saved for {Math.round((new Date() - this.state.unsavedTime) / 1000 / 60)} minutes. + {text}
; } @@ -379,6 +379,7 @@ const EditPage = createClass({ }, setAutosaveWarning : function(){ + setTimeout(()=>this.setState({ autoSaveWarning: false }), 4000); this.warningTimer = setTimeout(()=>{this.setState({ autoSaveWarning: true });}, 15000); this.warningTimer; },