hyper/lib/containers/header.js
Matheus Fernandes 9c90e19760 Add Windows support and first-class Linux support (#946)
* `child_pty` => `pty.js`

* Create a frameless window on Windows and Linux

* Add a brand new UI for Linux and Windows 💅

* [Windows] Fix plugin installation

* [Windows] Fix the `build` script

* [Windows] Add a bigger `icon.ico`

* [Mac] Add `WebKitAppRegion: drag` when running on macOS

* Fix code style 🤔

* Add `appveyor.yml`

* Fix code style (again)

* [Windows] Fix AppVeyor's `install` script

* [Windows] Try a new AppVeyor config

* [Windows] Set the binary path so Spectron can run the tests

* [Windows] Try to build on x64

* Try again to build on x64

* Try one more time 😩

* Throw an error to indicate that `pty.js` was built incorrectly

* [Win/Linux] Add `display: hidden` to <Tabs /> if tabs.length === 1

* [Win/Linux] Reorganize SVGs – via @CodeTheory

* [Win/Linux] Fix the hamburger menu height

* Make the SVGs look better with `shape-rendering: crispEdges;`

* [Win/Linux] Add config options for the window controls and the 🍔 menu

* Add `electron-squirrel-startup` dependency

* [Win] Handle Squirrel commands

* [Win/Linux] Fix default color for the 🍔 and window controls – via @CodeTheory

* [Win/Linux] Add some padding - via @CodeTheory

* [Win/Linux] Add hover states – via @CodeTheory

* [Win] Fix empty window/tab titles

* [Win] Fix opening Preferences (#978)

* [Win] Fix opening Preferences

* Update ui.js

* Update ui.js

* Enhance messages and default editor

* [Win] Add dependency instructions to the README.md [skip ci]

* Fix code style

* [Win/Linux] Check the number of open windows before quitting the app
2016-11-11 15:18:04 -02:00

76 lines
2.1 KiB
JavaScript

/* eslint-disable max-params */
import {createSelector} from 'reselect';
import Header from '../components/header';
import {closeTab, changeTab, maximize, openHamburgerMenu, unmaximize, minimize, close} from '../actions/header';
import {connect} from '../utils/plugins';
import getRootGroups from '../selectors';
const isMac = /Mac/.test(navigator.userAgent);
const getSessions = ({sessions}) => sessions.sessions;
const getActiveRootGroup = ({termGroups}) => termGroups.activeRootGroup;
const getActiveSessions = ({termGroups}) => termGroups.activeSessions;
const getActivityMarkers = ({ui}) => ui.activityMarkers;
const getTabs = createSelector(
[getSessions, getRootGroups, getActiveSessions, getActiveRootGroup, getActivityMarkers],
(sessions, rootGroups, activeSessions, activeRootGroup, activityMarkers) => rootGroups.map(t => {
const activeSessionUid = activeSessions[t.uid];
const session = sessions[activeSessionUid];
return {
uid: t.uid,
title: session.title,
isActive: t.uid === activeRootGroup,
hasActivity: activityMarkers[session.uid]
};
})
);
const HeaderContainer = connect(
state => {
return {
// active is an index
isMac,
tabs: getTabs(state),
activeMarkers: state.ui.activityMarkers,
borderColor: state.ui.borderColor,
backgroundColor: state.ui.backgroundColor,
maximized: state.ui.maximized,
showHamburgerMenu: state.ui.showHamburgerMenu,
showWindowControls: state.ui.showWindowControls
};
},
dispatch => {
return {
onCloseTab: i => {
dispatch(closeTab(i));
},
onChangeTab: i => {
dispatch(changeTab(i));
},
maximize: () => {
dispatch(maximize());
},
unmaximize: () => {
dispatch(unmaximize());
},
openHamburgerMenu: coordinates => {
dispatch(openHamburgerMenu(coordinates));
},
minimize: () => {
dispatch(minimize());
},
close: () => {
dispatch(close());
}
};
}
)(Header, 'Header');
export default HeaderContainer;