From 4f53d759997e7def6f7904f3b0a4bfe46b69a176 Mon Sep 17 00:00:00 2001 From: Greg Matthews Date: Sat, 11 Nov 2017 13:23:09 -0800 Subject: [PATCH 1/5] Fix whitespace in html --- src/app/pages/ShipyardPage.jsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/pages/ShipyardPage.jsx b/src/app/pages/ShipyardPage.jsx index 8ef8f8e4..b5060d3c 100644 --- a/src/app/pages/ShipyardPage.jsx +++ b/src/app/pages/ShipyardPage.jsx @@ -316,16 +316,16 @@ export default class ShipyardPage extends Page { {translate('internal compartments')} - {units.CR} - {units.T} - {units['m/s']} - {units['m/s']} -   - {units.MJ} - {units['m/s']} - {units['m/s']} - {units.LY} - {units.T} + {units.CR} + {units.T} + {units['m/s']} + {units['m/s']} +   + {units.MJ} + {units['m/s']} + {units['m/s']} + {units.LY} + {units.T} {'pp'} {'th'} {'fsd'} From e19688e96fa44d848f6df0d96977300c615441ee Mon Sep 17 00:00:00 2001 From: Greg Matthews Date: Sat, 11 Nov 2017 13:23:42 -0800 Subject: [PATCH 2/5] Add alternate row highlighting for sorted value --- src/app/pages/ShipyardPage.jsx | 22 ++++++++++++++++++---- src/less/colors.less | 1 + src/less/table.less | 4 ++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/app/pages/ShipyardPage.jsx b/src/app/pages/ShipyardPage.jsx index b5060d3c..20359dba 100644 --- a/src/app/pages/ShipyardPage.jsx +++ b/src/app/pages/ShipyardPage.jsx @@ -139,15 +139,16 @@ export default class ShipyardPage extends Page { * @param {Object} u Localized unit map * @param {Function} fInt Localized integer formatter * @param {Function} fRound Localized round formatter + * @param {Boolean} highlight Should this row be highlighted * @return {React.Component} Table Row */ - _shipRowElement(s, translate, u, fInt, fRound) { + _shipRowElement(s, translate, u, fInt, fRound, highlight) { let noTouch = this.context.noTouch; return {s.manufacturer} @@ -246,13 +247,26 @@ export default class ShipyardPage extends Page { let shipRows = new Array(shipSummaries.length); let detailRows = new Array(shipSummaries.length); + let sortValue = null; + let backgroundHighlight = false; + for (let s of shipSummaries) { - detailRows[i] = this._shipRowElement(s, translate, units, fInt, formats.f1); + let tmpSortValue = s[shipPredicate]; + if( shipPredicateIndex != undefined ) { + tmpSortValue = tmpSortValue[shipPredicateIndex]; + } + + if( tmpSortValue != sortValue ) { + backgroundHighlight = !backgroundHighlight; + sortValue = tmpSortValue; + } + + detailRows[i] = this._shipRowElement(s, translate, units, fInt, formats.f1, backgroundHighlight); shipRows[i] = ( {s.name} diff --git a/src/less/colors.less b/src/less/colors.less index 4814e724..2a18f6de 100755 --- a/src/less/colors.less +++ b/src/less/colors.less @@ -18,6 +18,7 @@ @bg: rgba(30,30,30,1); @bgBlack: #000; @primary-bg: fadeout(darken(@primary, 47%), 15%); +@alt-primary-bg: fadeout(darken(@primary, 42%), 15%); // Lighter brown background @secondary-bg: fadeout(darken(@secondary, @bgDarken), @bgTransparency); // Brown background @warning-bg: fadeout(darken(@warning, @bgDarken), @bgTransparency); // Dark Red diff --git a/src/less/table.less b/src/less/table.less index 93f6f8e3..1cce0319 100755 --- a/src/less/table.less +++ b/src/less/table.less @@ -54,6 +54,10 @@ tbody tr { .no-touch &.highlight:hover, .no-touch &.highlighted { background-color: @warning-bg; } + + &.alt { + background-color: @alt-primary-bg; + } } td { From 54ddb0d0148cb5b897e2a7c1404bd837149158f4 Mon Sep 17 00:00:00 2001 From: Greg Matthews Date: Sat, 11 Nov 2017 13:29:59 -0800 Subject: [PATCH 3/5] Rename sortValue and tmpSortValue to be more meaningful --- src/app/pages/ShipyardPage.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/pages/ShipyardPage.jsx b/src/app/pages/ShipyardPage.jsx index 20359dba..74404f45 100644 --- a/src/app/pages/ShipyardPage.jsx +++ b/src/app/pages/ShipyardPage.jsx @@ -247,18 +247,18 @@ export default class ShipyardPage extends Page { let shipRows = new Array(shipSummaries.length); let detailRows = new Array(shipSummaries.length); - let sortValue = null; + let lastShipSortValue = null; let backgroundHighlight = false; for (let s of shipSummaries) { - let tmpSortValue = s[shipPredicate]; + let shipSortValue = s[shipPredicate]; if( shipPredicateIndex != undefined ) { - tmpSortValue = tmpSortValue[shipPredicateIndex]; + shipSortValue = shipSortValue[shipPredicateIndex]; } - if( tmpSortValue != sortValue ) { + if( shipSortValue != lastShipSortValue ) { backgroundHighlight = !backgroundHighlight; - sortValue = tmpSortValue; + lastShipSortValue = shipSortValue; } detailRows[i] = this._shipRowElement(s, translate, units, fInt, formats.f1, backgroundHighlight); From 4ed167de2215bb5d6c79d98f2e7a674456be101a Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 23 Dec 2017 12:03:21 +0000 Subject: [PATCH 4/5] Add T10 --- src/app/utils/CompanionApiUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/utils/CompanionApiUtils.js b/src/app/utils/CompanionApiUtils.js index 036cfd36..664a93ed 100644 --- a/src/app/utils/CompanionApiUtils.js +++ b/src/app/utils/CompanionApiUtils.js @@ -35,6 +35,7 @@ const SHIP_FD_NAME_TO_CORIOLIS_NAME = { 'Type6': 'type_6_transporter', 'Type7': 'type_7_transport', 'Type9': 'type_9_heavy', + 'Type10': 'type_10_defender', 'Viper': 'viper', 'Viper_MkIV': 'viper_mk_iv', 'Vulture': 'vulture' From 3cc422596f5166752138aaaedf6ea3c77cfbf91b Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 24 Dec 2017 09:46:49 +0000 Subject: [PATCH 5/5] Something something consistant naming --- src/app/utils/CompanionApiUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/utils/CompanionApiUtils.js b/src/app/utils/CompanionApiUtils.js index 664a93ed..9072c2ba 100644 --- a/src/app/utils/CompanionApiUtils.js +++ b/src/app/utils/CompanionApiUtils.js @@ -35,7 +35,7 @@ const SHIP_FD_NAME_TO_CORIOLIS_NAME = { 'Type6': 'type_6_transporter', 'Type7': 'type_7_transport', 'Type9': 'type_9_heavy', - 'Type10': 'type_10_defender', + 'Type9_Military': 'type_10_defender', 'Viper': 'viper', 'Viper_MkIV': 'viper_mk_iv', 'Vulture': 'vulture'