smol work

This commit is contained in:
Willyb321
2018-12-13 08:50:18 +11:00
parent 59cf9c9b55
commit 29a699426a
3 changed files with 877 additions and 155 deletions

936
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Factory, Ship, Module } from 'ed-forge'; import { Factory, Ship, Module } from 'ed-forge';
import {FORGE_SHIPS} from '../utils/Constants';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import cn from 'classnames'; import cn from 'classnames';
@@ -34,47 +36,6 @@ function shipSummary(shipId) {
// Build Ship // Build Ship
return summary; return summary;
} }
const FORGE_SHIPS = ['Adder',
'Anaconda',
'Asp',
'Asp_Scout',
'BelugaLiner',
'CobraMkIII',
'CobraMkIV',
'Cutter',
'DiamondBackXL',
'DiamondBack',
'Dolphin',
'Eagle',
'Empire_Courier',
'Empire_Eagle',
'Empire_Trader',
'Federation_Corvette',
'Federation_Dropship',
'Federation_Dropship_MkII',
'Federation_Gunship',
'FerDeLance',
'Hauler',
'Independant_Trader',
'Krait_MkII',
'Mamba',
'Krait_Light',
'Orca',
'Python',
'SideWinder',
'Type6',
'Type7',
'Type9',
'Type9_Military',
'TypeX',
'TypeX_2',
'TypeX_3',
'Viper',
'Viper_MkIV',
'Vulture'];
class ShipTable extends Component { class ShipTable extends Component {
static cachedSummaries = null; static cachedSummaries = null;
@@ -89,8 +50,11 @@ class ShipTable extends Component {
this.state = { this.state = {
shipRows: [], shipRows: [],
detailRows: [] detailRows: []
}; };
this._genShipRows(); }
componentWillMount() {
this._genShipRows();
} }
_genShipRows() { _genShipRows() {
@@ -107,15 +71,17 @@ class ShipTable extends Component {
})} })}
> >
<td className="le"> <td className="le">
<Link to={'/outfit/' + shipName}>{ship.getShipName()}</Link> <Link to={'/outfit/' + shipName}>{shipName}</Link>
</td> </td>
</tr>); </tr>);
this.setState({shipRows})
} }
} }
_highlightShip() {} _highlightShip() {}
render() { render() {
return ( return (
<div> <div>
<div <div

40
src/utils/Constants.js Normal file
View File

@@ -0,0 +1,40 @@
export const FORGE_SHIPS = [
"Adder",
"Anaconda",
"Asp",
"Asp_Scout",
"BelugaLiner",
"CobraMkIII",
"CobraMkIV",
"Cutter",
"DiamondBackXL",
"DiamondBack",
"Dolphin",
"Eagle",
"Empire_Courier",
"Empire_Eagle",
"Empire_Trader",
"Federation_Corvette",
"Federation_Dropship",
"Federation_Dropship_MkII",
"Federation_Gunship",
"FerDeLance",
"Hauler",
"Independant_Trader",
"Krait_MkII",
"Mamba",
"Krait_Light",
"Orca",
"Python",
"SideWinder",
"Type6",
"Type7",
"Type9",
"Type9_Military",
"TypeX",
"TypeX_2",
"TypeX_3",
"Viper",
"Viper_MkIV",
"Vulture"
];