TagSpaces is an offline, open source, document manager with tagging support
migrating to swipeable drawler
Ilian Sapundshievd09d3853da8a
diff --git a/app/components/MobileNavigation.js b/app/components/MobileNavigation.jsindex 749fd1dda..a55770761 100644--- a/app/components/MobileNavigation.js+++ b/app/components/MobileNavigation.js@@ -102,10 +102,6 @@ class MobileNavigation extends React.Component<Props, State> {};styles = {- panel: {- height: '100%',- backgroundColor: '#2C001E' // 'rgb(89, 89, 89)' // '#00D1A1' // #008023- },buttonIcon: {width: 28,height: 28,@@ -120,21 +116,11 @@ class MobileNavigation extends React.Component<Props, State> {borderRadius: 0,backgroundColor: '#880E4F'},- settingsButton: {- position: 'absolute',- bottom: 0,- left: 0- },themingButton: {position: 'absolute',bottom: 45,left: 0},- upgradeButton: {- position: 'absolute',- bottom: 90,- left: 0- }};toggleProTeaser = () => {@@ -168,7 +154,7 @@ class MobileNavigation extends React.Component<Props, State> {theme} = this.props;return (- <div>+ <div style={{ height: '100%' }}><style>{`#verticalNavButton:hover {@@ -177,27 +163,25 @@ class MobileNavigation extends React.Component<Props, State> {}`}</style>- <div style={this.styles.panel}>- <IconButton- onClick={toggleAboutDialog}- style={{ ...this.styles.button, marginTop: 10, marginBottom: 16 }}- title={i18n.t('core:aboutTitle')}- data-tid="aboutTagSpaces"- >- <img- style={{- ...this.styles.buttonIcon,- color: this.props.theme.palette.text.primary- }}- src={LogoIcon}- alt="TagSpaces Logo"- />- </IconButton>+ <div style={{ width: 300, maxWidth: 300, height: 'calc(100% - 60px)' }}>+ <LocationManager style={{ display: isLocationManagerPanelOpened ? 'block' : 'none' }} />+ { isTagLibraryPanelOpened && <TagLibrary /> }+ <Search style={{ display: isSearchPanelOpened ? 'block' : 'none' }} />+ { isPerspectivesPanelOpened && <PerspectiveManager /> }+ { isHelpFeedbackPanelOpened && <HelpFeedbackPanel+ openFileNatively={openFileNatively}+ openURLExternally={openURLExternally}+ toggleKeysDialog={toggleKeysDialog}+ toggleOnboardingDialog={toggleOnboardingDialog}+ toggleProTeaser={this.toggleProTeaser}+ /> }+ </div>+ <div>{ !isReadOnlyMode && (<IconButtonid="verticalNavButton"onClick={toggleCreateFileDialog}- style={{ ...this.styles.button, marginBottom: 20 }}+ style={{ ...this.styles.button }}title={i18n.t('core:createFileTitle')}data-tid="locationManager">@@ -270,33 +254,15 @@ class MobileNavigation extends React.Component<Props, State> {isSettingsDialogOpened? {...this.styles.button,- ...this.styles.settingsButton,...this.styles.selectedButton} : {...this.styles.button,- ...this.styles.settingsButton}}><SettingsIcon style={this.styles.buttonIcon} /></IconButton></div>- { /*- <div style={this.styles.panel}>- <LocationManager style={{ display: isLocationManagerPanelOpened ? 'block' : 'none' }} />- { isTagLibraryPanelOpened && <TagLibrary /> }- <Search style={{ display: isSearchPanelOpened ? 'block' : 'none' }} />- { isPerspectivesPanelOpened && <PerspectiveManager /> }- { isHelpFeedbackPanelOpened &&- <HelpFeedbackPanel- openFileNatively={openFileNatively}- openURLExternally={openURLExternally}- toggleKeysDialog={toggleKeysDialog}- toggleOnboardingDialog={toggleOnboardingDialog}- toggleProTeaser={this.toggleProTeaser}- /> }- </div>- */}</div>);}diff --git a/app/containers/MainPage.js b/app/containers/MainPage.jsindex 7ce0ef10a..3d5b0c03c 100644--- a/app/containers/MainPage.js+++ b/app/containers/MainPage.js@@ -25,7 +25,7 @@ import { withStyles } from '@material-ui/core/styles';import classNames from 'classnames';import { translate } from 'react-i18next';import SplitPane from 'react-split-pane';-import Drawer from '@material-ui/core/Drawer';+import SwipeableDrawer from '@material-ui/core/SwipeableDrawer';import Snackbar from '@material-ui/core/Snackbar';import Button from '@material-ui/core/Button';import IconButton from '@material-ui/core/IconButton';@@ -34,6 +34,7 @@ import { HotKeys } from 'react-hotkeys';import HTML5Backend, { NativeTypes } from 'react-dnd-html5-backend';import { DragDropContext } from 'react-dnd';import VerticalNavigation from '../components/VerticalNavigation';+import MobileNavigation from '../components/MobileNavigation';import FolderContainer from '../components/FolderContainer';import EntryContainer from '../components/EntryContainer';import SettingsDialog from '../components/dialogs/settings/SettingsDialog';@@ -257,12 +258,12 @@ const SelectDirectoryAsync = props => ();type State = {- selectedDirectoryPath?: string,- isManagementPanelVisible?: boolean, // optionality because of https://github.com/codemix/flow-runtime/issues/149- mainSplitSize?: any,- isDrawerOpened?: boolean,- width?: number,- height?: number+ selectedDirectoryPath: string,+ isManagementPanelVisible: boolean, // optionality because of https://github.com/codemix/flow-runtime/issues/149+ mainSplitSize: any,+ isDrawerOpened: boolean,+ width: number,+ height: number};let showVerticalPanel = true;@@ -272,6 +273,7 @@ if (window.ExtDefaultVerticalPanel === 'none') {class MainPage extends Component<Props, State> {state = {+ selectedDirectoryPath: '',isManagementPanelVisible: showVerticalPanel,mainSplitSize: '100%',isDrawerOpened: true,@@ -321,18 +323,18 @@ class MainPage extends Component<Props, State> {});}if (nextProps.isLocationManagerPanelOpened ||- nextProps.isTagLibraryPanelOpened ||- nextProps.isSearchPanelOpened ||- nextProps.isPerspectivesPanelOpened ||- nextProps.isHelpFeedbackPanelOpened) {+ nextProps.isTagLibraryPanelOpened ||+ nextProps.isSearchPanelOpened ||+ nextProps.isPerspectivesPanelOpened ||+ nextProps.isHelpFeedbackPanelOpened) {this.setManagementPanelVisibility(true);}if (!nextProps.isLocationManagerPanelOpened &&- !nextProps.isTagLibraryPanelOpened &&- !nextProps.isSearchPanelOpened &&- !nextProps.isPerspectivesPanelOpened &&- !nextProps.isHelpFeedbackPanelOpened) {+ !nextProps.isTagLibraryPanelOpened &&+ !nextProps.isSearchPanelOpened &&+ !nextProps.isPerspectivesPanelOpened &&+ !nextProps.isHelpFeedbackPanelOpened) {this.setManagementPanelVisibility(false);}}@@ -429,14 +431,14 @@ class MainPage extends Component<Props, State> {const reader = new FileReader();reader.onload = event => {- // console.log('Content on file read complete: ' + JSON.stringify(event));- // change name for ios fakepath- // if (AppConfig.isCordovaiOS) {- // const fileExt = extractFileExtension(addFileInputName);- // addFileInputName = AppConfig.beginTagContainer + formatDateTime4Tag(new Date(), true) + AppConfig.endTagContainer + fileExt;- // }- // TODO event.currentTarget.result is ArrayBuffer- // Sample call from PRO version using content = Utils.base64ToArrayBuffer(baseString);+ // console.log('Content on file read complete: ' + JSON.stringify(event));+ // change name for ios fakepath+ // if (AppConfig.isCordovaiOS) {+ // const fileExt = extractFileExtension(addFileInputName);+ // addFileInputName = AppConfig.beginTagContainer + formatDateTime4Tag(new Date(), true) + AppConfig.endTagContainer + fileExt;+ // }+ // TODO event.currentTarget.result is ArrayBuffer+ // Sample call from PRO version using content = Utils.base64ToArrayBuffer(baseString);PlatformIO.getPropertiesPromise(filePath).then((entryProps) => {if (entryProps) {this.props.showNotification(@@ -492,6 +494,13 @@ class MainPage extends Component<Props, State> {});};+ toggleDrawer = () => {+ this.setState({+ isDrawerOpened: !this.state.isDrawerOpened+ });+ };++keyBindingHandlers = {toggleShowHiddenEntries: this.props.toggleShowUnixHiddenEntries,showFolderNavigator: this.props.openLocationManagerPanel,@@ -719,37 +728,39 @@ class MainPage extends Component<Props, State> {</SplitPane></TargetFileBox>) : (- <div>- <Drawer+ <React.Fragment>+ <SwipeableDraweropen={this.state.isDrawerOpened}- type="persistent"- classes={{- paper: classes.drawerPaper- }}+ onClose={this.toggleDrawer}+ onOpen={this.toggleDrawer}+ hysteresis={0.30}>- <VerticalNavigation />- </Drawer>+ <MobileNavigation />+ </SwipeableDrawer><SplitPane- className={classNames(- classes.content,- this.state.isDrawerOpened && classes.contentShift- )}split="vertical"- minSize={150}+ minSize="200"resizerStyle={{ backgroundColor: theme.palette.divider }}- defaultSize={this.state.isViewerPanelVisible ? '50%' : '100%'}+ size={this.state.mainSplitSize}+ onChange={size => {+ if (size > 0 && this.state.width) {+ const sizeInPercent = parseInt(((size * 100) / this.state.width), 10) + '%';+ this.setState({+ mainSplitSize: sizeInPercent+ });+ // bufferedMainSplitResize(() => this.props.setMainVerticalSplitSize(sizeInPercent));+ this.props.setMainVerticalSplitSize(sizeInPercent);+ }+ }}><FolderContainer- toggleDrawer={this.toggleDrawer}windowHeight={this.state.height}+ windowWidth={this.state.width}+ toggleDrawer={this.toggleDrawer}/>- {this.props.isFileOpened && (- <div style={{ backgroundColor: 'lightgray', height: '100%' }}>- FileViewer/Editor- </div>- )}+ <EntryContainer /></SplitPane>- </div>+ </React.Fragment>)}</HotKeys>);