From 37d765ab218ae50e3fd4705973f7bed06c1f4eb5 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Tue, 5 Jul 2022 20:14:01 +0530 Subject: [PATCH] fix(web): content & navigation list scroll on mobile (#1207) --- .../encryption/src/Domain/Split/EncryptionSplit.ts | 6 +----- .../Components/ContentListView/ContentList.tsx | 7 ++++++- .../Components/ContentListView/ContentListView.tsx | 14 +++++++++----- .../Components/Navigation/Navigation.tsx | 9 ++++++++- .../Components/PanelResizer/PanelResizer.tsx | 1 + .../ResponsivePane/ResponsivePaneContent.tsx | 2 +- .../src/javascripts/Components/Tags/TagsList.tsx | 4 +--- packages/web/src/stylesheets/_items-column.scss | 2 -- packages/web/src/stylesheets/_navigation.scss | 7 ------- 9 files changed, 27 insertions(+), 25 deletions(-) diff --git a/packages/encryption/src/Domain/Split/EncryptionSplit.ts b/packages/encryption/src/Domain/Split/EncryptionSplit.ts index ad364a998..c3094844a 100644 --- a/packages/encryption/src/Domain/Split/EncryptionSplit.ts +++ b/packages/encryption/src/Domain/Split/EncryptionSplit.ts @@ -1,9 +1,5 @@ import { Uuid } from '@standardnotes/common' -import { - DecryptedPayloadInterface, - EncryptedPayloadInterface, - PayloadInterface, -} from '@standardnotes/models' +import { DecryptedPayloadInterface, EncryptedPayloadInterface, PayloadInterface } from '@standardnotes/models' import { EncryptionTypeSplit } from './EncryptionTypeSplit' import { KeyedDecryptionSplit } from './KeyedDecryptionSplit' import { KeyedEncryptionSplit } from './KeyedEncryptionSplit' diff --git a/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx b/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx index af032ea03..1dba62bfc 100644 --- a/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/ContentList.tsx @@ -12,6 +12,7 @@ import { SelectedItemsController } from '@/Controllers/SelectedItemsController' import { NavigationController } from '@/Controllers/Navigation/NavigationController' import { NotesController } from '@/Controllers/NotesController' import { ElementIds } from '@/Constants/ElementIDs' +import { classNames } from '@/Utils/ConcatenateClassNames' type Props = { application: WebApplication @@ -66,7 +67,11 @@ const ContentList: FunctionComponent = ({ return (
= ({ notesController, selectionController, }) => { + const { toggleAppPane } = useResponsiveAppPane() + const itemsViewPanelRef = useRef(null) const { @@ -65,13 +68,14 @@ const ContentListView: FunctionComponent = ({ [navigationController.selected?.uuid], ) - const addNewItem = useCallback(() => { + const addNewItem = useCallback(async () => { if (isFilesSmartView) { void filesController.uploadNewFile() } else { - void createNewNote() + await createNewNote() + toggleAppPane(AppPaneId.Editor) } - }, [filesController, createNewNote, isFilesSmartView]) + }, [isFilesSmartView, filesController, createNewNote, toggleAppPane]) useEffect(() => { /** @@ -84,7 +88,7 @@ const ContentListView: FunctionComponent = ({ modifiers: [KeyboardModifier.Meta, KeyboardModifier.Ctrl], onKeyDown: (event) => { event.preventDefault() - addNewItem() + void addNewItem() }, }) @@ -170,7 +174,7 @@ const ContentListView: FunctionComponent = ({ return (
diff --git a/packages/web/src/javascripts/Components/Navigation/Navigation.tsx b/packages/web/src/javascripts/Components/Navigation/Navigation.tsx index 6d5112b97..816b24f84 100644 --- a/packages/web/src/javascripts/Components/Navigation/Navigation.tsx +++ b/packages/web/src/javascripts/Components/Navigation/Navigation.tsx @@ -9,6 +9,7 @@ import PanelResizer, { PanelSide, ResizeFinishCallback, PanelResizeType } from ' import SearchBar from '@/Components/SearchBar/SearchBar' import ResponsivePaneContent from '@/Components/ResponsivePane/ResponsivePaneContent' import { AppPaneId } from '@/Components/ResponsivePane/AppPaneMetadata' +import { classNames } from '@/Utils/ConcatenateClassNames' type Props = { application: WebApplication @@ -59,7 +60,13 @@ const Navigation: FunctionComponent = ({ application }) => {
-
+
diff --git a/packages/web/src/javascripts/Components/PanelResizer/PanelResizer.tsx b/packages/web/src/javascripts/Components/PanelResizer/PanelResizer.tsx index c1e41a81c..9365e038e 100644 --- a/packages/web/src/javascripts/Components/PanelResizer/PanelResizer.tsx +++ b/packages/web/src/javascripts/Components/PanelResizer/PanelResizer.tsx @@ -315,6 +315,7 @@ class PanelResizer extends Component { this.props.hoverable && 'hover:opacity-100', this.props.side === PanelSide.Left && 'left-0 right-auto', )} + onMouseDown={this.onMouseDown} ref={this.resizerElementRef} /> ) diff --git a/packages/web/src/javascripts/Components/ResponsivePane/ResponsivePaneContent.tsx b/packages/web/src/javascripts/Components/ResponsivePane/ResponsivePaneContent.tsx index 12f4c9f15..aff772e84 100644 --- a/packages/web/src/javascripts/Components/ResponsivePane/ResponsivePaneContent.tsx +++ b/packages/web/src/javascripts/Components/ResponsivePane/ResponsivePaneContent.tsx @@ -33,7 +33,7 @@ const ResponsivePaneContent = ({ children, contentClassName, contentElementId, p
{children}
diff --git a/packages/web/src/javascripts/Components/Tags/TagsList.tsx b/packages/web/src/javascripts/Components/Tags/TagsList.tsx index 8a0e59ad5..704a066e7 100644 --- a/packages/web/src/javascripts/Components/Tags/TagsList.tsx +++ b/packages/web/src/javascripts/Components/Tags/TagsList.tsx @@ -1,11 +1,9 @@ import { ViewControllerManager } from '@/Services/ViewControllerManager' -import { isMobile } from '@/Utils' import { SNTag } from '@standardnotes/snjs' import { observer } from 'mobx-react-lite' import { FunctionComponent, useCallback } from 'react' import { DndProvider } from 'react-dnd' import { HTML5Backend } from 'react-dnd-html5-backend' -import { TouchBackend } from 'react-dnd-touch-backend' import RootTagDropZone from './RootTagDropZone' import { TagsListItem } from './TagsListItem' @@ -17,7 +15,7 @@ const TagsList: FunctionComponent = ({ viewControllerManager }: Props) => const tagsState = viewControllerManager.navigationController const allTags = tagsState.allLocalRootTags - const backend = isMobile({ tablet: true }) ? TouchBackend : HTML5Backend + const backend = HTML5Backend const openTagContextMenu = useCallback( (posX: number, posY: number) => { diff --git a/packages/web/src/stylesheets/_items-column.scss b/packages/web/src/stylesheets/_items-column.scss index 2daf7d39a..9e2b58206 100644 --- a/packages/web/src/stylesheets/_items-column.scss +++ b/packages/web/src/stylesheets/_items-column.scss @@ -108,8 +108,6 @@ } .infinite-scroll { - @include minimal_scrollbar(); - height: inherit; background-color: var(--items-column-items-background-color); } diff --git a/packages/web/src/stylesheets/_navigation.scss b/packages/web/src/stylesheets/_navigation.scss index 945a9ea8e..8ea2dc5eb 100644 --- a/packages/web/src/stylesheets/_navigation.scss +++ b/packages/web/src/stylesheets/_navigation.scss @@ -1,10 +1,3 @@ -@import './scrollbar'; - -#navigation .scrollable { - @include minimal_scrollbar(); - height: 100%; -} - $content-horizontal-padding: 16px; #navigation {