From f70fd7aaec00fea31948f6cb0a81f69b9336ef9a Mon Sep 17 00:00:00 2001 From: Jonathan Belcher Date: Tue, 28 Jul 2020 16:55:29 -0400 Subject: [PATCH] Clean up disable restore note button when is newset revision (#2248) The disable on the restore note button when you are currently on the most recent revision is CSS and was not actually disabling the functionality. Additionally, the logic failed when you first opened the revisions panel. This gets everything into tip top. --- lib/revision-selector/index.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/revision-selector/index.tsx b/lib/revision-selector/index.tsx index bc727f1a3..3e3df8b9e 100644 --- a/lib/revision-selector/index.tsx +++ b/lib/revision-selector/index.tsx @@ -36,7 +36,6 @@ export class RevisionSelector extends Component { onAcceptRevision = () => { const { noteId, openedRevision, restoreRevision } = this.props; - restoreRevision(noteId, openedRevision); }; @@ -66,7 +65,9 @@ export class RevisionSelector extends Component { revisions && openedRevision ? [...revisions.keys()].indexOf(openedRevision) : -1; - const isNewest = openedRevision && selectedIndex === revisions?.size - 1; + const isNewest = + !openedRevision || + (openedRevision && selectedIndex === revisions?.size - 1); const revisionDate = format( (openedRevision @@ -75,10 +76,6 @@ export class RevisionSelector extends Component { 'MMM d, yyyy h:mm a' ); - const revisionButtonStyle: CSSProperties = isNewest - ? { opacity: '0.5', pointerEvents: 'none' } - : {}; - const mainClasses = classNames('revision-selector', { 'is-visible': isViewingRevisions, }); @@ -105,7 +102,7 @@ export class RevisionSelector extends Component { Cancel