TagSpaces is an offline, open source, document manager with tagging support
integrating onboarding dialog
Ilian Sapundshiev1f183fb76c00
diff --git a/app/assets/images/onboarding.jpg b/app/assets/images/onboarding.jpgnew file mode 100755index 000000000..ac7e0ea42Binary files /dev/null and b/app/assets/images/onboarding.jpg differdiff --git a/app/components/WelcomePanel.js b/app/components/WelcomePanel.jsindex 53c300913..d436f17e8 100644--- a/app/components/WelcomePanel.js+++ b/app/components/WelcomePanel.js@@ -20,26 +20,22 @@import React from 'react';import { connect } from 'react-redux';import { bindActionCreators } from 'redux';+import { withStyles } from '@material-ui/core/styles';import WelcomeLogo from '../assets/images/welcome-logo.png';import WelcomeBackground from '../assets/images/background.png';-// import AppBar from '@material-ui/AppBar';-// import Toolbar from '@material-ui/Toolbar';-// import Typography from '@material-ui/Typography';-// import Button from '@material-ui/Button';-// import IconButton from '@material-ui/IconButton';-// import ArrowDropDownIcon from '@material-ui-icons/ArrowDropDown';-// import FolderIcon from '@material-ui-icons/Folder';-// import MoreVertIcon from '@material-ui-icons/MoreVert';-import { withStyles } from '@material-ui/core/styles';// import Menu from '@material-ui/core/Menu';// import MenuItem from '@material-ui/core/MenuItem';// import ListItemIcon from '@material-ui/core/ListItemCore';// import ListItemText from '@material-ui/core/ListItemtext';// import ListSubheader from '@material-ui/core/ListSubheader';-import OnboardingDialog from './dialogs/OnboardingDialog'+// import i18n from '../services/i18n';import { getLocations, type Location } from '../reducers/locations';+import {+ isFirstRun,+ actions as SettingsActions+} from '../reducers/settings'// import { extractDirectoryName } from '../utils/paths';const styles = theme => ({@@ -68,19 +64,15 @@ type Props = {type State = {currentLocation?: Location,- isOboardingDialogVisible: boolean};class WelcomePanel extends React.Component<Props, State> {state = {currentLocation: null,- isOboardingDialogVisible: false};toggleOnboarding = () => {- this.setState({- isOboardingDialogVisible: !this.state.isOboardingDialogVisible- });+ this.props.setFirstRun(!this.props.isFirstRun);}render() {@@ -88,10 +80,11 @@ class WelcomePanel extends React.Component<Props, State> {return (<div className={classes.mainPanel}><div className={classes.slogan}>- <img src={WelcomeLogo} alt="Organize your files" onClick={this.toggleOnboarding} />- <OnboardingDialog- open={this.state.isOboardingDialogVisible}- onClose={this.toggleOnboarding}+ <img+ src={WelcomeLogo}+ alt="Organize your files"+ onClick={this.toggleOnboarding}+ // style={{ pointerEvents: 'none' }}/></div></div>@@ -101,10 +94,20 @@ class WelcomePanel extends React.Component<Props, State> {function mapStateToProps(state) {return {+ isFirstRun: isFirstRun(state),locations: getLocations(state),};}-export default connect(mapStateToProps)(+function mapActionCreatorsToProps(dispatch) {+ return bindActionCreators(+ {+ setFirstRun: SettingsActions.setFirstRun,+ },+ dispatch+ );+}++export default connect(mapStateToProps, mapActionCreatorsToProps)(withStyles(styles)(WelcomePanel));diff --git a/app/components/dialogs/OnboardingDialog.js b/app/components/dialogs/OnboardingDialog.jsindex 81f5a2152..7748085ba 100644--- a/app/components/dialogs/OnboardingDialog.js+++ b/app/components/dialogs/OnboardingDialog.js@@ -18,6 +18,8 @@*/import React from 'react';+import { connect } from 'react-redux';+import { bindActionCreators } from 'redux';import Button from '@material-ui/core/Button';import DialogActions from '@material-ui/core/DialogActions';import DialogContent from '@material-ui/core/DialogContent';@@ -27,19 +29,33 @@ import Typography from '@material-ui/core/Typography';import Card from '@material-ui/core/Card';import CardActions from '@material-ui/core/CardActions';import CardContent from '@material-ui/core/CardContent';+import Radio from '@material-ui/core/Radio';+import RadioGroup from '@material-ui/core/RadioGroup';+import FormHelperText from '@material-ui/core/FormHelperText';+import FormControlLabel from '@material-ui/core/FormControlLabel';+import FormControl from '@material-ui/core/FormControl';+import FormLabel from '@material-ui/core/FormLabel';import withMobileDialog from '@material-ui/core/withMobileDialog';import GenericDialog, { onEnterKeyHandler } from './GenericDialog';import MobileStepper from '@material-ui/core/MobileStepper';+import WelcomeImage from '../../assets/images/onboarding.jpg';import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft';import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';import SwipeableViews from 'react-swipeable-views';import i18n from '../../services/i18n';-import { loadFileContentPromise } from '../../services/utils-io';-import { Pro } from '../../pro';+import {+ isFirstRun,+ getPersistTagsInSidecarFile,+ actions as SettingsActions+} from '../../reducers/settings';type Props = {open: boolean,+ isFirstRun: boolean,+ isPersistTagsInSidecar: boolean,fullScreen: boolean,+ setFirstRun: (isFirstRun: boolean) => void,+ setPersistTagsInSidecarFile: (isPersistTagsInSidecar: boolean) => void,onClose: () => void};@@ -50,17 +66,20 @@ type State = {class OnboardingDialog extends React.Component<Props, State> {state = {activeStep: 0,+ isPersistTagsInSidecar: false};+ maxSteps = 4;+handleNext = () => {this.setState(prevState => ({- activeStep: prevState.activeStep + 1,+ activeStep: prevState.activeStep + 1}));};handleBack = () => {this.setState(prevState => ({- activeStep: prevState.activeStep - 1,+ activeStep: prevState.activeStep - 1}));};@@ -68,6 +87,9 @@ class OnboardingDialog extends React.Component<Props, State> {this.setState({ activeStep });};+ toggleTaggingType = () => {+ this.props.setPersistTagsInSidecarFile(!this.props.isPersistTagsInSidecar);+ };renderTitle = () => (<DialogTitle style={{ justifyContent: 'center', textAlign: 'center' }}>@@ -77,104 +99,196 @@ class OnboardingDialog extends React.Component<Props, State> {renderContent = () => {const { activeStep } = this.state;- const maxSteps = 4;return (- <DialogContent style={{ height: 500, overflowX: 'hidden' }}>+ <DialogContent style={{ height: 520, overflow: 'hidden' }}><SwipeableViewsindex={activeStep}onChangeIndex={this.handleStepChange}enableMouseEvents>- <div style={{ height: 400, padding: 5 }}>- <Paper elevation={1}>- <Typography variant="h5" component="h3">- Welcome- </Typography>- <Typography component="p">+ <div+ style={{+ height: 450,+ padding: 5,+ overflow: 'hidden',+ textAlign: 'center'+ }}+ >+ <Typography variant="h4">Welcome to TagSpaces</Typography>+ <div+ style={{+ backgroundImage:+ 'linear-gradient(to right, #ffe000, #799f0c)',+ height: 100,+ width: 550,+ marginTop: 15,+ position: 'relative'+ }}+ >+ <span style={{+ textAlign: 'left',+ bottom: 0,+ position: 'absolute',+ fontSize: 25,+ left: 5,+ color: 'white'+ }}+ >Your favorite file organizer has a fresh new look- </Typography>- </Paper>+ </span>+ </div></div>- <div style={{ height: 400 }}>- <Card>- <CardContent>- <Typography color="textSecondary" gutterBottom>- Word of the Day- </Typography>- <Typography variant="h5" component="h2">- be- asda- nev- aasdasd- lent+ <div+ style={{+ height: 450,+ padding: 5,+ overflow: 'hidden',+ textAlign: 'center'+ }}+ >+ <Typography variant="h4">Organize your files with tags</Typography>+ <div+ style={{+ backgroundImage:+ 'linear-gradient(to right top, #ff5f6d, #ffc371)',+ height: 100,+ width: 550,+ marginTop: 15,+ position: 'relative'+ }}+ >+ <span style={{+ textAlign: 'left',+ bottom: 0,+ position: 'absolute',+ fontSize: 25,+ left: 5,+ color: 'white'+ }}+ >+ Choose your the default tagging method for files+ </span>+ </div>+ <FormControl style={{ marginTop: 20 }} component="fieldset">+ <RadioGroup+ aria-label="Gender"+ name="isPersistTagsInSidecar"+ // value={this.props.isPersistTagsInSidecar}+ onChange={this.toggleTaggingType}+ >+ <FormControlLabel+ value="false"+ control={+ <Radio checked={!this.props.isPersistTagsInSidecar} />+ }+ label="Use the name of file for saving the tags"+ />+ <Typography variant="body2" style={{ textAlign: 'left' }}>+ Tagging the file <strong>image.jpg</strong> with a tag{' '}+ <strong>sunset</strong> will rename it to{' '}+ <strong>image[sunset].jpg</strong></Typography>- <Typography color="textSecondary">- adjective+ <FormControlLabel+ style={{ marginTop: 20 }}+ value="true"+ control={+ <Radio checked={this.props.isPersistTagsInSidecar} />+ }+ label="Use sidecar file for saving the tags"+ />+ <Typography variant="body2" style={{ textAlign: 'left' }}>+ Tagging the file <strong>image.jpg</strong> with a tag{' '}+ <strong>sunset</strong> will save this tag in an additional{' '}+ file called <strong>image.jpg.json</strong> located in a sub{' '}+ folder with the name <strong>.ts</strong></Typography>- <Typography component="p">- well meaning and kindly.- <br />- {'"a benevolent smile"'}- </Typography>- </CardContent>- <CardActions>- <Button size="small">Learn More</Button>- </CardActions>- </Card>+ </RadioGroup>+ </FormControl></div>- <div style={{ height: 400 }}>- <h3>3</h3>- <p>See ....</p>- <p>Height is adaptive</p>+ <div+ style={{+ height: 450,+ padding: 5,+ overflow: 'hidden',+ textAlign: 'center'+ }}+ >+ <Typography variant="h4">Meet our new navigation</Typography></div>- <div style={{ height: 400 }}>- <h3>4</h3>+ <div+ style={{+ height: 450,+ padding: 5,+ overflow: 'hidden',+ textAlign: 'center',+ backgroundImage:+ 'linear-gradient( 109.6deg, rgba(252,255,26,1) 34.9%, rgba(66,240,233,1) 82.5% )'+ }}+ >+ <Typography variant="h4">And... you're done</Typography>+ <img+ style={{ maxHeight: 300, marginTop: 15 }}+ src={WelcomeImage}+ alt=""+ />+ <Typography variant="h6">+ We hope you will love TagSpaces as much as we love it!+ </Typography></div></SwipeableViews><MobileStepper- steps={maxSteps}+ steps={this.maxSteps}position="static"activeStep={activeStep}nextButton={- <Button size="small" onClick={this.handleNext} disabled={activeStep === maxSteps - 1}>+ <Button+ size="small"+ onClick={this.handleNext}+ disabled={activeStep === this.maxSteps - 1}+ >Next</Button>}backButton={- <Button size="small" onClick={this.handleBack} disabled={activeStep === 0}>+ <Button+ size="small"+ onClick={this.handleBack}+ disabled={activeStep === 0}+ >Back</Button>}/></DialogContent>);- }+ };renderActions = () => (<DialogActions style={{ justifyContent: 'center' }}><Buttondata-tid="confirmLicenseDialog"onClick={this.props.onClose}+ variant={+ this.state.activeStep === this.maxSteps - 1 ? 'contained' : 'text'+ }color="primary">- {i18n.t('core:closeButton')}+ {this.state.activeStep === this.maxSteps - 1+ ? 'Start using TagSpaces'+ : i18n.t('core:closeButton')}</Button></DialogActions>);render() {- const {- fullScreen,- open,- onClose- } = this.props;+ const { fullScreen, open, onClose } = this.props;return (<GenericDialogfullScreen={fullScreen}open={open}onClose={onClose}// onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}- renderTitle={this.renderTitle}+ // renderTitle={this.renderTitle}renderContent={this.renderContent}renderActions={this.renderActions}/>@@ -182,4 +296,24 @@ class OnboardingDialog extends React.Component<Props, State> {}}-export default withMobileDialog()(OnboardingDialog);+function mapStateToProps(state) {+ return {+ isFirstRun: isFirstRun(state),+ isPersistTagsInSidecar: getPersistTagsInSidecarFile(state)+ };+}++function mapActionCreatorsToProps(dispatch) {+ return bindActionCreators(+ {+ setFirstRun: SettingsActions.setFirstRun,+ setPersistTagsInSidecarFile: SettingsActions.setPersistTagsInSidecarFile+ },+ dispatch+ );+}++export default connect(+ mapStateToProps,+ mapActionCreatorsToProps+)(withMobileDialog()(OnboardingDialog));diff --git a/app/containers/MainPage.js b/app/containers/MainPage.jsindex e1cd200a0..bd509299c 100644--- a/app/containers/MainPage.js+++ b/app/containers/MainPage.js@@ -31,14 +31,16 @@ import IconButton from '@material-ui/core/IconButton';import CloseIcon from '@material-ui/icons/Close';import { HotKeys } from 'react-hotkeys';import HTML5Backend, { NativeTypes } from 'react-dnd-html5-backend';-import LinearProgress from '@material-ui/core/LinearProgress';+// import LinearProgress from '@material-ui/core/LinearProgress';import { DragDropContext } from 'react-dnd';import VerticalNavigation, {AppVerticalPanels} from '../components/VerticalNavigation';+import OnboardingDialog from '../components/dialogs/OnboardingDialog';import FolderContainer from '../components/FolderContainer';import EntryContainer from '../components/EntryContainer';import {+ isFirstRun,getDesktopMode,getKeyBindingObject,getLeftVerticalSplitSize,@@ -114,6 +116,8 @@ type Props = {notificationStatus: Object,lastPublishedVersion: string,isUpdateAvailable: boolean,+ isFirstRun: boolean,+ setFirstRun: (isFirstRun: boolean) => void,hideNotifications: () => void,cancelDirectoryIndexing: () => void,setUpdateAvailable: (isUpdateAvailable: boolean) => void,@@ -225,6 +229,10 @@ class MainPage extends Component<Props, State> {this.setState({ shouldTogglePanel: AppVerticalPanels.search });};+ toggleOnboarding = () => {+ this.props.setFirstRun(!this.props.isFirstRun);+ }+updateDimensions = () => {const width =window.innerWidth ||@@ -530,6 +538,10 @@ class MainPage extends Component<Props, State> {</Button>,]}/>+ <OnboardingDialog+ open={this.props.isFirstRun}+ onClose={this.toggleOnboarding}+ /></TargetFileBox></HotKeys>);@@ -539,6 +551,7 @@ class MainPage extends Component<Props, State> {function mapStateToProps(state) {return {isIndexing: isIndexing(state),+ isFirstRun: isFirstRun(state),isGeneratingThumbs: isGeneratingThumbs(state),isFileOpened: isFileOpened(state),// isFileDragged: isFileDragged(state),@@ -580,7 +593,8 @@ function mapDispatchToProps(dispatch) {setLeftVerticalSplitSize: SettingsActions.setLeftVerticalSplitSize,setMainVerticalSplitSize: SettingsActions.setMainVerticalSplitSize,showNotification: AppActions.showNotification,- reflectCreateEntry: AppActions.reflectCreateEntry+ reflectCreateEntry: AppActions.reflectCreateEntry,+ setFirstRun: SettingsActions.setFirstRun,}, dispatch);}diff --git a/app/reducers/settings.js b/app/reducers/settings.jsindex 19c77b022..5b3fa80e5 100644--- a/app/reducers/settings.js+++ b/app/reducers/settings.js@@ -65,7 +65,8 @@ export const types = {SET_LAST_PUBLISHED_VERSION: 'SETTINGS/SET_LAST_PUBLISHED_VERSION',SET_ENTRY_PROPERTIES_SPLIT_SIZE: 'SETTINGS/SET_ENTRY_PROPERTIES_SPLIT_SIZE',SET_MAIN_VSPLIT_SIZE: 'SETTINGS/SET_MAIN_VSPLIT_SIZE',- SET_LEFT_VSPLIT_SIZE: 'SETTINGS/SET_LEFT_VSPLIT_SIZE'+ SET_LEFT_VSPLIT_SIZE: 'SETTINGS/SET_LEFT_VSPLIT_SIZE',+ SET_FIRST_RUN: 'SETTINGS/SET_FIRST_RUN'};export default (state = defaultSettings, action) => {@@ -119,6 +120,9 @@ export default (state = defaultSettings, action) => {case types.SET_WATCHCURRENTDIRECTORY: {return { ...state, watchCurrentDirectory: action.watchCurrentDirectory };}+ case types.SET_FIRST_RUN: {+ return { ...state, firstRun: action.firstRun };+ }case types.SET_LANGUAGE: {i18n.changeLanguage(action.language);return { ...state, interfaceLanguage: action.language };@@ -337,6 +341,10 @@ export const actions = {type: types.SET_LEFT_VSPLIT_SIZE,leftVerticalSplitSize}),+ setFirstRun: (firstRun: boolean) => ({+ type: types.SET_FIRST_RUN,+ firstRun+ }),upgradeSettings: () => ({type: types.UPGRADE_SETTINGS}),@@ -425,6 +433,7 @@ export const getLeftVerticalSplitSize = (state: Object) => state.settings.leftVeexport const getMainVerticalSplitSize = (state: Object) => state.settings.mainVerticalSplitSize;export const getTagDelimiter = (state: Object) => state.settings.tagDelimiter;export const getMaxSearchResults = (state: Object) => state.settings.maxSearchResult;+export const isFirstRun = (state: Object) => state.settings.firstRun;function generateKeyBindingObject(keyBindings: Array<Object>) {const kbObject = {};