lbry-desktop/ui/js/component/header/index.js

35 lines
1 KiB
JavaScript
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import { formatCredits } from "util/formatCredits";
2017-06-06 23:19:12 +02:00
import { connect } from "react-redux";
import { selectUpgradeSkipped } from "selectors/app";
import {
selectIsBackDisabled,
selectIsForwardDisabled,
} from "selectors/navigation";
2017-06-06 23:19:12 +02:00
import { selectBalance } from "selectors/wallet";
import {
doNavigate,
doHistoryBack,
doHistoryForward,
} from "actions/navigation";
2017-11-10 01:07:02 +01:00
import { doDownloadUpgrade } from "actions/app";
2017-06-06 23:19:12 +02:00
import Header from "./view";
2017-04-22 15:17:01 +02:00
2017-06-06 06:21:55 +02:00
const select = state => ({
isBackDisabled: selectIsBackDisabled(state),
isForwardDisabled: selectIsForwardDisabled(state),
balance: formatCredits(selectBalance(state) || 0, 1),
publish: __("Publish"),
upgradeLabel: __("Upgrade App"),
upgradeSkipped: selectUpgradeSkipped(state),
2017-06-06 06:21:55 +02:00
});
2017-04-22 15:17:01 +02:00
2017-06-06 06:21:55 +02:00
const perform = dispatch => ({
2017-06-06 23:19:12 +02:00
navigate: path => dispatch(doNavigate(path)),
2017-05-04 05:44:08 +02:00
back: () => dispatch(doHistoryBack()),
forward: () => dispatch(doHistoryForward()),
2017-11-10 01:07:02 +01:00
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
2017-06-06 06:21:55 +02:00
});
2017-04-22 15:17:01 +02:00
2017-06-06 06:21:55 +02:00
export default connect(select, perform)(Header);