poi-plugin-leveling-plan 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,14 +7,10 @@ var _react = _interopRequireWildcard(require("react"));
7
7
 
8
8
  var _core = require("@blueprintjs/core");
9
9
 
10
- var _select = require("@blueprintjs/select");
11
-
12
10
  var _reactRedux = require("react-redux");
13
11
 
14
12
  var _reselect = require("reselect");
15
13
 
16
- var _lodash = _interopRequireDefault(require("lodash"));
17
-
18
14
  var _constants = require("../../utils/constants");
19
15
 
20
16
  var _selectors = require("../../utils/selectors");
@@ -23,17 +19,12 @@ var _expCalculator = require("../../utils/exp-calculator");
23
19
 
24
20
  var _planHelpers = require("../../utils/plan-helpers");
25
21
 
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
22
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
29
23
 
30
24
  const {
31
25
  __
32
26
  } = window.i18n['poi-plugin-leveling-plan'];
33
27
 
34
- const MapMultiSelect = _select.MultiSelect.ofType(); // 按世界分组
35
-
36
-
37
28
  const getWorldGroups = () => {
38
29
  const groups = {};
39
30
  Object.keys(_constants.EXP_BY_POI_DB).sort((a, b) => Number(a) - Number(b)).forEach(id => {
@@ -52,6 +43,7 @@ class MapSelector extends _react.Component {
52
43
 
53
44
  this.state = {
54
45
  isOpen: false,
46
+ searchQuery: '',
55
47
  activeWorld: null
56
48
  };
57
49
  this.worldGroups = getWorldGroups();
@@ -63,39 +55,70 @@ class MapSelector extends _react.Component {
63
55
  const {
64
56
  value = []
65
57
  } = this.props;
66
- const allMapIds = Object.keys(_constants.EXP_BY_POI_DB);
58
+ const valueStrings = value.map(String);
59
+ const selectedMaps = valueStrings.filter(id => _constants.EXP_BY_POI_DB[id] !== undefined);
67
60
  return _react.default.createElement("div", {
68
61
  className: "map-selector"
69
62
  }, _react.default.createElement("div", {
70
- className: "quick-select-buttons"
71
- }, _react.default.createElement(MapMultiSelect, {
72
- items: allMapIds,
73
- selectedItems: value.filter(id => allMapIds.includes(id)),
74
- onItemSelect: this.handleItemSelect,
75
- itemRenderer: () => null,
76
- itemListRenderer: () => this.renderPopoverContent(),
77
- tagRenderer: this.renderTag,
78
- tagInputProps: {
79
- onRemove: this.handleTagRemove,
80
- placeholder: __('More maps'),
81
- rightElement: _react.default.createElement(_core.Button, {
82
- minimal: true,
83
- icon: "caret-down",
84
- onClick: () => this.setState({
85
- isOpen: !this.state.isOpen
86
- })
87
- })
63
+ className: "quick-select-buttons",
64
+ style: {
65
+ display: 'flex',
66
+ flexWrap: 'wrap',
67
+ gap: 4,
68
+ marginBottom: 6
69
+ }
70
+ }, _constants.frequentMaps.map(mapId => {
71
+ const idStr = String(mapId);
72
+ const isSelected = valueStrings.includes(idStr);
73
+ return _react.default.createElement("button", {
74
+ key: mapId,
75
+ type: "button",
76
+ onClick: () => this.toggleMap(mapId),
77
+ style: {
78
+ padding: '2px 8px',
79
+ fontSize: 12,
80
+ cursor: 'pointer',
81
+ background: isSelected ? '#137cbd' : '#f5f5f5',
82
+ color: isSelected ? '#fff' : '#333',
83
+ border: '1px solid',
84
+ borderColor: isSelected ? '#137cbd' : '#ccc',
85
+ borderRadius: 3
86
+ }
87
+ }, (0, _planHelpers.formatMapName)(idStr));
88
+ })), _react.default.createElement(_core.Popover, {
89
+ isOpen: this.state.isOpen,
90
+ onClose: () => this.setState({
91
+ isOpen: false,
92
+ searchQuery: ''
93
+ }),
94
+ popoverClassName: "map-selector-popover",
95
+ usePortal: false,
96
+ minimal: true,
97
+ content: this.renderPopoverContent()
98
+ }, _react.default.createElement("div", {
99
+ className: "map-selector-trigger",
100
+ onClick: () => this.setState({
101
+ isOpen: !this.state.isOpen
102
+ })
103
+ }, selectedMaps.length > 0 ? _react.default.createElement("div", {
104
+ className: "map-selector-trigger-tags"
105
+ }, selectedMaps.map(mapId => _react.default.createElement(_core.Tag, {
106
+ key: mapId,
107
+ onRemove: e => {
108
+ e.stopPropagation();
109
+ this.handleTagRemove(mapId);
88
110
  },
89
- popoverProps: {
90
- minimal: true,
91
- usePortal: false,
92
- isOpen: this.state.isOpen,
93
- onClose: () => this.setState({
94
- isOpen: false
95
- }),
96
- popoverClassName: 'map-selector-popover'
111
+ minimal: true
112
+ }, (0, _planHelpers.formatMapName)(mapId)))) : _react.default.createElement("span", {
113
+ className: "map-selector-trigger-placeholder"
114
+ }, __('Click to select maps')), _react.default.createElement(_core.Button, {
115
+ minimal: true,
116
+ icon: "double-caret-vertical",
117
+ style: {
118
+ minHeight: 24,
119
+ flexShrink: 0
97
120
  }
98
- })));
121
+ }))));
99
122
  }
100
123
 
101
124
  }
@@ -110,22 +133,15 @@ var _initialiseProps = function () {
110
133
  value = [],
111
134
  onChange
112
135
  } = this.props;
136
+ const mapIdStr = String(mapId);
113
137
 
114
- if (value.includes(mapId)) {
115
- onChange(value.filter(id => id !== mapId));
138
+ if (value.map(String).includes(mapIdStr)) {
139
+ onChange(value.filter(id => String(id) !== mapIdStr));
116
140
  } else {
117
- onChange([...value, mapId]);
141
+ onChange([...value, mapIdStr]);
118
142
  }
119
143
  }
120
144
  });
121
- Object.defineProperty(this, "handleItemSelect", {
122
- configurable: true,
123
- enumerable: true,
124
- writable: true,
125
- value: mapId => {
126
- this.toggleMap(mapId);
127
- }
128
- });
129
145
  Object.defineProperty(this, "handleTagRemove", {
130
146
  configurable: true,
131
147
  enumerable: true,
@@ -135,15 +151,18 @@ var _initialiseProps = function () {
135
151
  value = [],
136
152
  onChange
137
153
  } = this.props;
138
- onChange(value.filter(id => id !== mapId));
154
+ onChange(value.filter(id => String(id) !== String(mapId)));
139
155
  }
140
156
  });
141
- Object.defineProperty(this, "renderTag", {
157
+ Object.defineProperty(this, "closePopover", {
142
158
  configurable: true,
143
159
  enumerable: true,
144
160
  writable: true,
145
- value: mapId => {
146
- return (0, _planHelpers.formatMapName)(mapId);
161
+ value: () => {
162
+ this.setState({
163
+ isOpen: false,
164
+ searchQuery: ''
165
+ });
147
166
  }
148
167
  });
149
168
  Object.defineProperty(this, "renderPopoverContent", {
@@ -155,12 +174,45 @@ var _initialiseProps = function () {
155
174
  value = []
156
175
  } = this.props;
157
176
  const {
158
- activeWorld
177
+ activeWorld,
178
+ searchQuery
159
179
  } = this.state;
160
180
  const worlds = Object.keys(this.worldGroups).sort((a, b) => Number(a) - Number(b));
181
+ const valueStrings = value.map(String);
182
+ const filteredMaps = searchQuery ? Object.keys(_constants.EXP_BY_POI_DB).filter(id => (0, _planHelpers.formatMapName)(id).includes(searchQuery)) : null;
161
183
  return _react.default.createElement("div", {
162
184
  className: "map-selector-tabs"
163
- }, _react.default.createElement(_core.Tabs, {
185
+ }, _react.default.createElement("div", {
186
+ className: "map-selector-popover-header"
187
+ }, _react.default.createElement("span", {
188
+ className: "map-selector-popover-title"
189
+ }, __('Select maps')), _react.default.createElement("button", {
190
+ type: "button",
191
+ className: "bp5-button bp5-minimal bp5-small bp5-icon-cross",
192
+ onClick: this.closePopover
193
+ })), _react.default.createElement("div", {
194
+ className: "map-selector-popover-search"
195
+ }, _react.default.createElement(_core.InputGroup, {
196
+ leftIcon: "search",
197
+ placeholder: __('Search map'),
198
+ value: searchQuery,
199
+ onChange: e => this.setState({
200
+ searchQuery: e.target.value
201
+ })
202
+ })), filteredMaps ? _react.default.createElement("div", {
203
+ className: "map-selector-tab-panel"
204
+ }, filteredMaps.map(mapId => _react.default.createElement(_core.MenuItem, {
205
+ key: mapId,
206
+ text: (0, _planHelpers.formatMapName)(mapId),
207
+ icon: valueStrings.includes(mapId) ? 'tick' : 'blank',
208
+ onClick: () => this.toggleMap(mapId),
209
+ shouldDismissPopover: false
210
+ })), filteredMaps.length === 0 && _react.default.createElement("div", {
211
+ style: {
212
+ padding: 8,
213
+ color: '#888'
214
+ }
215
+ }, __('No results'))) : _react.default.createElement(_core.Tabs, {
164
216
  id: "map-world-tabs",
165
217
  selectedTabId: activeWorld,
166
218
  onChange: id => this.setState({
@@ -171,19 +223,16 @@ var _initialiseProps = function () {
171
223
  }, worlds.map(world => _react.default.createElement(_core.Tab, {
172
224
  key: world,
173
225
  id: world,
174
- title: `${world}`,
226
+ title: `${world} · ${_constants.WORLD_NAMES[world] || ''}`,
175
227
  panel: _react.default.createElement("div", {
176
228
  className: "map-selector-tab-panel"
177
- }, this.worldGroups[world].map(mapId => {
178
- const isSelected = value.includes(mapId);
179
- return _react.default.createElement(_core.MenuItem, {
180
- key: mapId,
181
- text: (0, _planHelpers.formatMapName)(mapId),
182
- icon: isSelected ? 'tick' : 'blank',
183
- onClick: () => this.toggleMap(mapId),
184
- shouldDismissPopover: false
185
- });
186
- }))
229
+ }, this.worldGroups[world].map(mapId => _react.default.createElement(_core.MenuItem, {
230
+ key: mapId,
231
+ text: (0, _planHelpers.formatMapName)(mapId),
232
+ icon: valueStrings.includes(mapId) ? 'tick' : 'blank',
233
+ onClick: () => this.toggleMap(mapId),
234
+ shouldDismissPopover: false
235
+ })))
187
236
  }))));
188
237
  }
189
238
  });
@@ -13,7 +13,7 @@ var _reselect = require("reselect");
13
13
 
14
14
  var _lodash = _interopRequireDefault(require("lodash"));
15
15
 
16
- var _shipSelector = _interopRequireDefault(require("./ship-selector"));
16
+ var _shipSelector = _interopRequireWildcard(require("./ship-selector"));
17
17
 
18
18
  var _mapSelector = _interopRequireDefault(require("./map-selector"));
19
19
 
@@ -29,7 +29,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
29
29
 
30
30
  const {
31
31
  __
32
- } = window.i18n['poi-plugin-leveling-plan']; // 计划表单组件
32
+ } = window.i18n['poi-plugin-leveling-plan'];
33
33
 
34
34
  class PlanForm extends _react.Component {
35
35
  constructor(props) {
@@ -40,8 +40,9 @@ class PlanForm extends _react.Component {
40
40
  const {
41
41
  editingPlan
42
42
  } = props;
43
+ const isFarming = props.planType === 'farming' || editingPlan && editingPlan.type === 'farming';
43
44
  this.state = {
44
- shipId: editingPlan ? editingPlan.shipId : '',
45
+ shipId: editingPlan ? isFarming ? editingPlan.shipMasterId : editingPlan.shipId : '',
45
46
  startLevel: editingPlan ? editingPlan.startLevel : "1",
46
47
  targetLevel: editingPlan ? editingPlan.targetLevel : '',
47
48
  maps: editingPlan ? editingPlan.maps : [],
@@ -55,7 +56,8 @@ class PlanForm extends _react.Component {
55
56
  show,
56
57
  onHide,
57
58
  editingPlan,
58
- ships
59
+ ships,
60
+ planType
59
61
  } = this.props;
60
62
  const {
61
63
  shipId,
@@ -64,27 +66,30 @@ class PlanForm extends _react.Component {
64
66
  maps,
65
67
  notes,
66
68
  errors
67
- } = this.state; // 获取当前选中的舰娘
68
-
69
+ } = this.state;
70
+ const isFarming = planType === 'farming' || editingPlan && editingPlan.type === 'farming';
69
71
  const selectedShip = shipId ? _lodash.default.find(ships, s => s.api_id === parseInt(shipId)) : null;
70
72
  const currentLevel = selectedShip ? selectedShip.api_lv : 0;
73
+ const title = isFarming ? editingPlan ? __('Edit Farming Plan') : __('Add Farming Plan') : editingPlan ? __('Edit Plan') : __('Add Plan');
71
74
  return _react.default.createElement(_reactBootstrap.Modal, {
72
75
  show: show,
73
76
  onHide: onHide,
74
77
  bsSize: "large"
75
78
  }, _react.default.createElement(_reactBootstrap.Modal.Header, {
76
79
  closeButton: true
77
- }, _react.default.createElement(_reactBootstrap.Modal.Title, null, editingPlan ? __('Edit Plan') : __('Add Plan'))), _react.default.createElement(_reactBootstrap.Modal.Body, null, errors.length > 0 && _react.default.createElement("div", {
80
+ }, _react.default.createElement(_reactBootstrap.Modal.Title, null, title)), _react.default.createElement(_reactBootstrap.Modal.Body, null, errors.length > 0 && _react.default.createElement("div", {
78
81
  className: "alert alert-danger"
79
82
  }, _react.default.createElement("ul", null, errors.map((error, index) => _react.default.createElement("li", {
80
83
  key: index
81
- }, error)))), _react.default.createElement(_reactBootstrap.FormGroup, null, _react.default.createElement(_reactBootstrap.ControlLabel, null, __('Ship')), _react.default.createElement(_shipSelector.default, {
84
+ }, error)))), _react.default.createElement(_reactBootstrap.FormGroup, null, _react.default.createElement(_reactBootstrap.ControlLabel, null, isFarming ? __('Ship Type') : __('Ship')), isFarming ? _react.default.createElement(_shipSelector.MasterShipSelector, {
82
85
  value: shipId,
83
- onChange: this.handleShipChange //disabled={!!editingPlan}
84
-
85
- }), editingPlan && _react.default.createElement("p", {
86
+ onChange: this.handleShipChange
87
+ }) : _react.default.createElement(_shipSelector.default, {
88
+ value: shipId,
89
+ onChange: this.handleShipChange
90
+ }), editingPlan && !isFarming && _react.default.createElement("p", {
86
91
  className: "help-block"
87
- }, __('Cannot change ship in existing plan'))), _react.default.createElement(_reactBootstrap.FormGroup, null, _react.default.createElement(_reactBootstrap.ControlLabel, null, __('Start Level')), _react.default.createElement(_reactBootstrap.FormControl, {
92
+ }, __('Cannot change ship in existing plan'))), !isFarming && _react.default.createElement(_reactBootstrap.FormGroup, null, _react.default.createElement(_reactBootstrap.ControlLabel, null, __('Start Level')), _react.default.createElement(_reactBootstrap.FormControl, {
88
93
  type: "number",
89
94
  value: startLevel,
90
95
  onChange: this.handleStarttLevelChange,
@@ -98,10 +103,11 @@ class PlanForm extends _react.Component {
98
103
  min: currentLevel + 1,
99
104
  max: 185,
100
105
  placeholder: __('Enter target level')
101
- }), selectedShip && $ships && (() => {
102
- const shipMasterId = selectedShip.api_ship_id;
106
+ }), (() => {
107
+ const shipMasterId = isFarming ? parseInt(shipId) : selectedShip ? selectedShip.api_ship_id : null;
108
+ if (!shipMasterId || !$ships) return null;
103
109
  const remodelLevels = (0, _kaisouCost.getRemodelLevelsForShip)(shipMasterId, $ships);
104
- const startLv = parseInt(startLevel) || 0;
110
+ const startLv = isFarming ? 0 : parseInt(startLevel) || 0;
105
111
  const filteredLevels = remodelLevels.filter(lv => lv > startLv);
106
112
  if (filteredLevels.length === 0) return null;
107
113
  return _react.default.createElement("div", {
@@ -126,7 +132,7 @@ class PlanForm extends _react.Component {
126
132
  fontSize: 12
127
133
  }
128
134
  }, "lv", lv)));
129
- })(), selectedShip && _react.default.createElement("p", {
135
+ })(), selectedShip && !isFarming && _react.default.createElement("p", {
130
136
  className: "help-block"
131
137
  }, __('Current level'), ": ", currentLevel)), _react.default.createElement(_reactBootstrap.FormGroup, null, _react.default.createElement(_reactBootstrap.ControlLabel, null, __('Maps')), _react.default.createElement(_mapSelector.default, {
132
138
  value: maps,
@@ -145,8 +151,7 @@ class PlanForm extends _react.Component {
145
151
  }, __('Save'))));
146
152
  }
147
153
 
148
- } // Redux 连接
149
-
154
+ }
150
155
 
151
156
  var _initialiseProps = function () {
152
157
  Object.defineProperty(this, "handleShipChange", {
@@ -158,11 +163,19 @@ var _initialiseProps = function () {
158
163
  shipId
159
164
  });
160
165
  const {
166
+ planType,
167
+ editingPlan,
161
168
  ships
162
169
  } = this.props;
163
- this.setState({
164
- startLevel: shipId ? _lodash.default.find(ships, s => s.api_id === parseInt(shipId)).api_lv : "1"
165
- });
170
+ const isFarming = planType === 'farming' || editingPlan && editingPlan.type === 'farming';
171
+
172
+ if (!isFarming && shipId) {
173
+ const found = _lodash.default.find(ships, s => s.api_id === parseInt(shipId));
174
+
175
+ this.setState({
176
+ startLevel: found ? found.api_lv : "1"
177
+ });
178
+ }
166
179
  }
167
180
  });
168
181
  Object.defineProperty(this, "handleTargetLevelChange", {
@@ -223,8 +236,46 @@ var _initialiseProps = function () {
223
236
  editingPlan,
224
237
  ships,
225
238
  $ships,
226
- onSave
227
- } = this.props; // 查找舰娘数据
239
+ onSave,
240
+ planType
241
+ } = this.props;
242
+ const isFarming = planType === 'farming' || editingPlan && editingPlan.type === 'farming';
243
+
244
+ if (isFarming) {
245
+ const masterShipId = parseInt(shipId);
246
+ const $ship = $ships[masterShipId];
247
+
248
+ if (!$ship) {
249
+ this.setState({
250
+ errors: ['Ship master data not found']
251
+ });
252
+ return;
253
+ }
254
+
255
+ let plan;
256
+
257
+ if (editingPlan) {
258
+ plan = (0, _planHelpers.updatePlan)(editingPlan, {
259
+ targetLevel: parseInt(targetLevel),
260
+ maps,
261
+ notes
262
+ });
263
+ } else {
264
+ plan = (0, _planHelpers.createPlan)(null, masterShipId, null, parseInt(targetLevel), maps, notes, 'farming');
265
+ }
266
+
267
+ const validation = (0, _planHelpers.validatePlan)(plan);
268
+
269
+ if (!validation.valid) {
270
+ this.setState({
271
+ errors: validation.errors
272
+ });
273
+ return;
274
+ }
275
+
276
+ onSave(plan);
277
+ return;
278
+ }
228
279
 
229
280
  const ship = _lodash.default.find(ships, s => s.api_id === parseInt(shipId));
230
281
 
@@ -242,13 +293,11 @@ var _initialiseProps = function () {
242
293
  errors: ['Ship master data not found']
243
294
  });
244
295
  return;
245
- } // 构建计划对象
246
-
296
+ }
247
297
 
248
298
  let plan;
249
299
 
250
300
  if (editingPlan) {
251
- // 更新现有计划
252
301
  plan = (0, _planHelpers.updatePlan)(editingPlan, {
253
302
  targetLevel: parseInt(targetLevel),
254
303
  startLevel: parseInt(startLevel),
@@ -256,10 +305,8 @@ var _initialiseProps = function () {
256
305
  notes
257
306
  });
258
307
  } else {
259
- // 创建新计划
260
- plan = (0, _planHelpers.createPlan)(ship.api_id, ship.api_ship_id, parseInt(startLevel), parseInt(targetLevel), maps, notes);
261
- } // 验证计划
262
-
308
+ plan = (0, _planHelpers.createPlan)(ship.api_id, ship.api_ship_id, parseInt(startLevel), parseInt(targetLevel), maps, notes, 'normal');
309
+ }
263
310
 
264
311
  const validation = (0, _planHelpers.validatePlan)(plan, ship);
265
312
  console.log(plan);
@@ -269,8 +316,7 @@ var _initialiseProps = function () {
269
316
  errors: validation.errors
270
317
  });
271
318
  return;
272
- } // 保存计划
273
-
319
+ }
274
320
 
275
321
  onSave(plan);
276
322
  }
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = exports.PlanItem = void 0;
4
+ exports.default = exports.FarmingPlanItem = exports.PlanItem = void 0;
5
5
 
6
6
  var _react = _interopRequireDefault(require("react"));
7
7
 
8
8
  var _reactBootstrap = require("react-bootstrap");
9
9
 
10
+ var _core = require("@blueprintjs/core");
11
+
10
12
  var _icon = require("views/components/etc/icon");
11
13
 
12
14
  var _useitemIcon = require("./useitem-icon");
@@ -197,5 +199,162 @@ const PlanItem = ({
197
199
  };
198
200
 
199
201
  exports.PlanItem = PlanItem;
202
+ const FARMING_COL_STYLE = {
203
+ lv: {
204
+ width: 40,
205
+ textAlign: 'right',
206
+ paddingRight: 8,
207
+ flexShrink: 0
208
+ },
209
+ progress: {
210
+ flex: 1,
211
+ minWidth: 80,
212
+ paddingRight: 8
213
+ },
214
+ pct: {
215
+ width: 56,
216
+ textAlign: 'right',
217
+ paddingRight: 12,
218
+ flexShrink: 0,
219
+ fontSize: '0.85em'
220
+ },
221
+ exp: {
222
+ width: 64,
223
+ textAlign: 'right',
224
+ paddingRight: 12,
225
+ flexShrink: 0,
226
+ fontSize: '0.85em'
227
+ },
228
+ maps: {
229
+ width: 200,
230
+ flexShrink: 0
231
+ }
232
+ };
233
+
234
+ const FarmingInstanceRow = ({
235
+ inst
236
+ }) => _react.default.createElement("div", {
237
+ className: "farming-instance-row",
238
+ style: {
239
+ display: 'flex',
240
+ alignItems: 'center',
241
+ padding: '4px 0',
242
+ fontSize: '0.9em'
243
+ }
244
+ }, _react.default.createElement("span", {
245
+ style: FARMING_COL_STYLE.lv
246
+ }, "Lv.", inst.currentLv), _react.default.createElement("div", {
247
+ style: FARMING_COL_STYLE.progress
248
+ }, _react.default.createElement(_reactBootstrap.ProgressBar, {
249
+ now: inst.progress,
250
+ style: {
251
+ marginBottom: 0,
252
+ height: 12
253
+ }
254
+ })), _react.default.createElement("span", {
255
+ style: FARMING_COL_STYLE.pct
256
+ }, inst.progress.toFixed(1), "%"), _react.default.createElement("span", {
257
+ style: FARMING_COL_STYLE.exp
258
+ }, inst.requiredExp.toLocaleString()), _react.default.createElement("div", {
259
+ style: FARMING_COL_STYLE.maps
260
+ }, (inst.mapDetails || []).map(map => _react.default.createElement(_core.Tag, {
261
+ key: map.mapId,
262
+ minimal: true,
263
+ style: {
264
+ marginRight: 4,
265
+ marginBottom: 2
266
+ }
267
+ }, map.mapName, " \xD7", map.sortiesNeeded.toLocaleString()))));
268
+
269
+ const FarmingHeaderRow = () => _react.default.createElement("div", {
270
+ className: "farming-instance-row farming-header-row",
271
+ style: {
272
+ display: 'flex',
273
+ alignItems: 'center',
274
+ padding: '2px 0 6px',
275
+ fontSize: '0.8em',
276
+ opacity: 0.55,
277
+ borderBottom: '1px solid rgba(128,128,128,0.2)',
278
+ marginBottom: 2
279
+ }
280
+ }, _react.default.createElement("span", {
281
+ style: FARMING_COL_STYLE.lv
282
+ }, "Lv"), _react.default.createElement("div", {
283
+ style: FARMING_COL_STYLE.progress
284
+ }), _react.default.createElement("span", {
285
+ style: FARMING_COL_STYLE.pct
286
+ }, "%"), _react.default.createElement("span", {
287
+ style: FARMING_COL_STYLE.exp
288
+ }, __('EXP')), _react.default.createElement("div", {
289
+ style: FARMING_COL_STYLE.maps
290
+ }, __('Maps')));
291
+
292
+ const FarmingDivider = () => _react.default.createElement("div", {
293
+ className: "farming-divider"
294
+ }); // 养殖计划卡片组件
295
+
296
+
297
+ const FarmingPlanItem = ({
298
+ planDetail,
299
+ onEdit,
300
+ onDelete
301
+ }) => {
302
+ if (!planDetail || planDetail.type !== 'farming') return null;
303
+ const {
304
+ shipName,
305
+ targetLv,
306
+ instances,
307
+ totalInstancesBelowTarget,
308
+ notes
309
+ } = planDetail;
310
+ return _react.default.createElement(_reactBootstrap.Panel, {
311
+ className: "plan-item farming-plan-item"
312
+ }, _react.default.createElement(_reactBootstrap.Panel.Heading, null, _react.default.createElement("div", {
313
+ className: "plan-item-header"
314
+ }, _react.default.createElement("div", {
315
+ className: "plan-item-title"
316
+ }, _react.default.createElement("span", {
317
+ className: "ship-name"
318
+ }, shipName), _react.default.createElement("span", {
319
+ className: "level-info"
320
+ }, " \u2192 Lv.", targetLv), _react.default.createElement("span", {
321
+ style: {
322
+ marginLeft: 12,
323
+ fontSize: '0.9em',
324
+ opacity: 0.7
325
+ }
326
+ }, __('Below target'), ": ", totalInstancesBelowTarget, " ", __('ships'))), _react.default.createElement("div", {
327
+ className: "plan-item-actions"
328
+ }, _react.default.createElement(_reactBootstrap.Button, {
329
+ bsSize: "xsmall",
330
+ onClick: onEdit
331
+ }, __('Edit')), _react.default.createElement(_reactBootstrap.Button, {
332
+ bsSize: "xsmall",
333
+ bsStyle: "danger",
334
+ onClick: onDelete
335
+ }, __('Delete'))))), _react.default.createElement(_reactBootstrap.Panel.Body, null, instances.length === 0 ? _react.default.createElement("div", {
336
+ className: "empty-message",
337
+ style: {
338
+ fontStyle: 'italic',
339
+ opacity: 0.7
340
+ }
341
+ }, __('All ships have reached the target level')) : _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(FarmingHeaderRow, null), instances.map((inst, i) => _react.default.createElement(_react.default.Fragment, {
342
+ key: inst.shipId
343
+ }, i > 0 && _react.default.createElement(FarmingDivider, null), _react.default.createElement(FarmingInstanceRow, {
344
+ inst: inst
345
+ })))), notes && _react.default.createElement("div", {
346
+ className: "notes-section",
347
+ style: {
348
+ marginTop: 8,
349
+ fontSize: '0.9em'
350
+ }
351
+ }, _react.default.createElement("span", {
352
+ style: {
353
+ opacity: 0.6
354
+ }
355
+ }, __('Notes'), ": "), notes)));
356
+ };
357
+
358
+ exports.FarmingPlanItem = FarmingPlanItem;
200
359
  var _default = PlanItem;
201
360
  exports.default = _default;