Skip to content

TagSpaces is an offline, open source, document manager with tagging support

converting to stateless functional components

Ilian Sapundshiev722750500a98
diff --git a/app/components/CustomLogo.js b/app/components/CustomLogo.js
index 3f9974bbd..302371e11 100644
--- a/app/components/CustomLogo.js
+++ b/app/components/CustomLogo.js
@@ -23,23 +23,23 @@ import { bindActionCreators } from 'redux';
import IconButton from '@material-ui/core/IconButton';
import { Pro } from '../pro';
import TextLogoIcon from '../assets/images/text-logo.svg';
-import CustomLogoIcon from '../assets/images/custom-logo.svg';
+// import CustomLogoIcon from '../assets/images/custom-logo.svg';
import { actions as AppActions } from '../reducers/app';
-class CustomLogo extends Component {
- render() {
- return (
- <IconButton
- style={{ height: 50, padding: 0, marginBottom: 15 }}
- data-tid="aboutTagSpaces"
- onClick={this.props.toggleAboutDialog}
- >
- <img style={{ height: 40 }} src={Pro ? Pro.TextLogoIcon : TextLogoIcon} alt="TagSpaces Logo" />
- {/* <img style={{ height: 40 }} src={CustomLogoIcon} alt="Custom Logo" /> */}
- </IconButton>
- );
- }
-}
+type Props = {
+ toggleAboutDialog: () => void
+};
+
+const CustomLogo = (props: Props) => (
+ <IconButton
+ style={{ height: 50, padding: 0, marginBottom: 15 }}
+ data-tid="aboutTagSpaces"
+ onClick={props.toggleAboutDialog}
+ >
+ <img style={{ height: 40 }} src={Pro ? Pro.TextLogoIcon : TextLogoIcon} alt="TagSpaces Logo" />
+ {/* <img style={{ height: 40 }} src={CustomLogoIcon} alt="Custom Logo" /> */}
+ </IconButton>
+);
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators({
diff --git a/app/components/WelcomePanel.js b/app/components/WelcomePanel.js
index d436f17e8..2422637d6 100644
--- a/app/components/WelcomePanel.js
+++ b/app/components/WelcomePanel.js
@@ -23,20 +23,12 @@ 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 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 i18n from '../services/i18n';
-import { getLocations, type Location } from '../reducers/locations';
+// import { getLocations, type Location } from '../reducers/locations';
import {
isFirstRun,
actions as SettingsActions
-} from '../reducers/settings'
-// import { extractDirectoryName } from '../utils/paths';
+} from '../reducers/settings';
const styles = theme => ({
mainPanel: {
@@ -59,43 +51,30 @@ const styles = theme => ({
type Props = {
classes: Object,
- locations: Array<Location>
-};
-
-type State = {
- currentLocation?: Location,
+ setFirstRun: (isFirstRun: boolean) => void
+ // locations: Array<Location>
};
-class WelcomePanel extends React.Component<Props, State> {
- state = {
- currentLocation: null,
- };
-
- toggleOnboarding = () => {
- this.props.setFirstRun(!this.props.isFirstRun);
- }
-
- render() {
- const { classes } = this.props;
- return (
- <div className={classes.mainPanel}>
- <div className={classes.slogan}>
- <img
- src={WelcomeLogo}
- alt="Organize your files"
- onClick={this.toggleOnboarding}
- // style={{ pointerEvents: 'none' }}
- />
- </div>
+const WelcomePanel = (props: Props) => {
+ const { classes } = props;
+ return (
+ <div className={classes.mainPanel}>
+ <div className={classes.slogan}>
+ <img
+ src={WelcomeLogo}
+ alt="Organize your files"
+ onClick={() => { props.setFirstRun(!props.isFirstRun) }}
+ // style={{ pointerEvents: 'none' }}
+ />
</div>
- );
- }
-}
+ </div>
+ );
+};
function mapStateToProps(state) {
return {
isFirstRun: isFirstRun(state),
- locations: getLocations(state),
+ // locations: getLocations(state),
};
}