<commit_before>import loggerCreator from "../../utils/logger";
//noinspection JSUnresolvedVariable
const moduleLogger = loggerCreator("MasterPage");

import React, { Component } from "react";
import { Image, StyleSheet, TouchableHighlight, Dimensions } from "react-native";
import { observer } from "mobx-react";

import { MenuContext } from "../../shared_components/context_menu/context_menu";
import Sidebar from "./sidebar";
import constants from "../../utils/constants";
import navigator from "../../stores/navigator/navigator";
import masterStore from "../../stores/master_store";
import settings from "../../utils/settings/settings";
import settingsNative from "../../utils/settings/settings_native";

import PlaylistCollectionPage from "../../pages/playlist_collection_page";
import PlayerPage from "../../pages/player_page/player_page";
import SettingsPage from "../../pages/settings/settings_page";

import backgroundImage from "../../images/background.jpg";
import hamburgerImage from "../../images/hamburger.png";

const styles = StyleSheet.create({
  container: {
    flex: 1,
    position: "relative",
    // remove width and height to override fixed static size
    width: null,
    height: null,
    alignSelf: "stretch",
  },
  menuContext: {
    flex: 1,
    alignSelf: "stretch",
  },
});

@observer
export default class MasterPage extends Component {
  async componentWillMount() {
    loggerCreator("componentWillMount", moduleLogger);

    let logger = loggerCreator("componentWillMount", moduleLogger);

    const { height, width } = Dimensions.get("window");
    moduleLogger.info(`available dimensions: width=${width} height=${height}`);

    this.state = {
      ready: false,
    };

    logger.info(`loading settings`);
    await settings.load();
    await settingsNative.load();

    logger.info(`settings loaded`);
    this.setState({ ready: true });
  }

  onHamburgerClick = () => {
    let logger = loggerCreator("onHamburgerClick", moduleLogger);

    masterStore.isNavigationSidebarOpen = !masterStore.isNavigationSidebarOpen;
    logger.info(`navigation sidebar should be now open? ${masterStore.isNavigationSidebarOpen}`);
  };

  render() {
    let logger = loggerCreator(this.render.name, moduleLogger);
    logger.info(`activate route: ${navigator.activeRoute}`);

    let page = null;
    let activeRoute = navigator.activeRoute;

    if (activeRoute) {
      switch (activeRoute.address) {
        case constants.ROUTE_PLAYLIST_COLLECTION_PAGE:
          page = <PlaylistCollectionPage />;
          break;
        case constants.ROUTE_PLAYER_PAGE:
          page = <PlayerPage playlistName={activeRoute.playlistName} />;
          break;
        case constants.ROUTE_SETTINGS_PAGE:
          page = <SettingsPage />;
          break;
        default:
          throw new Error("unexpected route");
      }
    }

    if (this.state.ready) {
      return (
        <Image source={backgroundImage} resizeMode="cover" style={styles.container}>
          <MenuContext customStyles={{ menuContextWrapper: styles.menuContext }}>
            <TouchableHighlight onPress={this.onHamburgerClick}>
              <Image source={hamburgerImage} height={34} width={34} />
            </TouchableHighlight>
            {page}
          </MenuContext>
          <Sidebar />
        </Image>
      );
    } else {
      return null;
    }
  }
}

MasterPage.propTypes = {};
<commit_msg>sidebar - fix - hamburger icon not visible in electron<commit_after>import loggerCreator from "../../utils/logger";
//noinspection JSUnresolvedVariable
const moduleLogger = loggerCreator("MasterPage");

import React, { Component } from "react";
import { Image, StyleSheet, TouchableHighlight, Dimensions } from "react-native";
import { observer } from "mobx-react";

import { MenuContext } from "../../shared_components/context_menu/context_menu";
import Sidebar from "./sidebar";
import constants from "../../utils/constants";
import navigator from "../../stores/navigator/navigator";
import masterStore from "../../stores/master_store";
import settings from "../../utils/settings/settings";
import settingsNative from "../../utils/settings/settings_native";

import PlaylistCollectionPage from "../../pages/playlist_collection_page";
import PlayerPage from "../../pages/player_page/player_page";
import SettingsPage from "../../pages/settings/settings_page";

import backgroundImage from "../../images/background.jpg";
import hamburgerImage from "../../images/hamburger.png";

const styles = StyleSheet.create({
  container: {
    flex: 1,
    position: "relative",
    // remove width and height to override fixed static size
    width: null,
    height: null,
    alignSelf: "stretch",
  },
  menuContext: {
    flex: 1,
    alignSelf: "stretch",
  },
});

@observer
export default class MasterPage extends Component {
  async componentWillMount() {
    loggerCreator("componentWillMount", moduleLogger);

    let logger = loggerCreator("componentWillMount", moduleLogger);

    const { height, width } = Dimensions.get("window");
    moduleLogger.info(`available dimensions: width=${width} height=${height}`);

    this.state = {
      ready: false,
    };

    logger.info(`loading settings`);
    await settings.load();
    await settingsNative.load();

    logger.info(`settings loaded`);
    this.setState({ ready: true });
  }

  onHamburgerClick = () => {
    let logger = loggerCreator("onHamburgerClick", moduleLogger);

    masterStore.isNavigationSidebarOpen = !masterStore.isNavigationSidebarOpen;
    logger.info(`navigation sidebar should be now open? ${masterStore.isNavigationSidebarOpen}`);
  };

  render() {
    let logger = loggerCreator(this.render.name, moduleLogger);
    logger.info(`activate route: ${navigator.activeRoute}`);

    let page = null;
    let activeRoute = navigator.activeRoute;

    if (activeRoute) {
      switch (activeRoute.address) {
        case constants.ROUTE_PLAYLIST_COLLECTION_PAGE:
          page = <PlaylistCollectionPage />;
          break;
        case constants.ROUTE_PLAYER_PAGE:
          page = <PlayerPage playlistName={activeRoute.playlistName} />;
          break;
        case constants.ROUTE_SETTINGS_PAGE:
          page = <SettingsPage />;
          break;
        default:
          throw new Error("unexpected route");
      }
    }

    if (this.state.ready) {
      return (
        <Image source={backgroundImage} resizeMode="cover" style={styles.container}>
          <MenuContext customStyles={{ menuContextWrapper: styles.menuContext }}>
            <TouchableHighlight onPress={this.onHamburgerClick}>
              <Image source={hamburgerImage} style={{ height: 34, width: 34 }} />
            </TouchableHighlight>
            {page}
          </MenuContext>
          <Sidebar />
        </Image>
      );
    } else {
      return null;
    }
  }
}

MasterPage.propTypes = {};

{'fraction_non_alphanumeric': 0.13267384346814082, 'fraction_numerical': 0.0017457084666860634, 'mean_word_length': 3.1971916971916974, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7547537', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1884, 'n_words': 444}