mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Compare commits
2 Commits
jenkins
...
feature/wa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
beb19a07ec | ||
|
|
98113e8807 |
27
.babelrc
27
.babelrc
@@ -1,19 +1,29 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
["@babel/preset-env", {"modules": "commonjs"}],
|
[
|
||||||
|
"@babel/preset-env",
|
||||||
|
{
|
||||||
|
"modules": "commonjs"
|
||||||
|
}
|
||||||
|
],
|
||||||
"@babel/preset-react"
|
"@babel/preset-react"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/plugin-syntax-dynamic-import",
|
|
||||||
"@babel/plugin-syntax-import-meta",
|
|
||||||
["@babel/plugin-proposal-class-properties", { "loose": true }],
|
|
||||||
"@babel/plugin-proposal-json-strings",
|
|
||||||
[
|
[
|
||||||
"@babel/plugin-proposal-decorators",
|
"@babel/plugin-proposal-decorators",
|
||||||
{
|
{
|
||||||
"legacy": true
|
"legacy": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"@babel/plugin-syntax-dynamic-import",
|
||||||
|
"@babel/plugin-syntax-import-meta",
|
||||||
|
[
|
||||||
|
"@babel/plugin-proposal-class-properties",
|
||||||
|
{
|
||||||
|
"loose": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@babel/plugin-proposal-json-strings",
|
||||||
"@babel/plugin-proposal-function-sent",
|
"@babel/plugin-proposal-function-sent",
|
||||||
"@babel/plugin-proposal-export-namespace-from",
|
"@babel/plugin-proposal-export-namespace-from",
|
||||||
"@babel/plugin-proposal-numeric-separator",
|
"@babel/plugin-proposal-numeric-separator",
|
||||||
@@ -27,6 +37,13 @@
|
|||||||
"proposal": "minimal"
|
"proposal": "minimal"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"@babel/plugin-transform-runtime",
|
||||||
|
{
|
||||||
|
"helpers": true,
|
||||||
|
"regenerator": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
"@babel/plugin-proposal-do-expressions",
|
"@babel/plugin-proposal-do-expressions",
|
||||||
"@babel/plugin-proposal-function-bind"
|
"@babel/plugin-proposal-function-bind"
|
||||||
|
|||||||
@@ -29,20 +29,6 @@ services:
|
|||||||
- "traefik.basic.port=80"
|
- "traefik.basic.port=80"
|
||||||
- "traefik.basic.protocol=http"
|
- "traefik.basic.protocol=http"
|
||||||
|
|
||||||
coriolis_dw2:
|
|
||||||
image: edcd/coriolis:dw2
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
|
||||||
networks:
|
|
||||||
- web
|
|
||||||
labels:
|
|
||||||
- "traefik.docker.network=web"
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.basic.frontend.rule=Host:dw2.coriolis.io"
|
|
||||||
- "traefik.basic.port=80"
|
|
||||||
- "traefik.basic.protocol=http"
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
web:
|
web:
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@@ -1,23 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
stages {
|
|
||||||
stage('Get coriolis-data') {
|
|
||||||
steps {
|
|
||||||
sh '''YES=`echo $GIT_BRANCH | awk -F / \'{print $2}\'`
|
|
||||||
export BRANCH=`git rev-parse --abbrev-ref $YES`
|
|
||||||
rm -rf $WORKSPACE/../coriolis-data
|
|
||||||
git clone https://github.com/edcd/coriolis-data.git $WORKSPACE/../coriolis-data
|
|
||||||
cd ../coriolis-data
|
|
||||||
git fetch --all
|
|
||||||
git checkout $BRANCH'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
sshagent (credentials: ['63c9de04-3213-47c3-8345-2f3442097a5b']) {
|
|
||||||
sh 'ssh -p 56499 -o StrictHostKeyChecking=no willb@172.17.0.1 echo hi'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -54,8 +54,6 @@ http {
|
|||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html =404;
|
try_files $uri $uri/ /index.html =404;
|
||||||
}
|
}
|
||||||
location /iframe.html {
|
|
||||||
try_files $uri $uri/ /iframe.html =404;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
package.json
16
package.json
@@ -56,8 +56,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
"@babel/plugin-proposal-class-properties": "^7.1.0",
|
||||||
"@babel/plugin-proposal-decorators": "^7.0.0",
|
"@babel/plugin-proposal-decorators": "^7.1.2",
|
||||||
"@babel/plugin-proposal-do-expressions": "^7.0.0",
|
"@babel/plugin-proposal-do-expressions": "^7.0.0",
|
||||||
"@babel/plugin-proposal-export-default-from": "^7.0.0",
|
"@babel/plugin-proposal-export-default-from": "^7.0.0",
|
||||||
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
|
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
|
||||||
@@ -72,12 +72,12 @@
|
|||||||
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
|
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||||
"@babel/plugin-syntax-import-meta": "^7.0.0",
|
"@babel/plugin-syntax-import-meta": "^7.0.0",
|
||||||
|
"@babel/plugin-transform-runtime": "^7.1.0",
|
||||||
"@babel/preset-env": "^7.0.0",
|
"@babel/preset-env": "^7.0.0",
|
||||||
"@babel/preset-react": "^7.0.0",
|
"@babel/preset-react": "^7.0.0",
|
||||||
"appcache-webpack-plugin": "^1.4.0",
|
"appcache-webpack-plugin": "^1.4.0",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-jest": "^23.6.0",
|
"babel-jest": "^23.4.2",
|
||||||
"babel-loader": "^8.0.0",
|
"babel-loader": "^8.0.0",
|
||||||
"copy-webpack-plugin": "^4.5.2",
|
"copy-webpack-plugin": "^4.5.2",
|
||||||
"create-react-class": "^15.6.3",
|
"create-react-class": "^15.6.3",
|
||||||
@@ -118,10 +118,14 @@
|
|||||||
"webpack-cli": "^3.1.1",
|
"webpack-cli": "^3.1.1",
|
||||||
"webpack-dev-server": "^3.1.9",
|
"webpack-dev-server": "^3.1.9",
|
||||||
"webpack-notifier": "^1.6.0",
|
"webpack-notifier": "^1.6.0",
|
||||||
"workbox-webpack-plugin": "^3.6.1"
|
"workbox-webpack-plugin": "^3.6.1",
|
||||||
|
"worker-loader": "^2.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/polyfill": "^7.0.0",
|
"@babel/polyfill": "^7.0.0",
|
||||||
|
"@babel/runtime": "^7.1.2",
|
||||||
|
"@nozbe/watermelondb": "^0.6.2",
|
||||||
|
"babel-runtime": "^6.26.0",
|
||||||
"browserify-zlib-next": "^1.0.1",
|
"browserify-zlib-next": "^1.0.1",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"coriolis-data": "../coriolis-data",
|
"coriolis-data": "../coriolis-data",
|
||||||
@@ -129,13 +133,13 @@
|
|||||||
"detect-browser": "^3.0.1",
|
"detect-browser": "^3.0.1",
|
||||||
"fbemitter": "^2.1.1",
|
"fbemitter": "^2.1.1",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.11",
|
||||||
|
"lokijs": "^1.5.5",
|
||||||
"lz-string": "^1.4.4",
|
"lz-string": "^1.4.4",
|
||||||
"pako": "^1.0.6",
|
"pako": "^1.0.6",
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^15.5.4",
|
"react": "^15.5.4",
|
||||||
"react-dom": "^15.5.4",
|
"react-dom": "^15.5.4",
|
||||||
"react-extras": "^0.7.1",
|
"react-extras": "^0.7.1",
|
||||||
"react-fuzzy": "^0.5.2",
|
|
||||||
"react-ga": "^2.5.3",
|
"react-ga": "^2.5.3",
|
||||||
"react-number-editor": "Athanasius/react-number-editor.git#miggy",
|
"react-number-editor": "Athanasius/react-number-editor.git#miggy",
|
||||||
"recharts": "^1.2.0",
|
"recharts": "^1.2.0",
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { EventEmitter } from 'fbemitter';
|
|||||||
import { getLanguage } from './i18n/Language';
|
import { getLanguage } from './i18n/Language';
|
||||||
import Persist from './stores/Persist';
|
import Persist from './stores/Persist';
|
||||||
|
|
||||||
import Announcement from './components/Announcement';
|
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
import Tooltip from './components/Tooltip';
|
import Tooltip from './components/Tooltip';
|
||||||
import ModalExport from './components/ModalExport';
|
import ModalExport from './components/ModalExport';
|
||||||
@@ -15,6 +14,7 @@ import ModalImport from './components/ModalImport';
|
|||||||
import ModalPermalink from './components/ModalPermalink';
|
import ModalPermalink from './components/ModalPermalink';
|
||||||
import * as CompanionApiUtils from './utils/CompanionApiUtils';
|
import * as CompanionApiUtils from './utils/CompanionApiUtils';
|
||||||
import * as JournalUtils from './utils/JournalUtils';
|
import * as JournalUtils from './utils/JournalUtils';
|
||||||
|
|
||||||
import AboutPage from './pages/AboutPage';
|
import AboutPage from './pages/AboutPage';
|
||||||
import NotFoundPage from './pages/NotFoundPage';
|
import NotFoundPage from './pages/NotFoundPage';
|
||||||
import OutfittingPage from './pages/OutfittingPage';
|
import OutfittingPage from './pages/OutfittingPage';
|
||||||
@@ -395,10 +395,9 @@ export default class Coriolis extends React.Component {
|
|||||||
|
|
||||||
return <div style={{ minHeight: '100%' }} onClick={this._closeMenu}
|
return <div style={{ minHeight: '100%' }} onClick={this._closeMenu}
|
||||||
className={this.state.noTouch ? 'no-touch' : null}>
|
className={this.state.noTouch ? 'no-touch' : null}>
|
||||||
<Header announcements={this.state.announcements} appCacheUpdate={this.state.appCacheUpdate} currentMenu={currentMenu} />
|
<Header announcements={this.state.announcements} appCacheUpdate={this.state.appCacheUpdate} currentMenu={currentMenu}/>
|
||||||
<div className="announcement-container">{this.state.announcements.map(a => <Announcement text={a.message}/>)}</div>
|
|
||||||
{this.state.error ? this.state.error : this.state.page ? React.createElement(this.state.page, { currentMenu }) :
|
{this.state.error ? this.state.error : this.state.page ? React.createElement(this.state.page, { currentMenu }) :
|
||||||
<NotFoundPage />}
|
<NotFoundPage/>}
|
||||||
{this.state.modal}
|
{this.state.modal}
|
||||||
{this.state.tooltip}
|
{this.state.tooltip}
|
||||||
<footer>
|
<footer>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import Persist from './stores/Persist';
|
import Persist from './stores/Persist';
|
||||||
import ReactGA from 'react-ga';
|
import ReactGA from 'react-ga';
|
||||||
|
|
||||||
ReactGA.initialize('UA-55840909-18');
|
ReactGA.initialize('UA-55840909-18');
|
||||||
let standalone = undefined;
|
let standalone = undefined;
|
||||||
|
|
||||||
|
|||||||
34
src/app/components/Ad.jsx
Normal file
34
src/app/components/Ad.jsx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
|
||||||
|
export default class Ad extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
client: PropTypes.string,
|
||||||
|
slot: PropTypes.string,
|
||||||
|
format: PropTypes.string,
|
||||||
|
wrapperDivStyle: PropTypes.object
|
||||||
|
};
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
// This code is ran when the component mounts
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// an outer div for styling purposes
|
||||||
|
// changed class to ClassName
|
||||||
|
// changed style from string to an object
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div style={this.props.wrapperDivStyle}>
|
||||||
|
<ins
|
||||||
|
className="adsbygoogle"
|
||||||
|
style={{ display: 'block' }}
|
||||||
|
data-ad-client={this.props.client}
|
||||||
|
data-ad-slot={this.props.slot}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ export default class Announcement extends React.Component {
|
|||||||
* @return {React.Component} A href element
|
* @return {React.Component} A href element
|
||||||
*/
|
*/
|
||||||
render() {
|
render() {
|
||||||
return <div className="announcement" >{this.props.text}</div>;
|
return <p>{this.props.text}</p>;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import TranslatedComponent from './TranslatedComponent';
|
|||||||
import { stopCtxPropagation } from '../utils/UtilityFunctions';
|
import { stopCtxPropagation } from '../utils/UtilityFunctions';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
import { MountFixed, MountGimballed, MountTurret } from './SvgIcons';
|
import { MountFixed, MountGimballed, MountTurret } from './SvgIcons';
|
||||||
import FuzzySearch from 'react-fuzzy';
|
|
||||||
|
|
||||||
const PRESS_THRESHOLD = 500; // mouse/touch down threshold
|
const PRESS_THRESHOLD = 500; // mouse/touch down threshold
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ const GRPCAT = {
|
|||||||
'mc': 'projectiles',
|
'mc': 'projectiles',
|
||||||
'axmc': 'experimental',
|
'axmc': 'experimental',
|
||||||
'fc': 'projectiles',
|
'fc': 'projectiles',
|
||||||
'rfl': 'experimental',
|
'rfl': 'experimental',
|
||||||
'pa': 'projectiles',
|
'pa': 'projectiles',
|
||||||
'rg': 'projectiles',
|
'rg': 'projectiles',
|
||||||
'mr': 'ordnance',
|
'mr': 'ordnance',
|
||||||
@@ -134,7 +133,6 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props);
|
super(props);
|
||||||
this._hideDiff = this._hideDiff.bind(this);
|
this._hideDiff = this._hideDiff.bind(this);
|
||||||
this._showSearch = this._showSearch.bind(this);
|
|
||||||
this.state = this._initState(props, context);
|
this.state = this._initState(props, context);
|
||||||
this.slotItems = [];// Array to hold <li> refs.
|
this.slotItems = [];// Array to hold <li> refs.
|
||||||
}
|
}
|
||||||
@@ -161,7 +159,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
onSelect(m);
|
onSelect(m);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
let fuzzy = [];
|
|
||||||
if (modules instanceof Array) {
|
if (modules instanceof Array) {
|
||||||
list = buildGroup(modules[0].grp, modules);
|
list = buildGroup(modules[0].grp, modules);
|
||||||
} else {
|
} else {
|
||||||
@@ -169,11 +167,9 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
// At present time slots with grouped options (Hardpoints and Internal) can be empty
|
// At present time slots with grouped options (Hardpoints and Internal) can be empty
|
||||||
if (m) {
|
if (m) {
|
||||||
let emptyId = 'empty';
|
let emptyId = 'empty';
|
||||||
if (this.firstSlotId == null) this.firstSlotId = emptyId;
|
if(this.firstSlotId == null) this.firstSlotId = emptyId;
|
||||||
let keyDown = this._keyDown.bind(this, onSelect);
|
let keyDown = this._keyDown.bind(this, onSelect);
|
||||||
list.push(<div className='empty-c upp' key={emptyId} data-id={emptyId} onClick={onSelect.bind(null, null)}
|
list.push(<div className='empty-c upp' key={emptyId} data-id={emptyId} onClick={onSelect.bind(null, null)} onKeyDown={keyDown} tabIndex="0" ref={slotItem => this.slotItems[emptyId] = slotItem} >{translate('empty')}</div>);
|
||||||
onKeyDown={keyDown} tabIndex="0"
|
|
||||||
ref={slotItem => this.slotItems[emptyId] = slotItem}>{translate('empty')}</div>);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to regroup the modules by our own categorisation
|
// Need to regroup the modules by our own categorisation
|
||||||
@@ -201,8 +197,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
if (categories.length === 1) {
|
if (categories.length === 1) {
|
||||||
// Show category header instead of group header
|
// Show category header instead of group header
|
||||||
if (m && grp == m.grp) {
|
if (m && grp == m.grp) {
|
||||||
list.push(<div ref={(elem) => this.groupElem = elem} key={category}
|
list.push(<div ref={(elem) => this.groupElem = elem} key={category} className={'select-category upp'}>{translate(category)}</div>);
|
||||||
className={'select-category upp'}>{translate(category)}</div>);
|
|
||||||
} else {
|
} else {
|
||||||
list.push(<div key={category} className={'select-category upp'}>{translate(category)}</div>);
|
list.push(<div key={category} className={'select-category upp'}>{translate(category)}</div>);
|
||||||
}
|
}
|
||||||
@@ -213,23 +208,19 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
categoryHeader = true;
|
categoryHeader = true;
|
||||||
}
|
}
|
||||||
if (m && grp == m.grp) {
|
if (m && grp == m.grp) {
|
||||||
list.push(<div ref={(elem) => this.groupElem = elem} key={grp}
|
list.push(<div ref={(elem) => this.groupElem = elem} key={grp} className={'select-group cap'}>{translate(grp)}</div>);
|
||||||
className={'select-group cap'}>{translate(grp)}</div>);
|
|
||||||
} else {
|
} else {
|
||||||
list.push(<div key={grp} className={'select-group cap'}>{translate(grp)}</div>);
|
list.push(<div key={grp} className={'select-group cap'}>{translate(grp)}</div>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.push(buildGroup(grp, modules[grp]));
|
list.push(buildGroup(grp, modules[grp]));
|
||||||
for (const i of modules[grp]) {
|
|
||||||
fuzzy.push({ grp, m: i, name: `${i.class}${i.rating} ${translate(grp)} ${i.mount ? i.mount : ''}` });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let trackingFocus = false;
|
let trackingFocus = false;
|
||||||
return { list, currentGroup, fuzzy, trackingFocus };
|
return { list, currentGroup, trackingFocus };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,11 +242,9 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
|
|
||||||
const sortedModules = modules.sort(this._moduleOrder);
|
const sortedModules = modules.sort(this._moduleOrder);
|
||||||
|
|
||||||
|
|
||||||
// Calculate the number of items per class. Used so we don't have long lists with only a few items in each row
|
// Calculate the number of items per class. Used so we don't have long lists with only a few items in each row
|
||||||
const tmp = sortedModules.map((v, i) => v['class']).reduce((count, cls) => {
|
const tmp = sortedModules.map((v, i) => v['class']).reduce((count, cls) => { count[cls] = ++count[cls] || 1; return count; }, {});
|
||||||
count[cls] = ++count[cls] || 1;
|
|
||||||
return count;
|
|
||||||
}, {});
|
|
||||||
const itemsPerClass = Math.max.apply(null, Object.keys(tmp).map(key => tmp[key]));
|
const itemsPerClass = Math.max.apply(null, Object.keys(tmp).map(key => tmp[key]));
|
||||||
|
|
||||||
let itemsOnThisRow = 0;
|
let itemsOnThisRow = 0;
|
||||||
@@ -308,29 +297,22 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m.mount) {
|
switch(m.mount) {
|
||||||
case 'F':
|
case 'F': mount = <MountFixed className={'lg'} />; break;
|
||||||
mount = <MountFixed className={'lg'}/>;
|
case 'G': mount = <MountGimballed className={'lg'}/>; break;
|
||||||
break;
|
case 'T': mount = <MountTurret className={'lg'}/>; break;
|
||||||
case 'G':
|
|
||||||
mount = <MountGimballed className={'lg'}/>;
|
|
||||||
break;
|
|
||||||
case 'T':
|
|
||||||
mount = <MountTurret className={'lg'}/>;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (m.name && m.name === prevName) {
|
if (m.name && m.name === prevName) {
|
||||||
// elems.push(<br key={'b' + m.grp + i} />);
|
// elems.push(<br key={'b' + m.grp + i} />);
|
||||||
itemsOnThisRow = 0;
|
itemsOnThisRow = 0;
|
||||||
}
|
}
|
||||||
if (itemsOnThisRow == 6 || i > 0 && sortedModules.length > 3 && itemsPerClass > 2 && m.class != prevClass && (m.rating != prevRating || m.mount)) {
|
if (itemsOnThisRow == 6 || i > 0 && sortedModules.length > 3 && itemsPerClass > 2 && m.class != prevClass && (m.rating != prevRating || m.mount)) {
|
||||||
elems.push(<br key={'b' + m.grp + i}/>);
|
elems.push(<br key={'b' + m.grp + i} />);
|
||||||
itemsOnThisRow = 0;
|
itemsOnThisRow = 0;
|
||||||
}
|
}
|
||||||
let tbIdx = (classes.indexOf('disabled') < 0) ? 0 : undefined;
|
let tbIdx = (classes.indexOf('disabled') < 0) ? 0 : undefined;
|
||||||
elems.push(
|
elems.push(
|
||||||
<li key={m.id} data-id={m.id} className={classes} {...eventHandlers} tabIndex={tbIdx}
|
<li key={m.id} data-id={m.id} className={classes} {...eventHandlers} tabIndex={tbIdx} ref={slotItem => this.slotItems[m.id] = slotItem}>
|
||||||
ref={slotItem => this.slotItems[m.id] = slotItem}>
|
|
||||||
{mount}
|
{mount}
|
||||||
{(mount ? ' ' : '') + m.class + m.rating + (m.missile ? '/' + m.missile : '') + (m.name ? ' ' + translate(m.name) : '')}
|
{(mount ? ' ' : '') + m.class + m.rating + (m.missile ? '/' + m.missile : '') + (m.name ? ' ' + translate(m.name) : '')}
|
||||||
</li>
|
</li>
|
||||||
@@ -358,36 +340,6 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate tooltip content for the difference between the
|
|
||||||
* mounted module and the hovered modules
|
|
||||||
*/
|
|
||||||
_showSearch() {
|
|
||||||
return (
|
|
||||||
<FuzzySearch
|
|
||||||
list={this.state.fuzzy}
|
|
||||||
keys={['grp', 'name']}
|
|
||||||
className={'input'}
|
|
||||||
width={'100%'}
|
|
||||||
style={{ padding: 0 }}
|
|
||||||
onSelect={e => this.props.onSelect.bind(null, e.m)()}
|
|
||||||
resultsTemplate={(props, state, styles, clickHandler) => {
|
|
||||||
return state.results.map((val, i) => {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
key={i}
|
|
||||||
className={'lc'}
|
|
||||||
onClick={() => clickHandler(i)}
|
|
||||||
>
|
|
||||||
{val.name}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mouse over diff handler
|
* Mouse over diff handler
|
||||||
* @param {Function} showDiff diff tooltip callback
|
* @param {Function} showDiff diff tooltip callback
|
||||||
@@ -453,7 +405,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
* @param {Function} select Select module callback
|
* @param {Function} select Select module callback
|
||||||
* @param {SytheticEvent} event Event
|
* @param {SytheticEvent} event Event
|
||||||
*/
|
*/
|
||||||
_keyUp(select, event) {
|
_keyUp(select,event) {
|
||||||
// nothing here yet
|
// nothing here yet
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,13 +475,12 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
this.slotItems[this.firstSlotId].focus();
|
this.slotItems[this.firstSlotId].focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle focus if the component updates
|
* Handle focus if the component updates
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.props.slotDiv) {
|
if(this.props.slotDiv) {
|
||||||
this.props.slotDiv.focus();
|
this.props.slotDiv.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -550,12 +501,11 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div ref={node => this.node = node}
|
<div ref={node => this.node = node}
|
||||||
className={cn('select', this.props.className)}
|
className={cn('select', this.props.className)}
|
||||||
onScroll={this._hideDiff}
|
onScroll={this._hideDiff}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation() }
|
||||||
onContextMenu={stopCtxPropagation}
|
onContextMenu={stopCtxPropagation}
|
||||||
>
|
>
|
||||||
{this._showSearch()}
|
|
||||||
{this.state.list}
|
{this.state.list}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,21 +2,12 @@ import React from 'react';
|
|||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
import Slot from './Slot';
|
import Slot from './Slot';
|
||||||
import Persist from '../stores/Persist';
|
import Persist from '../stores/Persist';
|
||||||
import {
|
import { DamageAbsolute, DamageKinetic, DamageThermal, DamageExplosive, MountFixed, MountGimballed, MountTurret, ListModifications, Modified } from './SvgIcons';
|
||||||
DamageAbsolute,
|
|
||||||
DamageKinetic,
|
|
||||||
DamageThermal,
|
|
||||||
DamageExplosive,
|
|
||||||
MountFixed,
|
|
||||||
MountGimballed,
|
|
||||||
MountTurret,
|
|
||||||
ListModifications,
|
|
||||||
Modified
|
|
||||||
} from './SvgIcons';
|
|
||||||
import { Modifications } from 'coriolis-data/dist';
|
import { Modifications } from 'coriolis-data/dist';
|
||||||
import { stopCtxPropagation } from '../utils/UtilityFunctions';
|
import { stopCtxPropagation } from '../utils/UtilityFunctions';
|
||||||
import { blueprintTooltip } from '../utils/BlueprintFunctions';
|
import { blueprintTooltip } from '../utils/BlueprintFunctions';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hardpoint / Utility Slot
|
* Hardpoint / Utility Slot
|
||||||
*/
|
*/
|
||||||
@@ -36,7 +27,7 @@ export default class HardpointSlot extends Slot {
|
|||||||
* @return {string} Label
|
* @return {string} Label
|
||||||
*/
|
*/
|
||||||
_getMaxClassLabel(translate) {
|
_getMaxClassLabel(translate) {
|
||||||
return translate(['U', 'S', 'M', 'L', 'H'][this.props.maxClass]);
|
return translate(['U','S','M','L','H'][this.props.maxClass]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,73 +66,42 @@ export default class HardpointSlot extends Slot {
|
|||||||
return <div className={className} draggable='true' onDragStart={drag} onDragEnd={drop}>
|
return <div className={className} draggable='true' onDragStart={drag} onDragEnd={drop}>
|
||||||
<div className={'cb'}>
|
<div className={'cb'}>
|
||||||
<div className={'l'}>
|
<div className={'l'}>
|
||||||
{m.mount && m.mount == 'F' ? <span onMouseOver={termtip.bind(null, 'fixed')}
|
{m.mount && m.mount == 'F' ? <span onMouseOver={termtip.bind(null, 'fixed')} onMouseOut={tooltip.bind(null, null)}><MountFixed /></span> : ''}
|
||||||
onMouseOut={tooltip.bind(null, null)}><MountFixed/></span> : ''}
|
{m.mount && m.mount == 'G' ? <span onMouseOver={termtip.bind(null, 'gimballed')} onMouseOut={tooltip.bind(null, null)}><MountGimballed /></span> : ''}
|
||||||
{m.mount && m.mount == 'G' ? <span onMouseOver={termtip.bind(null, 'gimballed')}
|
{m.mount && m.mount == 'T' ? <span onMouseOver={termtip.bind(null, 'turreted')} onMouseOut={tooltip.bind(null, null)}><MountTurret /></span> : ''}
|
||||||
onMouseOut={tooltip.bind(null, null)}><MountGimballed/></span> : ''}
|
{m.getDamageDist() && m.getDamageDist().K ? <span onMouseOver={termtip.bind(null, 'kinetic')} onMouseOut={tooltip.bind(null, null)}><DamageKinetic /></span> : ''}
|
||||||
{m.mount && m.mount == 'T' ? <span onMouseOver={termtip.bind(null, 'turreted')}
|
{m.getDamageDist() && m.getDamageDist().T ? <span onMouseOver={termtip.bind(null, 'thermal')} onMouseOut={tooltip.bind(null, null)}><DamageThermal /></span> : ''}
|
||||||
onMouseOut={tooltip.bind(null, null)}><MountTurret/></span> : ''}
|
{m.getDamageDist() && m.getDamageDist().E ? <span onMouseOver={termtip.bind(null, 'explosive')} onMouseOut={tooltip.bind(null, null)}><DamageExplosive /></span> : ''}
|
||||||
{m.getDamageDist() && m.getDamageDist().K ? <span onMouseOver={termtip.bind(null, 'kinetic')}
|
{m.getDamageDist() && m.getDamageDist().A ? <span onMouseOver={termtip.bind(null, 'absolute')} onMouseOut={tooltip.bind(null, null)}><DamageAbsolute /></span> : ''}
|
||||||
onMouseOut={tooltip.bind(null, null)}><DamageKinetic/></span> : ''}
|
{classRating} {translate(m.name || m.grp)}{ m.mods && Object.keys(m.mods).length > 0 ? <span className='r' onMouseOver={termtip.bind(null, modTT)} onMouseOut={tooltip.bind(null, null)}><Modified /></span> : null }
|
||||||
{m.getDamageDist() && m.getDamageDist().T ? <span onMouseOver={termtip.bind(null, 'thermal')}
|
|
||||||
onMouseOut={tooltip.bind(null, null)}><DamageThermal/></span> : ''}
|
|
||||||
{m.getDamageDist() && m.getDamageDist().E ? <span onMouseOver={termtip.bind(null, 'explosive')}
|
|
||||||
onMouseOut={tooltip.bind(null, null)}><DamageExplosive/></span> : ''}
|
|
||||||
{m.getDamageDist() && m.getDamageDist().A ? <span onMouseOver={termtip.bind(null, 'absolute')}
|
|
||||||
onMouseOut={tooltip.bind(null, null)}><DamageAbsolute/></span> : ''}
|
|
||||||
{classRating} {translate(m.name || m.grp)}{m.mods && Object.keys(m.mods).length > 0 ? <span className='r'
|
|
||||||
onMouseOver={termtip.bind(null, modTT)}
|
|
||||||
onMouseOut={tooltip.bind(null, null)}><Modified/></span> : null}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={'r'}>{formats.round(m.getMass())}{u.T}</div>
|
<div className={'r'}>{formats.round(m.getMass())}{u.T}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={'cb'}>
|
<div className={'cb'}>
|
||||||
{m.getDps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'dpssdps' : 'dps')}
|
{ m.getDps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'dpssdps' : 'dps')} onMouseOut={tooltip.bind(null, null)}>{translate('DPS')}: {formats.round1(m.getDps())} { m.getClip() ? <span>({formats.round1(m.getSDps()) })</span> : null }</div> : null }
|
||||||
onMouseOut={tooltip.bind(null, null)}>{translate('DPS')}: {formats.round1(m.getDps())} {m.getClip() ?
|
{ m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'epsseps' : 'eps')} onMouseOut={tooltip.bind(null, null)}>{translate('EPS')}: {formats.round1(m.getEps())}{u.MW} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getEps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) }{u.MW})</span> : null }</div> : null }
|
||||||
<span>({formats.round1(m.getSDps())})</span> : null}</div> : null}
|
{ m.getHps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'hpsshps' : 'hps')} onMouseOut={tooltip.bind(null, null)}>{translate('HPS')}: {formats.round1(m.getHps())} { m.getClip() ? <span>({formats.round1((m.getClip() * m.getHps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload())) })</span> : null }</div> : null }
|
||||||
{m.getDamage() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getDamage() ? 'shotdmg' : 'shotdmg')}
|
{ m.getDps() && m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, 'dpe')} onMouseOut={tooltip.bind(null, null)}>{translate('DPE')}: {formats.f1(m.getDps() / m.getEps())}</div> : null }
|
||||||
onMouseOut={tooltip.bind(null, null)}>{translate('shotdmg')}: {formats.round1(m.getDamage())}</div> : null}
|
{ m.getRoF() ? <div className={'l'} onMouseOver={termtip.bind(null, 'rof')} onMouseOut={tooltip.bind(null, null)}>{translate('ROF')}: {formats.f1(m.getRoF())}{u.ps}</div> : null }
|
||||||
{m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'epsseps' : 'eps')}
|
{ m.getRange() ? <div className={'l'}>{translate('range', m.grp)} {formats.f1(m.getRange() / 1000)}{u.km}</div> : null }
|
||||||
onMouseOut={tooltip.bind(null, null)}>{translate('EPS')}: {formats.round1(m.getEps())}{u.MW} {m.getClip() ?
|
{ m.getScanTime() ? <div className={'l'}>{translate('scantime')} {formats.f1(m.getScanTime())}{u.s}</div> : null }
|
||||||
<span>({formats.round1((m.getClip() * m.getEps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()))}{u.MW})</span> : null}</div> : null}
|
{ m.getFalloff() ? <div className={'l'}>{translate('falloff')} {formats.round(m.getFalloff() / 1000)}{u.km}</div> : null }
|
||||||
{m.getHps() ? <div className={'l'} onMouseOver={termtip.bind(null, m.getClip() ? 'hpsshps' : 'hps')}
|
{ m.getShieldBoost() ? <div className={'l'}>+{formats.pct1(m.getShieldBoost())}</div> : null }
|
||||||
onMouseOut={tooltip.bind(null, null)}>{translate('HPS')}: {formats.round1(m.getHps())} {m.getClip() ?
|
{ m.getAmmo() ? <div className={'l'}>{translate('ammunition')}: {formats.int(m.getClip())}/{formats.int(m.getAmmo())}</div> : null }
|
||||||
<span>({formats.round1((m.getClip() * m.getHps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()))})</span> : null}</div> : null}
|
{ m.getReload() ? <div className={'l'}>{translate('reload')}: {formats.round(m.getReload())}{u.s}</div> : null }
|
||||||
{m.getDps() && m.getEps() ? <div className={'l'} onMouseOver={termtip.bind(null, 'dpe')}
|
{ m.getShotSpeed() ? <div className={'l'}>{translate('shotspeed')}: {formats.int(m.getShotSpeed())}{u.mps}</div> : null }
|
||||||
onMouseOut={tooltip.bind(null, null)}>{translate('DPE')}: {formats.f1(m.getDps() / m.getEps())}</div> : null}
|
{ m.getPiercing() ? <div className={'l'}>{translate('piercing')}: {formats.int(m.getPiercing())}</div> : null }
|
||||||
{m.getRoF() ? <div className={'l'} onMouseOver={termtip.bind(null, 'rof')}
|
{ m.getJitter() ? <div className={'l'}>{translate('jitter')}: {formats.f2(m.getJitter())}°</div> : null }
|
||||||
onMouseOut={tooltip.bind(null, null)}>{translate('ROF')}: {formats.f1(m.getRoF())}{u.ps}</div> : null}
|
{ showModuleResistances && m.getExplosiveResistance() ? <div className='l'>{translate('explres')}: {formats.pct(m.getExplosiveResistance())}</div> : null }
|
||||||
{m.getRange() ? <div
|
{ showModuleResistances && m.getKineticResistance() ? <div className='l'>{translate('kinres')}: {formats.pct(m.getKineticResistance())}</div> : null }
|
||||||
className={'l'}>{translate('range', m.grp)} {formats.f1(m.getRange() / 1000)}{u.km}</div> : null}
|
{ showModuleResistances && m.getThermalResistance() ? <div className='l'>{translate('thermres')}: {formats.pct(m.getThermalResistance())}</div> : null }
|
||||||
{m.getScanTime() ? <div
|
{ m.getIntegrity() ? <div className='l'>{translate('integrity')}: {formats.int(m.getIntegrity())}</div> : null }
|
||||||
className={'l'}>{translate('scantime')} {formats.f1(m.getScanTime())}{u.s}</div> : null}
|
{ m && validMods.length > 0 ? <div className='r' tabIndex="0" ref={ modButton => this.modButton = modButton }><button tabIndex="-1" onClick={this._toggleModifications.bind(this)} onContextMenu={stopCtxPropagation} onMouseOver={termtip.bind(null, 'modifications')} onMouseOut={tooltip.bind(null, null)}><ListModifications /></button></div> : null }
|
||||||
{m.getFalloff() ? <div
|
|
||||||
className={'l'}>{translate('falloff')} {formats.round(m.getFalloff() / 1000)}{u.km}</div> : null}
|
|
||||||
{m.getShieldBoost() ? <div className={'l'}>+{formats.pct1(m.getShieldBoost())}</div> : null}
|
|
||||||
{m.getAmmo() ? <div
|
|
||||||
className={'l'}>{translate('ammunition')}: {formats.int(m.getClip())}/{formats.int(m.getAmmo())}</div> : null}
|
|
||||||
{m.getReload() ? <div className={'l'}>{translate('reload')}: {formats.round(m.getReload())}{u.s}</div> : null}
|
|
||||||
{m.getShotSpeed() ? <div
|
|
||||||
className={'l'}>{translate('shotspeed')}: {formats.int(m.getShotSpeed())}{u.mps}</div> : null}
|
|
||||||
{m.getPiercing() ? <div className={'l'}>{translate('piercing')}: {formats.int(m.getPiercing())}</div> : null}
|
|
||||||
{m.getJitter() ? <div className={'l'}>{translate('jitter')}: {formats.f2(m.getJitter())}°</div> : null}
|
|
||||||
{showModuleResistances && m.getExplosiveResistance() ? <div
|
|
||||||
className='l'>{translate('explres')}: {formats.pct(m.getExplosiveResistance())}</div> : null}
|
|
||||||
{showModuleResistances && m.getKineticResistance() ? <div
|
|
||||||
className='l'>{translate('kinres')}: {formats.pct(m.getKineticResistance())}</div> : null}
|
|
||||||
{showModuleResistances && m.getThermalResistance() ? <div
|
|
||||||
className='l'>{translate('thermres')}: {formats.pct(m.getThermalResistance())}</div> : null}
|
|
||||||
{m.getIntegrity() ? <div className='l'>{translate('integrity')}: {formats.int(m.getIntegrity())}</div> : null}
|
|
||||||
{m && validMods.length > 0 ? <div className='r' tabIndex="0" ref={modButton => this.modButton = modButton}>
|
|
||||||
<button tabIndex="-1" onClick={this._toggleModifications.bind(this)} onContextMenu={stopCtxPropagation}
|
|
||||||
onMouseOver={termtip.bind(null, 'modifications')} onMouseOut={tooltip.bind(null, null)}>
|
|
||||||
<ListModifications/></button>
|
|
||||||
</div> : null}
|
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
return <div className={'empty'}>{translate('empty')}</div>;
|
return <div className={'empty'}>{translate('empty')}</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,15 +153,6 @@ export default class HardpointSlotSection extends SlotSection {
|
|||||||
<ul>
|
<ul>
|
||||||
<li className='lc' tabIndex='0' onClick={_fill.bind(this, 'nl', 'F')} onKeyDown={this._keyDown} ref={smRef => this.sectionRefArr['nl-F'] = smRef}>{translate('nl')}</li>
|
<li className='lc' tabIndex='0' onClick={_fill.bind(this, 'nl', 'F')} onKeyDown={this._keyDown} ref={smRef => this.sectionRefArr['nl-F'] = smRef}>{translate('nl')}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div className='select-group cap'>{translate('ggc')}</div>
|
|
||||||
<ul>
|
|
||||||
<li className='lc' tabIndex='0' onClick={_fill.bind(this, 'ggc', 'F')} onKeyDown={this._keyDown} ref={smRef => this.sectionRefArr['ggc-F'] = smRef}>{translate('ggc')}</li>
|
|
||||||
</ul>
|
|
||||||
<div className='select-group cap'>{translate('rfl')}</div>
|
|
||||||
<ul>
|
|
||||||
<li className='c' tabIndex='0' onClick={_fill.bind(this, 'rfl', 'F')} onKeyDown={this._keyDown} ref={smRef => this.sectionRefArr['rfl-F'] = smRef}><MountFixed className='lg'/></li>
|
|
||||||
<li className='c' tabIndex='0' onClick={_fill.bind(this, 'rfl', 'T')} onKeyDown={this._keyDown} ref={smRef => this.sectionRefArr['rfl-T'] = smRef}><MountTurret className='lg'/></li>
|
|
||||||
</ul>
|
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,8 @@ export default class ModalOrbis extends TranslatedComponent {
|
|||||||
this.state = {
|
this.state = {
|
||||||
orbisCreds: Persist.getOrbisCreds(),
|
orbisCreds: Persist.getOrbisCreds(),
|
||||||
orbisUrl: '...',
|
orbisUrl: '...',
|
||||||
ship: this.props.ship,
|
|
||||||
authenticatedStatus: 'Checking...'
|
authenticatedStatus: 'Checking...'
|
||||||
};
|
};
|
||||||
this.orbisCategory = this.orbisCategory.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,17 +88,6 @@ export default class ModalOrbis extends TranslatedComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler for changing category
|
|
||||||
* @param {SyntheticEvent} e React Event
|
|
||||||
*/
|
|
||||||
orbisCategory(e) {
|
|
||||||
let ship = this.state.ship;
|
|
||||||
let cat = e.target.value;
|
|
||||||
ship.category = cat;
|
|
||||||
this.setState({ship});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the modal
|
* Render the modal
|
||||||
* @return {React.Component} Modal Content
|
* @return {React.Component} Modal Content
|
||||||
@@ -119,17 +106,6 @@ export default class ModalOrbis extends TranslatedComponent {
|
|||||||
<br/><br/>
|
<br/><br/>
|
||||||
<a className='button' href="https://orbis.zone/api/auth">Log in / signup to Orbis</a>
|
<a className='button' href="https://orbis.zone/api/auth">Log in / signup to Orbis</a>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<h3>Category</h3>
|
|
||||||
<select onChange={this.orbisCategory}>
|
|
||||||
<option value="">No Category</option>
|
|
||||||
<option>Combat</option>
|
|
||||||
<option>Mining</option>
|
|
||||||
<option>Trading</option>
|
|
||||||
<option>Exploration</option>
|
|
||||||
<option>Passenger Liner</option>
|
|
||||||
<option>PvP</option>
|
|
||||||
</select>
|
|
||||||
<br/><br/>
|
|
||||||
<h3 >{translate('Orbis link')}</h3>
|
<h3 >{translate('Orbis link')}</h3>
|
||||||
<input value={this.state.orbisUrl} readOnly size={25} onFocus={ (e) => e.target.select() }/>
|
<input value={this.state.orbisUrl} readOnly size={25} onFocus={ (e) => e.target.select() }/>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ export default class ShipSummaryTable extends TranslatedComponent {
|
|||||||
const boostTooltip = canBoost ? 'TT_SUMMARY_BOOST' : canThrust ? 'TT_SUMMARY_BOOST_NONFUNCTIONAL' : 'TT_SUMMARY_SPEED_NONFUNCTIONAL';
|
const boostTooltip = canBoost ? 'TT_SUMMARY_BOOST' : canThrust ? 'TT_SUMMARY_BOOST_NONFUNCTIONAL' : 'TT_SUMMARY_SPEED_NONFUNCTIONAL';
|
||||||
const sgMetrics = Calc.shieldMetrics(ship, pips.sys);
|
const sgMetrics = Calc.shieldMetrics(ship, pips.sys);
|
||||||
const shipBoost = canBoost ? Calc.calcBoost(ship) : 'No Boost';
|
const shipBoost = canBoost ? Calc.calcBoost(ship) : 'No Boost';
|
||||||
const restingHeat = Math.sqrt(((ship.standard[0].m.pgen * ship.standard[0].m.eff) / ship.heatCapacity) / 0.2);
|
|
||||||
const armourMetrics = Calc.armourMetrics(ship);
|
const armourMetrics = Calc.armourMetrics(ship);
|
||||||
let shieldColour = 'blue';
|
let shieldColour = 'blue';
|
||||||
if (shieldGenerator && shieldGenerator.m.grp === 'psg') {
|
if (shieldGenerator && shieldGenerator.m.grp === 'psg') {
|
||||||
@@ -79,14 +78,13 @@ export default class ShipSummaryTable extends TranslatedComponent {
|
|||||||
<th rowSpan={2}>{translate('TTD')}</th>
|
<th rowSpan={2}>{translate('TTD')}</th>
|
||||||
{/* <th onMouseEnter={termtip.bind(null, 'heat per second')} onMouseLeave={hide} rowSpan={2}>{translate('HPS')}</th> */}
|
{/* <th onMouseEnter={termtip.bind(null, 'heat per second')} onMouseLeave={hide} rowSpan={2}>{translate('HPS')}</th> */}
|
||||||
<th rowSpan={2}>{translate('cargo')}</th>
|
<th rowSpan={2}>{translate('cargo')}</th>
|
||||||
<th rowSpan={2} onMouseEnter={termtip.bind(null, 'passenger capacity', { cap: 0 })} onMouseLeave={hide}>{translate('pax')}</th>
|
<th rowSpan={2}>{translate('pax')}</th>
|
||||||
<th rowSpan={2}>{translate('fuel')}</th>
|
<th rowSpan={2}>{translate('fuel')}</th>
|
||||||
<th colSpan={3}>{translate('mass')}</th>
|
<th colSpan={3}>{translate('mass')}</th>
|
||||||
<th onMouseEnter={termtip.bind(null, 'hull hardness', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('hrd')}</th>
|
<th onMouseEnter={termtip.bind(null, 'hull hardness', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('hrd')}</th>
|
||||||
<th rowSpan={2}>{translate('crew')}</th>
|
<th rowSpan={2}>{translate('crew')}</th>
|
||||||
<th onMouseEnter={termtip.bind(null, 'mass lock factor', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('MLF')}</th>
|
<th onMouseEnter={termtip.bind(null, 'mass lock factor', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('MLF')}</th>
|
||||||
<th onMouseEnter={termtip.bind(null, 'TT_SUMMARY_BOOST_TIME', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('boost time')}</th>
|
<th onMouseEnter={termtip.bind(null, 'TT_SUMMARY_BOOST_TIME', { cap: 0 })} onMouseLeave={hide} rowSpan={2}>{translate('boost time')}</th>
|
||||||
<th rowSpan={2}>{translate('resting heat (Beta)')}</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th className='lft'>{translate('max')}</th>
|
<th className='lft'>{translate('max')}</th>
|
||||||
@@ -124,7 +122,6 @@ export default class ShipSummaryTable extends TranslatedComponent {
|
|||||||
<td>{ship.crew}</td>
|
<td>{ship.crew}</td>
|
||||||
<td>{ship.masslock}</td>
|
<td>{ship.masslock}</td>
|
||||||
<td>{shipBoost !== 'No Boost' ? formats.time(shipBoost) : 'No Boost'}</td>
|
<td>{shipBoost !== 'No Boost' ? formats.time(shipBoost) : 'No Boost'}</td>
|
||||||
<td>{formats.pct(restingHeat)}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
12
src/app/model/Build.js
Normal file
12
src/app/model/Build.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Model } from '@nozbe/watermelondb';
|
||||||
|
import { field } from '@nozbe/watermelondb/decorators';
|
||||||
|
|
||||||
|
export default class Build extends Model {
|
||||||
|
static table = 'builds';
|
||||||
|
|
||||||
|
@field('title') title;
|
||||||
|
|
||||||
|
@field('code') code;
|
||||||
|
|
||||||
|
@field('ship_id') ship_id;
|
||||||
|
}
|
||||||
22
src/app/model/index.js
Normal file
22
src/app/model/index.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Database } from '@nozbe/watermelondb';
|
||||||
|
import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
|
||||||
|
|
||||||
|
import { coriolisSchema } from './schema';
|
||||||
|
import Build from './Build';
|
||||||
|
// import Post from './model/Post' // ⬅️ You'll import your Models here
|
||||||
|
|
||||||
|
// First, create the adapter to the underlying database:
|
||||||
|
const adapter = new LokiJSAdapter({
|
||||||
|
dbName: 'coriolis', // ⬅️ Give your database a name!
|
||||||
|
schema: coriolisSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
// Then, make a Watermelon database from it!
|
||||||
|
export const database = new Database({
|
||||||
|
adapter,
|
||||||
|
modelClasses: [
|
||||||
|
Build
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
export const buildsCollection = database.collections.get('builds');
|
||||||
15
src/app/model/schema.js
Normal file
15
src/app/model/schema.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import {appSchema, tableSchema} from '@nozbe/watermelondb';
|
||||||
|
|
||||||
|
export const coriolisSchema = appSchema({
|
||||||
|
version: 2,
|
||||||
|
tables: [
|
||||||
|
tableSchema({
|
||||||
|
name: 'builds',
|
||||||
|
columns: [
|
||||||
|
{name: 'title', type: 'string', isIndexed: true},
|
||||||
|
{name: 'code', type: 'string'},
|
||||||
|
{name: 'ship_id', type: 'string'}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
||||||
@@ -38,6 +38,7 @@ import ModalExport from '../components/ModalExport';
|
|||||||
import ModalPermalink from '../components/ModalPermalink';
|
import ModalPermalink from '../components/ModalPermalink';
|
||||||
import ModalShoppingList from '../components/ModalShoppingList';
|
import ModalShoppingList from '../components/ModalShoppingList';
|
||||||
import ModalOrbis from '../components/ModalOrbis';
|
import ModalOrbis from '../components/ModalOrbis';
|
||||||
|
import { autoBind } from 'react-extras';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document Title Generator
|
* Document Title Generator
|
||||||
@@ -62,14 +63,7 @@ export default class OutfittingPage extends Page {
|
|||||||
super(props, context);
|
super(props, context);
|
||||||
// window.Perf = Perf;
|
// window.Perf = Perf;
|
||||||
this.state = this._initState(props, context);
|
this.state = this._initState(props, context);
|
||||||
this._keyDown = this._keyDown.bind(this);
|
autoBind(this);
|
||||||
this._exportBuild = this._exportBuild.bind(this);
|
|
||||||
this._pipsUpdated = this._pipsUpdated.bind(this);
|
|
||||||
this._boostUpdated = this._boostUpdated.bind(this);
|
|
||||||
this._cargoUpdated = this._cargoUpdated.bind(this);
|
|
||||||
this._fuelUpdated = this._fuelUpdated.bind(this);
|
|
||||||
this._opponentUpdated = this._opponentUpdated.bind(this);
|
|
||||||
this._engagementRangeUpdated = this._engagementRangeUpdated.bind(this);
|
|
||||||
this._sectionMenuRefs = {};
|
this._sectionMenuRefs = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +77,9 @@ export default class OutfittingPage extends Page {
|
|||||||
let params = context.route.params;
|
let params = context.route.params;
|
||||||
let shipId = params.ship;
|
let shipId = params.ship;
|
||||||
let code = params.code;
|
let code = params.code;
|
||||||
|
let savedCode = code;
|
||||||
let buildName = params.bn;
|
let buildName = params.bn;
|
||||||
let data = Ships[shipId]; // Retrieve the basic ship properties, slots and defaults
|
let data = Ships[shipId]; // Retrieve the basic ship properties, slots and defaults
|
||||||
let savedCode = Persist.getBuild(shipId, buildName);
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return { error: { message: 'Ship not found: ' + shipId } };
|
return { error: { message: 'Ship not found: ' + shipId } };
|
||||||
}
|
}
|
||||||
@@ -144,6 +138,13 @@ export default class OutfittingPage extends Page {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getBuild() {
|
||||||
|
const build = await Persist.getBuild(this.state.shipId, this.state.buildName);
|
||||||
|
if (build) {
|
||||||
|
this.setState({id: build.id, savedCode: build.code})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle build name change and update state
|
* Handle build name change and update state
|
||||||
* @param {SyntheticEvent} event React Event
|
* @param {SyntheticEvent} event React Event
|
||||||
@@ -417,13 +418,14 @@ export default class OutfittingPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* Save the current build
|
* Save the current build
|
||||||
*/
|
*/
|
||||||
_saveBuild() {
|
async _saveBuild() {
|
||||||
const { ship, buildName, newBuildName, shipId } = this.state;
|
const { ship, buildName, newBuildName, shipId, id } = this.state;
|
||||||
|
this.getBuild();
|
||||||
// If this is a stock ship the code won't be set, so ensure that we have it
|
// If this is a stock ship the code won't be set, so ensure that we have it
|
||||||
const code = this.state.code || ship.toString();
|
const code = this.state.code || ship.toString();
|
||||||
|
|
||||||
Persist.saveBuild(shipId, newBuildName, code);
|
const yes = await Persist.saveBuild(id, newBuildName, code, shipId);
|
||||||
|
console.log(yes)
|
||||||
this._updateRoute(shipId, newBuildName, code);
|
this._updateRoute(shipId, newBuildName, code);
|
||||||
|
|
||||||
let opponent, opponentBuild, opponentSys, opponentEng, opponentWep;
|
let opponent, opponentBuild, opponentSys, opponentEng, opponentWep;
|
||||||
@@ -660,6 +662,7 @@ export default class OutfittingPage extends Page {
|
|||||||
* Add listeners when about to mount
|
* Add listeners when about to mount
|
||||||
*/
|
*/
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
this.getBuild()
|
||||||
document.addEventListener('keydown', this._keyDown);
|
document.addEventListener('keydown', this._keyDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ function shipSummary(shipId, shipData) {
|
|||||||
id: shipId,
|
id: shipId,
|
||||||
hpCount: 0,
|
hpCount: 0,
|
||||||
intCount: 0,
|
intCount: 0,
|
||||||
beta: shipData.beta,
|
|
||||||
maxCargo: 0,
|
maxCargo: 0,
|
||||||
maxPassengers: 0,
|
maxPassengers: 0,
|
||||||
hp: [0, 0, 0, 0, 0], // Utility, Small, Medium, Large, Huge
|
hp: [0, 0, 0, 0, 0], // Utility, Small, Medium, Large, Huge
|
||||||
@@ -319,7 +318,7 @@ export default class ShipyardPage extends Page {
|
|||||||
onMouseEnter={noTouch && this._highlightShip.bind(this, s.id)}
|
onMouseEnter={noTouch && this._highlightShip.bind(this, s.id)}
|
||||||
>
|
>
|
||||||
<td className="le">
|
<td className="le">
|
||||||
<Link href={'/outfit/' + s.id}>{s.name} {s.beta === true ? '(Beta)' : null}</Link>
|
<Link href={'/outfit/' + s.id}>{s.name}</Link>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
@@ -452,10 +451,10 @@ export default class ShipyardPage extends Page {
|
|||||||
<th className="sortable" onClick={sortShips('maxCargo')}>
|
<th className="sortable" onClick={sortShips('maxCargo')}>
|
||||||
{translate('cargo')}
|
{translate('cargo')}
|
||||||
</th>
|
</th>
|
||||||
<th className="sortable" onClick={sortShips('maxPassengers')} onMouseEnter={termtip.bind(null, 'passenger capacity')}
|
<th className="sortable" onClick={sortShips('maxPassengers')}>
|
||||||
onMouseLeave={hide}>
|
|
||||||
{translate('pax')}
|
{translate('pax')}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th className="lft" colSpan={7}>
|
<th className="lft" colSpan={7}>
|
||||||
{translate('core module classes')}
|
{translate('core module classes')}
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ export default class Module {
|
|||||||
* @return {object} The value of the modification. If it is a numeric value then it is returned as an integer value scaled so that 1.23% == 123
|
* @return {object} The value of the modification. If it is a numeric value then it is returned as an integer value scaled so that 1.23% == 123
|
||||||
*/
|
*/
|
||||||
getModValue(name, raw) {
|
getModValue(name, raw) {
|
||||||
let baseVal = this[name];
|
|
||||||
let result = this.mods && this.mods[name] ? this.mods[name] : null;
|
let result = this.mods && this.mods[name] ? this.mods[name] : null;
|
||||||
|
|
||||||
if ((!raw) && this.blueprint && this.blueprint.special) {
|
if ((!raw) && this.blueprint && this.blueprint.special) {
|
||||||
@@ -52,8 +51,13 @@ export default class Module {
|
|||||||
const modification = Modifications.modifications[name];
|
const modification = Modifications.modifications[name];
|
||||||
const multiplier = modification.type === 'percentage' ? 10000 : 100;
|
const multiplier = modification.type === 'percentage' ? 10000 : 100;
|
||||||
if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') {
|
if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') {
|
||||||
// Apply resistance modding mechanisms to special effects subsequently
|
// Resistance modifications in itself are additive, however their
|
||||||
result = result + modifierActions[name] * (1 - (this[name] + result / multiplier)) * 100;
|
// special effects are multiplicative. They affect the overall result
|
||||||
|
// by (special effect resistance) * (damage mult after modification),
|
||||||
|
// i. e. we need to apply the special effect as a multiplier to the
|
||||||
|
// overall result and then calculate the difference.
|
||||||
|
let baseMult = this[name] ? 1 - this[name] : 1;
|
||||||
|
result = (baseMult - (baseMult - result / multiplier) * (1 - modifierActions[name] / 100)) * multiplier;
|
||||||
} else if (modification.method === 'additive') {
|
} else if (modification.method === 'additive') {
|
||||||
result = result + modifierActions[name] * 100;
|
result = result + modifierActions[name] * 100;
|
||||||
} else if (modification.method === 'overwrite') {
|
} else if (modification.method === 'overwrite') {
|
||||||
@@ -71,6 +75,15 @@ export default class Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resistance modding for hull reinforcement packages has additional
|
||||||
|
// diminishing returns implemented. The mod value gets lowered by
|
||||||
|
// the amount of base resistance the hrp has.
|
||||||
|
if (!isNaN(result) && this.grp === 'hr' &&
|
||||||
|
(name === 'kinres' || name === 'thermres' || name === 'explres')) {
|
||||||
|
let baseRes = this[name];
|
||||||
|
result = result * (1 - baseRes);
|
||||||
|
}
|
||||||
|
|
||||||
// Sanitise the resultant value to 4dp equivalent
|
// Sanitise the resultant value to 4dp equivalent
|
||||||
return isNaN(result) ? result : Math.round(result);
|
return isNaN(result) ? result : Math.round(result);
|
||||||
}
|
}
|
||||||
@@ -95,11 +108,11 @@ export default class Module {
|
|||||||
// This special effect modifies the value being set, so we need to revert it prior to storing the value
|
// This special effect modifies the value being set, so we need to revert it prior to storing the value
|
||||||
const modification = Modifications.modifications[name];
|
const modification = Modifications.modifications[name];
|
||||||
if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') {
|
if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') {
|
||||||
let res = (this[name] ? this[name] : 0) + value / 10000;
|
// Resistance modifications in itself are additive but their
|
||||||
let experimental = modifierActions[name] / 100;
|
// experimentals are applied multiplicatively therefor we must handle
|
||||||
value = (experimental - res) / (experimental - 1) - this[name];
|
// them differently here (cf. documentation in getModValue).
|
||||||
value *= 10000;
|
let baseMult = (this[name] ? 1 - this[name] : 1);
|
||||||
// value = ((baseMult - value / 10000) / (1 - modifierActions[name] / 100) - baseMult) * -10000;
|
value = ((baseMult - value / 10000) / (1 - modifierActions[name] / 100) - baseMult) * -10000;
|
||||||
} else if (modification.method === 'additive') {
|
} else if (modification.method === 'additive') {
|
||||||
value = value - modifierActions[name];
|
value = value - modifierActions[name];
|
||||||
} else if (modification.method === 'overwrite') {
|
} else if (modification.method === 'overwrite') {
|
||||||
@@ -164,6 +177,10 @@ export default class Module {
|
|||||||
baseValue = 0;
|
baseValue = 0;
|
||||||
}
|
}
|
||||||
modValue = value - baseValue;
|
modValue = value - baseValue;
|
||||||
|
if (this.grp === 'hr' &&
|
||||||
|
(name === 'kinres' || name === 'thermres' || name === 'explres')) {
|
||||||
|
modValue = modValue / (1 - baseValue);
|
||||||
|
}
|
||||||
} else if (name === 'shieldboost' || name === 'hullboost') {
|
} else if (name === 'shieldboost' || name === 'hullboost') {
|
||||||
modValue = (1 + value) / (1 + baseValue) - 1;
|
modValue = (1 + value) / (1 + baseValue) - 1;
|
||||||
} else { // multiplicative
|
} else { // multiplicative
|
||||||
|
|||||||
@@ -63,10 +63,7 @@ export function standard(type, id) {
|
|||||||
if (!isNaN(type)) {
|
if (!isNaN(type)) {
|
||||||
type = StandardArray[type];
|
type = StandardArray[type];
|
||||||
}
|
}
|
||||||
let s = Modules.standard[type].find(e => e.id === id);
|
let s = Modules.standard[type].find(e => e.id == id || (e.class == id.charAt(0) && e.rating == id.charAt(1)));
|
||||||
if (!s) {
|
|
||||||
s = Modules.standard[type].find(e => (e.class == id.charAt(0) && e.rating == id.charAt(1)));
|
|
||||||
}
|
|
||||||
if (s) {
|
if (s) {
|
||||||
s = new Module({ template: s });
|
s = new Module({ template: s });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -505,11 +505,6 @@ export default class Ship {
|
|||||||
if (isAbsolute) {
|
if (isAbsolute) {
|
||||||
m.setPretty(name, value, sentfromui);
|
m.setPretty(name, value, sentfromui);
|
||||||
} else {
|
} else {
|
||||||
// Resistance modifiers scale with the base value
|
|
||||||
if (name == 'kinres' || name == 'thermres' || name == 'causres' || name == 'explres') {
|
|
||||||
let baseValue = m.get(name, false);
|
|
||||||
value = (1 - baseValue) * value;
|
|
||||||
}
|
|
||||||
m.setModValue(name, value, sentfromui);
|
m.setModValue(name, value, sentfromui);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1506,7 +1501,7 @@ export default class Ship {
|
|||||||
} else {
|
} else {
|
||||||
buffer.writeInt32LE(slotMod.value, curpos);
|
buffer.writeInt32LE(slotMod.value, curpos);
|
||||||
}
|
}
|
||||||
const modification = _.find(Modifications.modifications, function(o) { return o.id === slotMod.id; });
|
// const modification = _.find(Modifications.modifications, function(o) { return o.id === slotMod.id; });
|
||||||
// console.log('ENCODE Slot ' + i + ': ' + modification.name + ' = ' + slotMod.value);
|
// console.log('ENCODE Slot ' + i + ': ' + modification.name + ' = ' + slotMod.value);
|
||||||
curpos += 4;
|
curpos += 4;
|
||||||
}
|
}
|
||||||
@@ -1519,7 +1514,6 @@ export default class Ship {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.serialized.modifications = zlib.gzipSync(buffer).toString('base64');
|
this.serialized.modifications = zlib.gzipSync(buffer).toString('base64');
|
||||||
// console.log(this.serialized.modifications)
|
|
||||||
} else {
|
} else {
|
||||||
this.serialized.modifications = null;
|
this.serialized.modifications = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { EventEmitter } from 'fbemitter';
|
import { EventEmitter } from 'fbemitter';
|
||||||
import { Insurance } from '../shipyard/Constants';
|
import { Insurance } from '../shipyard/Constants';
|
||||||
|
import { buildsCollection, database } from '../model';
|
||||||
|
import {Q} from '@nozbe/watermelondb';
|
||||||
|
|
||||||
const LS_KEY_BUILDS = 'builds';
|
const LS_KEY_BUILDS = 'builds';
|
||||||
const LS_KEY_COMPARISONS = 'comparisons';
|
const LS_KEY_COMPARISONS = 'comparisons';
|
||||||
@@ -81,7 +83,7 @@ export class Persist extends EventEmitter {
|
|||||||
localStorage.setItem('test', 'test');
|
localStorage.setItem('test', 'test');
|
||||||
localStorage.removeItem('test');
|
localStorage.removeItem('test');
|
||||||
LS = localStorage;
|
LS = localStorage;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
LS = null;
|
LS = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +107,7 @@ export class Persist extends EventEmitter {
|
|||||||
this.comparisons = comparisonJson && typeof comparisonJson == 'object' ? comparisonJson : {};
|
this.comparisons = comparisonJson && typeof comparisonJson == 'object' ? comparisonJson : {};
|
||||||
this.costTab = _getString(LS_KEY_COST_TAB);
|
this.costTab = _getString(LS_KEY_COST_TAB);
|
||||||
this.outfittingTab = _getString(LS_KEY_OUTFITTING_TAB);
|
this.outfittingTab = _getString(LS_KEY_OUTFITTING_TAB);
|
||||||
this.state = _get(LS_KEY_STATE);
|
this.state = _get(LS_KEY_STATE);
|
||||||
this.sizeRatio = _get(LS_KEY_SIZE_RATIO) || 1;
|
this.sizeRatio = _get(LS_KEY_SIZE_RATIO) || 1;
|
||||||
this.matsPerGrade = matsPerGrade || {
|
this.matsPerGrade = matsPerGrade || {
|
||||||
1: 2,
|
1: 2,
|
||||||
@@ -132,7 +134,7 @@ export class Persist extends EventEmitter {
|
|||||||
let newValue = e.newValue;
|
let newValue = e.newValue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch(e.key) {
|
switch (e.key) {
|
||||||
case LS_KEY_BUILDS:
|
case LS_KEY_BUILDS:
|
||||||
this.builds = newValue ? JSON.parse(newValue) : {};
|
this.builds = newValue ? JSON.parse(newValue) : {};
|
||||||
this.emit('builds');
|
this.emit('builds');
|
||||||
@@ -249,17 +251,27 @@ export class Persist extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Persist a ship build in local storage.
|
* Persist a ship build in local storage.
|
||||||
*
|
*
|
||||||
* @param {String} shipId The unique id for a model of ship
|
* @param {String} id The unique id for the ship or ''
|
||||||
|
* @param {String} shipId The coriolis ship id
|
||||||
* @param {String} name The name of the build
|
* @param {String} name The name of the build
|
||||||
* @param {String} code The serialized code
|
* @param {String} code The serialized code
|
||||||
*/
|
*/
|
||||||
saveBuild(shipId, name, code) {
|
async saveBuild(id, name, code, shipId) {
|
||||||
if (!this.builds[shipId]) {
|
if (id) {
|
||||||
this.builds[shipId] = {};
|
const build = await buildsCollection.find(id);
|
||||||
|
if (build) {
|
||||||
|
return build.update(newBuild => {
|
||||||
|
newBuild.title = name;
|
||||||
|
newBuild.body = code;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.builds[shipId][name] = code;
|
|
||||||
_put(LS_KEY_BUILDS, this.builds);
|
return await buildsCollection.create(build => {
|
||||||
this.emit('builds');
|
build.title = name;
|
||||||
|
build.ship_id = shipId;
|
||||||
|
build.body = code;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -270,11 +282,10 @@ export class Persist extends EventEmitter {
|
|||||||
* @param {String} name The name of the build
|
* @param {String} name The name of the build
|
||||||
* @return {String} The serialized build string.
|
* @return {String} The serialized build string.
|
||||||
*/
|
*/
|
||||||
getBuild(shipId, name) {
|
async getBuild(shipId, name) {
|
||||||
if (this.builds[shipId] && this.builds[shipId][name]) {
|
const build = await buildsCollection.query(Q.where('ship_id', shipId), Q.where('title', name)).fetch();
|
||||||
return this.builds[shipId][name];
|
console.log(build);
|
||||||
}
|
return build;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,7 +294,7 @@ export class Persist extends EventEmitter {
|
|||||||
* @return {Object | Array} Object if Ship Id is not provided
|
* @return {Object | Array} Object if Ship Id is not provided
|
||||||
*/
|
*/
|
||||||
getBuilds(shipId) {
|
getBuilds(shipId) {
|
||||||
if(shipId && shipId.length > 0) {
|
if (shipId && shipId.length > 0) {
|
||||||
return this.builds[shipId];
|
return this.builds[shipId];
|
||||||
}
|
}
|
||||||
return this.builds;
|
return this.builds;
|
||||||
@@ -362,7 +373,9 @@ export class Persist extends EventEmitter {
|
|||||||
}
|
}
|
||||||
this.comparisons[name] = {
|
this.comparisons[name] = {
|
||||||
facets,
|
facets,
|
||||||
builds: builds.map(b => { return { shipId: b.id || b.shipId, buildName: b.buildName }; })
|
builds: builds.map(b => {
|
||||||
|
return { shipId: b.id || b.shipId, buildName: b.buildName };
|
||||||
|
})
|
||||||
};
|
};
|
||||||
_put(LS_KEY_COMPARISONS, this.comparisons);
|
_put(LS_KEY_COMPARISONS, this.comparisons);
|
||||||
this.emit('comparisons');
|
this.emit('comparisons');
|
||||||
@@ -505,6 +518,7 @@ export class Persist extends EventEmitter {
|
|||||||
_put(LS_KEY_ROLLS, this.matsPerGrade);
|
_put(LS_KEY_ROLLS, this.matsPerGrade);
|
||||||
this.emit('matsPerGrade');
|
this.emit('matsPerGrade');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the saved Mats per grade
|
* Get the saved Mats per grade
|
||||||
* @return {Object} # of rolls per grade
|
* @return {Object} # of rolls per grade
|
||||||
@@ -556,6 +570,7 @@ export class Persist extends EventEmitter {
|
|||||||
this.outfittingTab = tabName;
|
this.outfittingTab = tabName;
|
||||||
_put(LS_KEY_OUTFITTING_TAB, tabName);
|
_put(LS_KEY_OUTFITTING_TAB, tabName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current outfitting tab
|
* Get the current outfitting tab
|
||||||
* @return {string} the current outfitting tab
|
* @return {string} the current outfitting tab
|
||||||
|
|||||||
@@ -2,15 +2,6 @@ console.log('Hello from sw.js');
|
|||||||
|
|
||||||
if (workbox) {
|
if (workbox) {
|
||||||
console.log('Yay! Workbox is loaded 🎉');
|
console.log('Yay! Workbox is loaded 🎉');
|
||||||
workbox.precaching.precacheAndRoute(self.__precacheManifest);
|
|
||||||
|
|
||||||
workbox.routing.registerNavigationRoute('/index.html');
|
|
||||||
|
|
||||||
workbox.routing.registerRoute(
|
|
||||||
new RegExp('/(.*?)'),
|
|
||||||
workbox.strategies.staleWhileRevalidate()
|
|
||||||
);
|
|
||||||
|
|
||||||
workbox.routing.registerRoute(
|
workbox.routing.registerRoute(
|
||||||
new RegExp('https://fonts.(?:googleapis|gstatic).com/(.*)'),
|
new RegExp('https://fonts.(?:googleapis|gstatic).com/(.*)'),
|
||||||
workbox.strategies.cacheFirst({
|
workbox.strategies.cacheFirst({
|
||||||
@@ -49,3 +40,23 @@ self.addEventListener('message', event => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const OFFLINE_URL = '/';
|
||||||
|
self.addEventListener('fetch', function(event) {
|
||||||
|
console.log('Handling fetch event for', event.request.url);
|
||||||
|
|
||||||
|
event.respondWith(
|
||||||
|
caches.match(event.request).then(function(response) {
|
||||||
|
if (response) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetch(event.request)
|
||||||
|
.then(function(response) {
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.catch(function(error) {
|
||||||
|
return caches.match(OFFLINE_URL);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -30,8 +30,6 @@ export const SHIP_FD_NAME_TO_CORIOLIS_NAME = {
|
|||||||
'Hauler': 'hauler',
|
'Hauler': 'hauler',
|
||||||
'Independant_Trader': 'keelback',
|
'Independant_Trader': 'keelback',
|
||||||
'Krait_MkII': 'krait_mkii',
|
'Krait_MkII': 'krait_mkii',
|
||||||
'Mamba': 'mamba',
|
|
||||||
'Krait_Light': 'krait_phantom',
|
|
||||||
'Orca': 'orca',
|
'Orca': 'orca',
|
||||||
'Python': 'python',
|
'Python': 'python',
|
||||||
'SideWinder': 'sidewinder',
|
'SideWinder': 'sidewinder',
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script src="xdLocalStoragePostMessageApi.min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
This is the magical iframe
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -59,7 +59,9 @@
|
|||||||
<!-- End Piwik Code -->
|
<!-- End Piwik Code -->
|
||||||
|
|
||||||
<!-- Bugsnag -->
|
<!-- Bugsnag -->
|
||||||
<script src="https://d2wy8f7a9ursnm.cloudfront.net/v5.0.0/bugsnag.min.js"></script>
|
<script src="//d2wy8f7a9ursnm.cloudfront.net/v4/bugsnag.min.js"></script>
|
||||||
|
<script
|
||||||
|
src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-plugins/v1/bugsnag-react.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.bugsnagClient = bugsnag('ba9fae819372850fb660755341fa6ef5', {appVersion: window.BUGSNAG_VERSION || undefined})
|
window.bugsnagClient = bugsnag('ba9fae819372850fb660755341fa6ef5', {appVersion: window.BUGSNAG_VERSION || undefined})
|
||||||
window.Bugsnag = window.bugsnagClient
|
window.Bugsnag = window.bugsnagClient
|
||||||
|
|||||||
@@ -171,16 +171,3 @@ footer {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.announcement-container {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding-top: 10px;
|
|
||||||
justify-content: center;
|
|
||||||
flex-flow: row wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.announcement {
|
|
||||||
border: 1px @secondary solid;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -22,15 +22,6 @@ select {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.react-fuzzy-search > * {
|
|
||||||
padding: 0 !important;
|
|
||||||
color: @primary;
|
|
||||||
& > input {
|
|
||||||
border: 1px solid @primary !important;
|
|
||||||
color: @primary-bg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.cmdr-select {
|
.cmdr-select {
|
||||||
border: 1px solid @primary;
|
border: 1px solid @primary;
|
||||||
padding: 0.5em 0.5em;
|
padding: 0.5em 0.5em;
|
||||||
|
|||||||
1
src/xdLocalStoragePostMessageApi.min.js
vendored
1
src/xdLocalStoragePostMessageApi.min.js
vendored
@@ -1 +0,0 @@
|
|||||||
"use strict";window.XdUtils=window.XdUtils||function(){function a(a,b){var c,d=b||{};for(c in a)a.hasOwnProperty(c)&&(d[c]=a[c]);return d}return{extend:a}}(),function(){function a(a,b){var c=XdUtils.extend(b,l);c.id=a,parent.postMessage(JSON.stringify(c),"*")}function b(b,c){a(b,{key:c,value:localStorage.getItem(c)})}function c(b,c,d){localStorage.setItem(c,d),a(b,{success:localStorage.getItem(c)===d})}function d(b,c){localStorage.removeItem(c),a(b,{})}function e(b,c){a(b,{key:localStorage.key(c)})}function f(b){a(b,{size:JSON.stringify(localStorage).length})}function g(b){a(b,{length:localStorage.length})}function h(b){localStorage.clear(),a(b,{})}function i(a){var i;try{i=JSON.parse(a.data)}catch(a){}i&&i.namespace===k&&("set"===i.action?c(i.id,i.key,i.value):"get"===i.action?b(i.id,i.key):"remove"===i.action?d(i.id,i.key):"key"===i.action?e(i.id,i.key):"size"===i.action?f(i.id):"length"===i.action?g(i.id):"clear"===i.action&&h(i.id))}function j(){var a={namespace:k,id:"iframe-ready"};parent.postMessage(JSON.stringify(a),"*")}var k="cross-domain-local-message",l={namespace:k};window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent("onmessage",i),j()}();
|
|
||||||
@@ -29,10 +29,17 @@ module.exports = {
|
|||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'build'),
|
path: path.join(__dirname, 'build'),
|
||||||
filename: 'app.js',
|
filename: 'app.js',
|
||||||
|
globalObject: 'this',
|
||||||
publicPath: '/'
|
publicPath: '/'
|
||||||
},
|
},
|
||||||
|
node: {
|
||||||
|
fs: 'empty',
|
||||||
|
net: 'empty',
|
||||||
|
tls: 'empty',
|
||||||
|
'crypto': 'empty'
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CopyWebpackPlugin(['src/.htaccess', 'src/iframe.html', 'src/xdLocalStoragePostMessageApi.min.js']),
|
new CopyWebpackPlugin(['src/.htaccess']),
|
||||||
// new webpack.optimize.CommonsChunkPlugin({
|
// new webpack.optimize.CommonsChunkPlugin({
|
||||||
// name: 'lib',
|
// name: 'lib',
|
||||||
// filename: 'lib.js'
|
// filename: 'lib.js'
|
||||||
@@ -56,8 +63,12 @@ module.exports = {
|
|||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) },
|
{ test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) },
|
||||||
{ test: /\.less$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!less-loader' }) },
|
{
|
||||||
|
test: /\.less$/,
|
||||||
|
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!less-loader' })
|
||||||
|
},
|
||||||
{ test: /\.(js|jsx)$/, loaders: ['babel-loader'], include: path.join(__dirname, 'src') },
|
{ test: /\.(js|jsx)$/, loaders: ['babel-loader'], include: path.join(__dirname, 'src') },
|
||||||
|
{ test: /\.worker\.js$/, use: { loader: 'worker-loader' } },
|
||||||
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
|
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
|
||||||
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
|
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
|
||||||
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream' },
|
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream' },
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
const { InjectManifest } = require('workbox-webpack-plugin');
|
const { InjectManifest } = require('workbox-webpack-plugin');
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const { BugsnagSourceMapUploaderPlugin, BugsnagBuildReporterPlugin } = require('webpack-bugsnag-plugins');
|
const { BugsnagSourceMapUploaderPlugin } = require('webpack-bugsnag-plugins');
|
||||||
const pkgJson = require('./package');
|
const pkgJson = require('./package');
|
||||||
const buildDate = new Date();
|
const buildDate = new Date();
|
||||||
|
|
||||||
@@ -22,6 +22,7 @@ module.exports = {
|
|||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
globalObject: 'this'
|
globalObject: 'this'
|
||||||
},
|
},
|
||||||
|
node: { fs: 'empty' },
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: true,
|
minimize: true,
|
||||||
@@ -30,7 +31,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CopyWebpackPlugin(['src/.htaccess', { from: 'src/schemas', to: 'schemas' }, {from: 'src/images/logo/*', flatten: true, to: ''}, 'src/iframe.html', 'src/xdLocalStoragePostMessageApi.min.js']),
|
new CopyWebpackPlugin(['src/.htaccess', { from: 'src/schemas', to: 'schemas' }, {from: 'src/images/logo/*', flatten: true, to: ''}]),
|
||||||
// new webpack.optimize.CommonsChunkPlugin({
|
// new webpack.optimize.CommonsChunkPlugin({
|
||||||
// name: 'lib',
|
// name: 'lib',
|
||||||
// filename: 'lib.[chunkhash:6].js'
|
// filename: 'lib.[chunkhash:6].js'
|
||||||
@@ -48,23 +49,19 @@ module.exports = {
|
|||||||
disable: false,
|
disable: false,
|
||||||
allChunks: true
|
allChunks: true
|
||||||
}),
|
}),
|
||||||
new BugsnagBuildReporterPlugin({
|
// new BugsnagSourceMapUploaderPlugin({
|
||||||
apiKey: 'ba9fae819372850fb660755341fa6ef5',
|
// apiKey: 'ba9fae819372850fb660755341fa6ef5',
|
||||||
appVersion: `${pkgJson.version}-${buildDate.toISOString()}`
|
// appVersion: `${pkgJson.version}-${buildDate.toISOString()}`
|
||||||
}, { /* opts */ }),
|
// }),
|
||||||
new BugsnagSourceMapUploaderPlugin({
|
|
||||||
apiKey: 'ba9fae819372850fb660755341fa6ef5',
|
|
||||||
overwrite: true,
|
|
||||||
appVersion: `${pkgJson.version}-${buildDate.toISOString()}`
|
|
||||||
}),
|
|
||||||
new InjectManifest({
|
new InjectManifest({
|
||||||
swSrc: './src/sw.js',
|
swSrc: './src/app/sw.js',
|
||||||
importWorkboxFrom: 'cdn',
|
importWorkboxFrom: 'cdn',
|
||||||
swDest: 'service-worker.js'
|
swDest: 'service-worker.js'
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
{test: /\.worker\.js$/, use: {loader: 'worker-loader'}},
|
||||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) },
|
{ test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }) },
|
||||||
{ test: /\.less$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!less-loader' }) },
|
{ test: /\.less$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!less-loader' }) },
|
||||||
{ test: /\.(js|jsx)$/, loader: 'babel-loader?cacheDirectory=true', include: path.join(__dirname, 'src') },
|
{ test: /\.(js|jsx)$/, loader: 'babel-loader?cacheDirectory=true', include: path.join(__dirname, 'src') },
|
||||||
|
|||||||
Reference in New Issue
Block a user