mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Merge branch 'feature/#112_ship_table_highlights' into develop
This commit is contained in:
@@ -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 <tr
|
||||
key={s.id}
|
||||
style={{ height: '1.5em' }}
|
||||
className={cn({ highlighted: noTouch && this.state.shipId === s.id })}
|
||||
className={cn({ highlighted: noTouch && this.state.shipId === s.id, alt: highlight })}
|
||||
onMouseEnter={noTouch && this._highlightShip.bind(this, s.id)}
|
||||
>
|
||||
<td className='ri'>{s.manufacturer}</td>
|
||||
@@ -246,13 +247,26 @@ export default class ShipyardPage extends Page {
|
||||
let shipRows = new Array(shipSummaries.length);
|
||||
let detailRows = new Array(shipSummaries.length);
|
||||
|
||||
let lastShipSortValue = null;
|
||||
let backgroundHighlight = false;
|
||||
|
||||
for (let s of shipSummaries) {
|
||||
detailRows[i] = this._shipRowElement(s, translate, units, fInt, formats.f1);
|
||||
let shipSortValue = s[shipPredicate];
|
||||
if( shipPredicateIndex != undefined ) {
|
||||
shipSortValue = shipSortValue[shipPredicateIndex];
|
||||
}
|
||||
|
||||
if( shipSortValue != lastShipSortValue ) {
|
||||
backgroundHighlight = !backgroundHighlight;
|
||||
lastShipSortValue = shipSortValue;
|
||||
}
|
||||
|
||||
detailRows[i] = this._shipRowElement(s, translate, units, fInt, formats.f1, backgroundHighlight);
|
||||
shipRows[i] = (
|
||||
<tr
|
||||
key={i}
|
||||
style={{ height: '1.5em' }}
|
||||
className={cn({ highlighted: noTouch && this.state.shipId === s.id })}
|
||||
className={cn({ highlighted: noTouch && this.state.shipId === s.id, alt: backgroundHighlight })}
|
||||
onMouseEnter={noTouch && this._highlightShip.bind(this, s.id)}
|
||||
>
|
||||
<td className='le'><Link href={'/outfit/' + s.id}>{s.name}</Link></td>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -54,6 +54,10 @@ tbody tr {
|
||||
.no-touch &.highlight:hover, .no-touch &.highlighted {
|
||||
background-color: @warning-bg;
|
||||
}
|
||||
|
||||
&.alt {
|
||||
background-color: @alt-primary-bg;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
|
||||
Reference in New Issue
Block a user