mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
* Step 1: move electorn into `app/`. This is to comply with the suggested directory format of `electron-builder`: https://github.com/electron-userland/electron-builder#two-packagejson-structure * Step 2: add build directory with icon files for mac / windows * Step 3: move all development (web) assets into main directory * Step 4: add `build` namespace to dev `package.json` * Step 5: move all dev dependencies into dev file and get rid of old electron packagers in favor of `eletorn-builder` * Step 6: target build inside `app/` as everything else is excluded at build time * Step 7: remove old stuff! * Step 8: update README * turn off asar for `child_pty`
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import Header from '../components/header';
|
|
import { closeTab, changeTab } from '../actions/header';
|
|
import { values } from '../utils/object';
|
|
import { createSelector } from 'reselect';
|
|
import { connect } from '../utils/plugins';
|
|
|
|
const isMac = /Mac/.test(navigator.userAgent);
|
|
|
|
const getSessions = (sessions) => sessions.sessions;
|
|
const getActiveUid = (sessions) => sessions.activeUid;
|
|
const getActivityMarkers = (sessions, ui) => ui.activityMarkers;
|
|
const getTabs = createSelector(
|
|
[getSessions, getActiveUid, getActivityMarkers],
|
|
(sessions, activeUid, activityMarkers) => values(sessions).map((s) => {
|
|
return {
|
|
uid: s.uid,
|
|
title: s.title,
|
|
isActive: s.uid === activeUid,
|
|
hasActivity: activityMarkers[s.uid]
|
|
};
|
|
})
|
|
);
|
|
|
|
const HeaderContainer = connect(
|
|
(state) => {
|
|
return {
|
|
// active is an index
|
|
isMac,
|
|
tabs: getTabs(state.sessions, state.ui),
|
|
activeMarkers: state.ui.activityMarkers,
|
|
borderColor: state.ui.borderColor,
|
|
backgroundColor: state.ui.backgroundColor
|
|
};
|
|
},
|
|
(dispatch) => {
|
|
return {
|
|
onCloseTab: (i) => {
|
|
dispatch(closeTab(i));
|
|
},
|
|
|
|
onChangeTab: (i) => {
|
|
dispatch(changeTab(i));
|
|
}
|
|
};
|
|
}
|
|
)(Header, 'Header');
|
|
|
|
export default HeaderContainer;
|