poi-plugin-ship-info
Advanced tools
Comparing version 3.2.3 to 4.0.0-beta.0
@@ -144,3 +144,27 @@ { | ||
"Copy to clipboard": "クリップボードえコピー", | ||
"Export to file": "ファイルを輸出する" | ||
"Export to file": "ファイルを輸出する", | ||
"return to ship types": "船種に戻れ", | ||
"Deck Planner": "出擊計画", | ||
"DD": "驅逐", | ||
"CL": "軽巡", | ||
"CA": "重巡", | ||
"BB": "戦艦", | ||
"CV": "空母", | ||
"SS": "潜水艦", | ||
"Others": "其餘艦娘", | ||
"PF": "海防", | ||
"CLT": "雷巡", | ||
"CAV": "航巡", | ||
"CVL": "軽母", | ||
"FBB": "高速戰艦", | ||
"BBV": "航戦", | ||
"SSV": "潜母", | ||
"AO": "補給", | ||
"AV": "水母", | ||
"LHA": "揚陸", | ||
"CVB": "装母", | ||
"AR": "工", | ||
"AS": "潜水母艦", | ||
"CT": "練巡", | ||
"Move to ": "移動 " | ||
} |
@@ -144,3 +144,28 @@ { | ||
"Copy to clipboard": "复制到剪贴板", | ||
"Export to file": "导出到文件" | ||
"Export to file": "导出到文件", | ||
"Ships planned for this area: ": "本海域预定出击舰娘:", | ||
"return to ship types": "返回到类型选单", | ||
"Deck Planner": "出击计划", | ||
"DD": "驱逐", | ||
"CL": "轻巡", | ||
"CA": "重巡", | ||
"BB": "战舰", | ||
"CV": "空母", | ||
"SS": "潜艇", | ||
"Others": "其余舰娘", | ||
"PF": "海防", | ||
"CLT": "雷巡", | ||
"CAV": "航巡", | ||
"CVL": "轻母", | ||
"FBB": "高速战舰", | ||
"BBV": "航战", | ||
"SSV": "潜母", | ||
"AO": "补给", | ||
"AV": "水母", | ||
"LHA": "登陆", | ||
"CVB": "装母", | ||
"AR": "工", | ||
"AS": "潜水母舰", | ||
"CT": "练巡", | ||
"Move to ": "移动到 " | ||
} |
@@ -144,3 +144,28 @@ { | ||
"Copy to clipboard": "複製到剪貼板", | ||
"Export to file": "導出到文件" | ||
"Export to file": "導出到文件", | ||
"Ships planned for this area: ": "本海域預定出擊艦娘:", | ||
"return to ship types": "返回到類型選單", | ||
"Deck Planner": "出擊計劃", | ||
"DD": "驅逐", | ||
"CL": "輕巡", | ||
"CA": "重巡", | ||
"BB": "戰艦", | ||
"CV": "空母", | ||
"SS": "潛艇", | ||
"Others": "其餘艦娘", | ||
"PF": "海防", | ||
"CLT": "雷巡", | ||
"CAV": "航巡", | ||
"CVL": "輕母", | ||
"FBB": "高速戰艦", | ||
"BBV": "航戰", | ||
"SSV": "潛母", | ||
"AO": "補給", | ||
"AV": "水母", | ||
"LHA": "登陸", | ||
"CVB": "裝母", | ||
"AR": "工", | ||
"AS": "潛水母艦", | ||
"CT": "練巡", | ||
"Move to ": "移動到 " | ||
} |
{ | ||
"name": "poi-plugin-ship-info", | ||
"version": "3.2.3", | ||
"version": "4.0.0-beta.0", | ||
"description": "Show detailed information of all owned ship girls", | ||
@@ -5,0 +5,0 @@ "main": "index.es", |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.bookmarksObserver = exports.onDelete = exports.onUpdate = exports.reducer = exports.PLUGIN_KEY = undefined; | ||
exports.dataObserver = exports.onDelete = exports.onUpdate = exports.onLoadData = exports.onDisplaceShip = exports.onRemoveShip = exports.onAddShip = exports.onDPInit = exports.reducer = exports.DATA_PATH = exports.PLUGIN_KEY = undefined; | ||
@@ -15,13 +15,37 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _redux = require('redux'); | ||
var _path = require('path'); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _selectors = require('views/utils/selectors'); | ||
var _fileWriter = require('./file-writer'); | ||
var _fileWriter2 = _interopRequireDefault(_fileWriter); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const PLUGIN_KEY = exports.PLUGIN_KEY = 'poi-plugin-ship-info'; | ||
let initState = {}; | ||
const { APPDATA_PATH } = window; | ||
const DATA_PATH = exports.DATA_PATH = _path2.default.join(APPDATA_PATH, `${PLUGIN_KEY}.json`); | ||
let bookmarkInitState = {}; | ||
const plannerInitState = { | ||
current: [], | ||
archive: {} | ||
}; | ||
const uiInitState = { | ||
toTop: true, | ||
activeDropdown: '' | ||
}; | ||
try { | ||
initState = JSON.parse(localStorage.getItem(PLUGIN_KEY)) || {}; | ||
if ('bookmark' in initState && 'planner' in initState) { | ||
initState = initState.bookmark; | ||
} | ||
const initState = JSON.parse(localStorage.getItem(PLUGIN_KEY)) || {}; | ||
bookmarkInitState = initState; | ||
} catch (e) { | ||
@@ -31,4 +55,4 @@ console.error(e.stack); | ||
const reducer = exports.reducer = (state = initState, action) => { | ||
const { type, bookmark, settings } = action; | ||
const bookmarkReducer = (state = bookmarkInitState, action) => { | ||
const { type, bookmark, settings, data } = action; | ||
switch (type) { | ||
@@ -45,2 +69,6 @@ case '@@poi-plugin-ship-info@update': | ||
} | ||
case '@@poi-plugin-ship-info@init': | ||
{ | ||
return _extends({}, state, data.bookmark); | ||
} | ||
default: | ||
@@ -51,2 +79,138 @@ return state; | ||
// current: [[ship ids in the area ] for area in fcd ] current deck planner's profile, | ||
// it depends on the fcd name, so only ship ids are stored | ||
// TODO dpBookmarks: historical data, we must make sure it is independent of fcd | ||
// { | ||
// name: 'example', | ||
// areas: [ | ||
// { | ||
// name: 'E1', | ||
// color: '#0099ff', | ||
// ships: [1, 2, 3] | ||
// } | ||
// ] | ||
// } | ||
const plannerReducer = (state = plannerInitState, action) => { | ||
const { type, mapname, shipId, areaIndex, fromAreaIndex, toAreaIndex, data } = action; | ||
const current = state.current; | ||
switch (type) { | ||
case `@@${PLUGIN_KEY}@init`: | ||
{ | ||
return _extends({}, state, data.planner); | ||
} | ||
case `@@${PLUGIN_KEY}@dp-init`: | ||
{ | ||
if (current.length < mapname.length) { | ||
const len = mapname.length - current.length; | ||
return _extends({}, state, { | ||
current: [...current, ...new Array(len).fill([])] | ||
}); | ||
} else if (current.length > mapname.length) { | ||
const newCurrent = current.slice(0, mapname.length); | ||
return _extends({}, state, { | ||
current: newCurrent | ||
}); | ||
} | ||
break; | ||
} | ||
case `@@${PLUGIN_KEY}@dp-addShip`: | ||
{ | ||
const newCurrent = current.slice(); | ||
if (!newCurrent[areaIndex].includes(shipId)) { | ||
newCurrent[areaIndex] = [...newCurrent[areaIndex], shipId]; | ||
return _extends({}, state, { | ||
current: newCurrent | ||
}); | ||
} | ||
break; | ||
} | ||
case `@@${PLUGIN_KEY}@dp-removeship`: | ||
{ | ||
const newCurrent = current.slice(); | ||
if (newCurrent[areaIndex].includes(shipId)) { | ||
newCurrent[areaIndex] = newCurrent[areaIndex].filter(id => id !== shipId); | ||
return _extends({}, state, { | ||
current: newCurrent | ||
}); | ||
} | ||
break; | ||
} | ||
case `@@${PLUGIN_KEY}@dp-displaceShip`: | ||
{ | ||
const newCurrent = current.slice(); | ||
if (newCurrent[fromAreaIndex].includes(shipId)) { | ||
newCurrent[fromAreaIndex] = newCurrent[fromAreaIndex].filter(id => id !== shipId); | ||
newCurrent[toAreaIndex] = [...newCurrent[toAreaIndex], shipId]; | ||
return _extends({}, state, { | ||
current: newCurrent | ||
}); | ||
} | ||
break; | ||
} | ||
default: | ||
return state; | ||
} | ||
return state; | ||
}; | ||
const uiReducer = (state = uiInitState, action) => { | ||
const { type, toTop, activeDropdown } = action; | ||
if (type === `@@${PLUGIN_KEY}@scroll`) { | ||
return _extends({}, state, { | ||
toTop | ||
}); | ||
} else if (type === `@@${PLUGIN_KEY}@active-dropdown`) { | ||
return _extends({}, state, { | ||
activeDropdown: activeDropdown === state.activeDropdown ? '' : activeDropdown | ||
}); | ||
} | ||
return state; | ||
}; | ||
const readyReducer = (state = false, action) => { | ||
const { type } = action; | ||
if (type === `@@${PLUGIN_KEY}@ready`) { | ||
return true; | ||
} | ||
return state; | ||
}; | ||
const reducer = exports.reducer = (0, _redux.combineReducers)({ | ||
bookmark: bookmarkReducer, | ||
planner: plannerReducer, | ||
ui: uiReducer, | ||
ready: readyReducer | ||
}); | ||
const onDPInit = exports.onDPInit = ({ color, mapname }) => ({ | ||
type: `@@${PLUGIN_KEY}@dp-init`, | ||
color, | ||
mapname | ||
}); | ||
const onAddShip = exports.onAddShip = ({ shipId, areaIndex }) => ({ | ||
type: `@@${PLUGIN_KEY}@dp-addShip`, | ||
shipId, | ||
areaIndex | ||
}); | ||
const onRemoveShip = exports.onRemoveShip = ({ shipId, areaIndex }) => ({ | ||
type: `@@${PLUGIN_KEY}@dp-removeship`, | ||
shipId, | ||
areaIndex | ||
}); | ||
const onDisplaceShip = exports.onDisplaceShip = ({ shipId, fromAreaIndex, toAreaIndex }) => ({ | ||
type: `@@${PLUGIN_KEY}@dp-displaceShip`, | ||
shipId, | ||
fromAreaIndex, | ||
toAreaIndex | ||
}); | ||
const onLoadData = exports.onLoadData = ({ data }) => ({ | ||
type: `@@${PLUGIN_KEY}@loadData`, | ||
data | ||
}); | ||
// actions | ||
@@ -64,8 +228,10 @@ const onUpdate = exports.onUpdate = ({ bookmark, settings }) => ({ | ||
const fileWriter = new _fileWriter2.default(); | ||
// observers | ||
const bookmarksObserver = exports.bookmarksObserver = (0, _reduxObservers.observer)((0, _selectors.extensionSelectorFactory)(PLUGIN_KEY), (dispatch, current = {}, previous) => { | ||
const dataObserver = exports.dataObserver = (0, _reduxObservers.observer)((0, _selectors.extensionSelectorFactory)(PLUGIN_KEY), (dispatch, current = {}, previous) => { | ||
// avoid initial state overwrites file | ||
if (!(0, _lodash.isEqual)(current, previous) && Object.keys(current).length > 0) { | ||
localStorage.setItem(PLUGIN_KEY, JSON.stringify(current)); | ||
if (current.ready) { | ||
fileWriter.write(DATA_PATH, current); | ||
} | ||
}); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.sallyAreaSelectorFactory = exports.shipRowsSelector = exports.allShipRowsSelector = exports.shipTableDataSelectorFactory = exports.shipFleetIdMapSelector = exports.shipInfoConfigSelector = undefined; | ||
exports.deckPlannerAllShipIdsSelector = exports.deckPlannerAreaSelectorFactory = exports.deckPlannerCurrentSelector = exports.shipMenuDataSelector = exports.ShipItemSelectorFactory = exports.sallyAreaSelectorFactory = exports.shipRowsSelector = exports.allShipRowsSelector = exports.shipTableDataSelectorFactory = exports.shipFleetIdMapSelector = exports.shipInfoConfigSelector = undefined; | ||
@@ -23,2 +23,4 @@ var _fastMemoize = require('fast-memoize'); | ||
var _redux = require('./redux'); | ||
var _utils = require('./utils'); | ||
@@ -225,2 +227,19 @@ | ||
color: (0, _lodash.get)(fcd, `shiptag.color.${area - 1}`, '') | ||
}))); | ||
}))); | ||
const ShipItemSelectorFactory = exports.ShipItemSelectorFactory = (0, _fastMemoize2.default)(shipId => (0, _reselect.createSelector)([(0, _selectors.shipDataSelectorFactory)(shipId)], ([ship, $ship] = []) => !!ship && !!$ship ? { | ||
id: ship.api_id, | ||
typeId: $ship.api_stype, | ||
name: $ship.api_name, | ||
lv: ship.api_lv, | ||
area: ship.api_sally_area, | ||
superTypeIndex: _utils.reverseSuperTypeMap[$ship.api_stype] || 0 | ||
} : undefined)); | ||
const shipMenuDataSelector = exports.shipMenuDataSelector = (0, _reselect.createSelector)([_selectors.shipsSelector, state => state], (_ships, state) => _fp2.default.flow(_fp2.default.map(ship => ship.api_id), _fp2.default.map(shipId => ShipItemSelectorFactory(shipId)(state)))(_ships)); | ||
const deckPlannerCurrentSelector = exports.deckPlannerCurrentSelector = (0, _reselect.createSelector)([(0, _selectors.extensionSelectorFactory)(_redux.PLUGIN_KEY)], state => state.planner.current); | ||
const deckPlannerAreaSelectorFactory = exports.deckPlannerAreaSelectorFactory = (0, _fastMemoize2.default)(areaIndex => (0, _reselect.createSelector)([deckPlannerCurrentSelector], current => current[areaIndex] || [])); | ||
const deckPlannerAllShipIdsSelector = exports.deckPlannerAllShipIdsSelector = (0, _reselect.createSelector)([deckPlannerCurrentSelector], current => (0, _lodash.flatten)(current)); |
@@ -31,4 +31,2 @@ 'use strict'; | ||
var _reduxObservers = require('redux-observers'); | ||
var _selectors = require('views/utils/selectors'); | ||
@@ -69,3 +67,3 @@ | ||
const BookmarkMenu = (0, _reactRedux.connect)(state => ({ | ||
bookmarks: (0, _selectors.extensionSelectorFactory)(_redux.PLUGIN_KEY)(state) | ||
bookmarks: (0, _selectors.extensionSelectorFactory)(_redux.PLUGIN_KEY)(state).bookmark || {} | ||
}))((_temp = _class = class BookmarkMenu extends _react.Component { | ||
@@ -88,2 +86,12 @@ constructor(props) { | ||
// componentDidMount = () => { | ||
// this.unsubsribeObserver = observe(window.store, [ShipInfoObserver]) | ||
// } | ||
// componentWillUnmount = () => { | ||
// if (this.unsubsribeObserver) { | ||
// this.unsubsribeObserver() | ||
// } | ||
// } | ||
render() { | ||
@@ -104,9 +112,21 @@ const { children } = this.props; | ||
null, | ||
_react2.default.createElement(_reactBootstrap.FormControl, { | ||
type: 'text', | ||
value: query, | ||
placeholder: __('Search or create a bookmark'), | ||
onChange: this.handleInput, | ||
id: 'bookmark-input' | ||
}) | ||
_react2.default.createElement( | ||
_reactBootstrap.InputGroup, | ||
null, | ||
_react2.default.createElement(_reactBootstrap.FormControl, { | ||
inputRef: ref => { | ||
this.queryForm = ref; | ||
}, | ||
type: 'text', | ||
value: query, | ||
placeholder: __('Search or create a bookmark'), | ||
onChange: this.handleInput, | ||
id: 'bookmark-input' | ||
}), | ||
_react2.default.createElement( | ||
_reactBootstrap.InputGroup.Addon, | ||
{ onClick: this.handleClearInput }, | ||
_react2.default.createElement(_reactFontawesome2.default, { name: 'times' }) | ||
) | ||
) | ||
) | ||
@@ -137,14 +157,3 @@ ), | ||
bookmarks: _propTypes2.default.objectOf(_propTypes2.default.object).isRequired, | ||
children: _propTypes2.default.arrayOf(_propTypes2.default.element) | ||
}, _initialiseProps = function () { | ||
this.componentDidMount = () => { | ||
this.unsubsribeObserver = (0, _reduxObservers.observe)(window.store, [_redux.bookmarksObserver]); | ||
}; | ||
this.componentWillUnmount = () => { | ||
if (this.unsubsribeObserver) { | ||
this.unsubsribeObserver(); | ||
} | ||
}; | ||
children: _propTypes2.default.arrayOf(_propTypes2.default.element) }, _initialiseProps = function () { | ||
this.componentWillReceiveProps = nextProps => { | ||
@@ -184,9 +193,22 @@ const bookmarks = (0, _lodash.values)(nextProps.bookmarks); | ||
this.handleInput = e => this.setState({ query: e.target.value }); | ||
this.handleClearInput = () => { | ||
if (this.queryForm) { | ||
this.queryForm.focus(); | ||
} | ||
this.setState({ query: '' }); | ||
}; | ||
}, _temp)); | ||
const handleToggleAction = () => ({ | ||
type: '@@poi-plugin-ship-info@active-dropdown', | ||
activeDropdown: 'bookmark' | ||
}); | ||
const BookmarkDropdown = (0, _reactRedux.connect)(state => ({ | ||
bookmarks: (0, _selectors.extensionSelectorFactory)(_redux.PLUGIN_KEY)(state) | ||
}))(({ bookmarks, open }) => _react2.default.createElement( | ||
bookmarks: (0, _selectors.extensionSelectorFactory)(_redux.PLUGIN_KEY)(state).bookmark || {}, | ||
activeDropdown: (0, _lodash.get)((0, _selectors.extensionSelectorFactory)('poi-plugin-ship-info')(state), 'ui.activeDropdown', 0) | ||
}), { handleToggle: handleToggleAction })(({ bookmarks, activeDropdown, handleToggle }) => _react2.default.createElement( | ||
_reactBootstrap.Dropdown, | ||
{ id: 'bookmark', pullRight: true, open: open }, | ||
{ id: 'bookmark', pullRight: true, open: activeDropdown === 'bookmark', onToggle: handleToggle }, | ||
_react2.default.createElement( | ||
@@ -193,0 +215,0 @@ _reactBootstrap.Dropdown.Toggle, |
@@ -35,4 +35,8 @@ 'use strict'; | ||
var _selectors = require('../selectors'); | ||
var _selectors = require('views/utils/selectors'); | ||
var _lodash = require('lodash'); | ||
var _selectors2 = require('../selectors'); | ||
var _csvParser = require('../csv-parser'); | ||
@@ -207,8 +211,14 @@ | ||
const handleToggleAction = () => ({ | ||
type: '@@poi-plugin-ship-info@active-dropdown', | ||
activeDropdown: 'export' | ||
}); | ||
const ExportDropdown = (0, _reactRedux.connect)(state => ({ | ||
allRows: (0, _selectors.allShipRowsSelector)(state), | ||
rows: (0, _selectors.shipRowsSelector)(state) | ||
}))(({ allRows, rows }) => _react2.default.createElement( | ||
allRows: (0, _selectors2.allShipRowsSelector)(state), | ||
rows: (0, _selectors2.shipRowsSelector)(state), | ||
activeDropdown: (0, _lodash.get)((0, _selectors.extensionSelectorFactory)('poi-plugin-ship-info')(state), 'ui.activeDropdown', 0) | ||
}), { handleToggle: handleToggleAction })(({ allRows, rows, activeDropdown, handleToggle }) => _react2.default.createElement( | ||
_reactBootstrap.Dropdown, | ||
{ id: 'export', pullRight: true }, | ||
{ id: 'export', pullRight: true, open: activeDropdown === 'export', onToggle: handleToggle }, | ||
_react2.default.createElement( | ||
@@ -215,0 +225,0 @@ _reactBootstrap.Dropdown.Toggle, |
@@ -11,2 +11,4 @@ 'use strict'; | ||
var _reactRedux = require('react-redux'); | ||
var _reactBootstrap = require('react-bootstrap'); | ||
@@ -18,2 +20,12 @@ | ||
var _lodash = require('lodash'); | ||
var _reduxObservers = require('redux-observers'); | ||
var _fsExtra = require('fs-extra'); | ||
var _bluebird = require('bluebird'); | ||
var _selectors = require('views/utils/selectors'); | ||
var _bookmarkDropdown = require('./bookmark-dropdown'); | ||
@@ -31,19 +43,43 @@ | ||
var _plannerDropdown = require('./planner-dropdown'); | ||
var _plannerDropdown2 = _interopRequireDefault(_plannerDropdown); | ||
var _redux = require('../redux'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
const { __, config } = window; | ||
class ShipInfoCheckboxArea extends _react.Component { | ||
const ShipInfoCheckboxArea = (0, _reactRedux.connect)(state => ({ | ||
toTop: (0, _lodash.get)((0, _selectors.extensionSelectorFactory)('poi-plugin-ship-info')(state), 'ui.toTop', 0) | ||
}))(class ShipInfoCheckboxArea extends _react.Component { | ||
constructor(...args) { | ||
var _temp; | ||
var _temp, _this; | ||
return _temp = super(...args), this.state = { | ||
scrollDown: false, | ||
menuShow: true | ||
}, this.componentDidMount = () => { | ||
window.addEventListener('scroll-top', this.handleScrollTopEvent); | ||
window.addEventListener('scroll-down', this.handleScrollDownEvent); | ||
}, this.componentWillUnmount = () => { | ||
window.removeEventListener('scroll-top', this.handleScrollTopEvent); | ||
window.removeEventListener('scroll-down', this.handleScrollDownEvent); | ||
return _temp = _this = super(...args), this.state = { | ||
menuShow: false, | ||
autoShow: true | ||
}, this.componentDidMount = _asyncToGenerator(function* () { | ||
try { | ||
const data = yield (0, _bluebird.promisify)(_fsExtra.readJson)(_redux.DATA_PATH); | ||
_this.props.dispatch({ | ||
type: '@@poi-plugin-ship-info@init', | ||
data | ||
}); | ||
} catch (e) { | ||
console.error(e.stack); | ||
} finally { | ||
_this.props.dispatch({ | ||
type: '@@poi-plugin-ship-info@ready' | ||
}); | ||
} | ||
_this.unsubscribeObserver = (0, _reduxObservers.observe)(window.store, [_redux.dataObserver]); | ||
}), this.componentWillUnmount = () => { | ||
if (this.unsubscribeObserver) { | ||
this.unsubscribeObserver(); | ||
} | ||
}, this.handleResetAll = () => { | ||
@@ -54,12 +90,9 @@ const { bounds } = config.get('plugin.ShipInfo', {}); | ||
}); | ||
}, this.handleMenuOpen = menuShow => { | ||
if (menuShow === this.state.menuShow) return; | ||
this.setState({ menuShow }); | ||
}, this.handleScrollTopEvent = () => { | ||
}, this.handleMenuOpen = () => { | ||
this.setState({ | ||
scrollDown: false | ||
menuShow: !this.state.menuShow | ||
}); | ||
}, this.handleScrollDownEvent = () => { | ||
}, this.handleAutoShow = () => { | ||
this.setState({ | ||
scrollDown: true | ||
autoShow: !this.state.autoShow | ||
}); | ||
@@ -70,3 +103,4 @@ }, _temp; | ||
render() { | ||
const { menuShow, scrollDown } = this.state; | ||
const { menuShow, autoShow } = this.state; | ||
const { toTop } = this.props; | ||
return _react2.default.createElement( | ||
@@ -87,3 +121,11 @@ 'div', | ||
{ | ||
onClick: () => this.handleMenuOpen(!menuShow), | ||
onClick: this.handleAutoShow, | ||
bsStyle: autoShow ? 'success' : 'default' | ||
}, | ||
_react2.default.createElement(_reactFontawesome2.default, { name: autoShow ? 'unlock' : 'lock' }) | ||
), | ||
_react2.default.createElement( | ||
_reactBootstrap.Button, | ||
{ | ||
onClick: this.handleMenuOpen, | ||
bsStyle: menuShow ? 'success' : 'default' | ||
@@ -113,2 +155,7 @@ }, | ||
_react2.default.createElement(_exportDropdown2.default, null) | ||
), | ||
_react2.default.createElement( | ||
_reactBootstrap.ButtonGroup, | ||
null, | ||
_react2.default.createElement(_plannerDropdown2.default, null) | ||
) | ||
@@ -122,3 +169,3 @@ ) | ||
_reactBootstrap.Collapse, | ||
{ 'in': menuShow && !scrollDown }, | ||
{ 'in': menuShow || toTop && autoShow }, | ||
_react2.default.createElement( | ||
@@ -133,4 +180,5 @@ 'div', | ||
} | ||
} | ||
}); | ||
exports.default = ShipInfoCheckboxArea; | ||
module.exports = exports['default']; |
@@ -34,3 +34,3 @@ 'use strict'; | ||
const TypeView = (0, _reactRedux.connect)((state, props) => { | ||
const $shipTypes = (0, _lodash.get)(state, 'const.$shipTypes'); | ||
const $shipTypes = (0, _lodash.get)(state, 'const.$shipTypes', {}); | ||
const defaultChecked = Object.keys($shipTypes).slice().fill(true); | ||
@@ -37,0 +37,0 @@ |
@@ -29,2 +29,4 @@ 'use strict'; | ||
var _selectors = require('views/utils/selectors'); | ||
var _divider = require('../divider'); | ||
@@ -36,3 +38,3 @@ | ||
var _selectors = require('../selectors'); | ||
var _selectors2 = require('../selectors'); | ||
@@ -101,4 +103,6 @@ var _shipInfoCells = require('./ship-info-cells'); | ||
const ShipInfoTableArea = (0, _reactRedux.connect)(state => _extends({ | ||
rows: (0, _selectors.shipRowsSelector)(state) | ||
}, (0, _selectors.shipInfoConfigSelector)(state)))((_temp = _class = class ShipInfoTableArea extends _react.Component { | ||
rows: (0, _selectors2.shipRowsSelector)(state) | ||
}, (0, _selectors2.shipInfoConfigSelector)(state), { | ||
toTop: (0, _lodash.get)((0, _selectors.extensionSelectorFactory)('poi-plugin-ship-info')(state), 'ui.toTop', 0) | ||
}))((_temp = _class = class ShipInfoTableArea extends _react.Component { | ||
@@ -297,6 +301,7 @@ constructor(props) { | ||
this.handleScroll = ({ scrollTop }) => { | ||
if (scrollTop === 0) { | ||
window.dispatchEvent(new Event('scroll-top')); | ||
} else { | ||
window.dispatchEvent(new Event('scroll-down')); | ||
if (this.props.toTop !== !scrollTop) { | ||
this.props.dispatch({ | ||
type: '@@poi-plugin-ship-info@scroll', | ||
toTop: !scrollTop | ||
}); | ||
} | ||
@@ -303,0 +308,0 @@ }; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.boolArrayToInt = exports.intToBoolArray = exports.getKanaSortValues = exports.katakanaToHiragana = exports.nameCompare = exports.shipInfoShape = exports.getShipInfoData = exports.getTimePerHP = undefined; | ||
exports.shipTypes = exports.reverseSuperTypeMap = exports.shipSuperTypeMap = exports.boolArrayToInt = exports.intToBoolArray = exports.getKanaSortValues = exports.katakanaToHiragana = exports.nameCompare = exports.shipInfoShape = exports.getShipInfoData = exports.getTimePerHP = undefined; | ||
@@ -25,2 +25,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
const { __ } = window; | ||
const getTimePerHP = exports.getTimePerHP = (api_lv = 1, api_stype = 1) => { | ||
@@ -256,2 +258,61 @@ let factor = 0; | ||
return parseInt(str, 2); | ||
}; | ||
// ship types dated 20170106, beginning with id=1 | ||
// const shipTypes = ["海防艦", "駆逐艦", "軽巡洋艦", "重雷装巡洋艦", | ||
// "重巡洋艦", "航空巡洋艦", "軽空母", "戦艦", "戦艦", "航空戦艦", "正規空母", | ||
// "超弩級戦艦", "潜水艦", "潜水空母", "補給艦", "水上機母艦", "揚陸艦", "装甲空母", | ||
// "工作艦", "潜水母艦", "練習巡洋艦", "補給艦"] | ||
// attention, shipSuperTypeMap uses api_id | ||
const shipSuperTypeMap = exports.shipSuperTypeMap = [{ | ||
name: 'DD', | ||
id: [2] | ||
}, { | ||
name: 'CL', | ||
id: [3, 4, 21] | ||
}, { | ||
name: 'CA', | ||
id: [5, 6] | ||
}, { | ||
name: 'BB', | ||
id: [8, 9, 10, 12] | ||
}, { | ||
name: 'CV', | ||
id: [7, 11, 18] | ||
}, { | ||
name: 'SS', | ||
id: [13, 14] | ||
}, { | ||
name: 'Others', | ||
id: [1, 15, 16, 17, 19, 20, 22] | ||
}]; | ||
const reverseSuperTypeMap = exports.reverseSuperTypeMap = {}; | ||
(0, _lodash.each)(shipSuperTypeMap, ({ id }, index) => (0, _lodash.each)(id, typeId => reverseSuperTypeMap[typeId] = index)); | ||
const shipTypes = exports.shipTypes = { | ||
1: __('PF'), | ||
2: __('DD'), | ||
3: __('CL'), | ||
4: __('CLT'), | ||
5: __('CA'), | ||
6: __('CAV'), | ||
7: __('CVL'), | ||
8: __('FBB'), | ||
9: __('BB'), | ||
10: __('BBV'), | ||
11: __('CV'), | ||
12: __('BB'), | ||
13: __('SS'), | ||
14: __('SSV'), | ||
15: __('AO'), | ||
16: __('AV'), | ||
17: __('LHA'), | ||
18: __('CVB'), | ||
19: __('AR'), | ||
20: __('AS'), | ||
21: __('CT'), | ||
22: __('AO') | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
347865
63
4378
2
5