<commit_before>// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import {
    JupyterLabWindow
} from 'jupyterlab_app/src/main/window';

import {
    remote, Browser, ipcRenderer
} from 'jupyterlab_app/src/browser/utils';

import {
    JupyterApplicationIPC as AppIPC
} from 'jupyterlab_app/src/ipc';

import * as React from 'react';

export namespace TitleBar {
    export
    interface Props {
        uiState: JupyterLabWindow.UIState;
    }
    
    export
    interface State {
        titleBarSize: number;
    }
}

export
class TitleBar extends React.Component<TitleBar.Props, TitleBar.State> {
    
    constructor (props: TitleBar.Props) {
        super(props);
        this.state = {titleBarSize: Browser.getTopPanelSize()};

        this._handleZoom = this._handleZoom.bind(this);

        ipcRenderer.on(AppIPC.POST_ZOOM_EVENT, this._handleZoom);
    }

    componentWillUnmount() {
        ipcRenderer.removeListener(AppIPC.POST_ZOOM_EVENT, this._handleZoom);
    }

    render () {
        let modClass = 'jpe-mod-' + this.props.uiState;

        let clicked = (type: string) => {
            if (type == 'close') {
                remote.getCurrentWindow().close();
            } else if (type == 'minimize') {
                remote.getCurrentWindow().minimize();
            } else {
                remote.getCurrentWindow().maximize();
            }
        }
        
        // Don't render titlebar buttons on linux or mac
        let content: JSX.Element;
        if (this.props.uiState == 'linux' || this.props.uiState == 'mac') {<commit_msg>Fix restore window when maximized on Windows<commit_after>// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import {
    JupyterLabWindow
} from 'jupyterlab_app/src/main/window';

import {
    remote, Browser, ipcRenderer
} from 'jupyterlab_app/src/browser/utils';

import {
    JupyterApplicationIPC as AppIPC
} from 'jupyterlab_app/src/ipc';

import * as React from 'react';

export namespace TitleBar {
    export
    interface Props {
        uiState: JupyterLabWindow.UIState;
    }
    
    export
    interface State {
        titleBarSize: number;
    }
}

export
class TitleBar extends React.Component<TitleBar.Props, TitleBar.State> {
    
    constructor (props: TitleBar.Props) {
        super(props);
        this.state = {titleBarSize: Browser.getTopPanelSize()};

        this._handleZoom = this._handleZoom.bind(this);

        ipcRenderer.on(AppIPC.POST_ZOOM_EVENT, this._handleZoom);
    }

    componentWillUnmount() {
        ipcRenderer.removeListener(AppIPC.POST_ZOOM_EVENT, this._handleZoom);
    }

    render () {
        let modClass = 'jpe-mod-' + this.props.uiState;

        let clicked = (type: string) => {
            if (type == 'close') {
                remote.getCurrentWindow().close();
            } else if (type == 'minimize') {
                remote.getCurrentWindow().minimize();
            } else {
                let window = remote.getCurrentWindow();
                if (window.isMaximized())
                    window.restore();
                else
                    window.maximize();
            }
        }
        
        // Don't render titlebar buttons on linux or mac
        let content: JSX.Element;
        if (this.props.uiState == 'linux' || this.props.uiState == 'mac') {
{'fraction_non_alphanumeric': 0.11046000585994727, 'fraction_numerical': 0.0, 'mean_word_length': 2.2607449856733526, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '243457', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1014, 'n_words': 223}