|
1 | 1 | import { UNKNOWN_VALUE } from '../../../../shared/consts'
|
2 | 2 | import ShipModules from './ship-modules'
|
3 | 3 |
|
4 |
| -export default function ShipModulesPanel ({ ship, selectedModule, setSelectedModule }) { |
| 4 | +export default function ShipModulesPanel ({ ship, selectedModule, setSelectedModule, cmdrStatus }) { |
5 | 5 | if (!ship) return null
|
6 | 6 |
|
7 | 7 | if (ship.type === UNKNOWN_VALUE && ship.name === UNKNOWN_VALUE && ship.ident === UNKNOWN_VALUE) {
|
@@ -39,38 +39,147 @@ export default function ShipModulesPanel ({ ship, selectedModule, setSelectedMod
|
39 | 39 | <label className={(ship.onBoard && ship?.pips?.weapons > 0) ? 'text-primary' : 'text-primary text-muted'}>Weapons</label>
|
40 | 40 | </div>
|
41 | 41 | </div>
|
42 |
| - <table className='ship-panel__ship-stats'> |
43 |
| - <tbody className='text-info'> |
44 |
| - <tr> |
45 |
| - <td> |
46 |
| - <span className='text-muted'>Max jump range</span> |
47 |
| - <span className='value'>{ship.maxJumpRange || '-'} Ly</span> |
48 |
| - </td> |
49 |
| - <td> |
50 |
| - <span className='text-muted'>Fuel (curr/max)</span> |
51 |
| - <span className='value'>{typeof ship?.fuelLevel === 'number' ? ship.fuelLevel : '-'}/{ship.fuelCapacity} T</span> |
52 |
| - </td> |
53 |
| - <td> |
54 |
| - <span className='text-muted'>Cargo (curr/max)</span> |
55 |
| - <span className='value'>{typeof ship?.cargo?.count === 'number' ? ship.cargo.count : '-'}/{ship.cargo.capacity} T</span> |
56 |
| - </td> |
57 |
| - </tr> |
58 |
| - <tr> |
59 |
| - <td> |
60 |
| - <span className='text-muted'>Insurance Rebuy</span> |
61 |
| - <span className='value'>{ship.rebuy ? ship.rebuy.toLocaleString() : '-'} CR</span> |
62 |
| - </td> |
63 |
| - <td> |
64 |
| - <span className='text-muted'>Fuel Reservoir</span> |
65 |
| - <span className='value'>{typeof ship?.fuelReservoir === 'number' ? ship.fuelReservoir : '-'}</span> |
66 |
| - </td> |
67 |
| - <td> |
68 |
| - <span className='text-muted'>Total mass</span> |
69 |
| - <span className='value'>{ship.mass} T</span> |
70 |
| - </td> |
71 |
| - </tr> |
72 |
| - </tbody> |
73 |
| - </table> |
| 42 | + |
| 43 | + <div className='ship-panel--status'> |
| 44 | + <table className='ship-panel__ship-stats'> |
| 45 | + <tbody className='text-info'> |
| 46 | + <tr> |
| 47 | + <td> |
| 48 | + <span className='text-muted'>Max jump range</span> |
| 49 | + <span className='value'>{ship.maxJumpRange || '-'} Ly</span> |
| 50 | + </td> |
| 51 | + <td> |
| 52 | + <span className='text-muted'>Fuel (curr/max)</span> |
| 53 | + <span className='value'>{typeof ship?.fuelLevel === 'number' ? ship.fuelLevel : '-'}/{ship.fuelCapacity} T</span> |
| 54 | + </td> |
| 55 | + <td> |
| 56 | + <span className='text-muted'>Cargo (curr/max)</span> |
| 57 | + <span className='value'>{typeof ship?.cargo?.count === 'number' ? ship.cargo.count : '-'}/{ship.cargo.capacity} T</span> |
| 58 | + </td> |
| 59 | + </tr> |
| 60 | + <tr> |
| 61 | + <td> |
| 62 | + <span className='text-muted'>Insurance Rebuy</span> |
| 63 | + <span className='value'>{ship.rebuy ? ship.rebuy.toLocaleString() : '-'} CR</span> |
| 64 | + </td> |
| 65 | + <td> |
| 66 | + <span className='text-muted'>Fuel Reservoir</span> |
| 67 | + <span className='value'>{typeof ship?.fuelReservoir === 'number' ? ship.fuelReservoir : '-'}</span> |
| 68 | + </td> |
| 69 | + <td> |
| 70 | + <span className='text-muted'>Total mass</span> |
| 71 | + <span className='value'>{ship.mass} T</span> |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + </tbody> |
| 75 | + </table> |
| 76 | + |
| 77 | + <table className='table--layout'> |
| 78 | + <tbody> |
| 79 | + <tr> |
| 80 | + <td> |
| 81 | + <label className='checkbox'> |
| 82 | + <span className='checkbox__text'>Ship Lights</span> |
| 83 | + <input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.lightsOn} /> |
| 84 | + <span class='checkbox__control'/> |
| 85 | + </label> |
| 86 | + </td> |
| 87 | + <td> |
| 88 | + <label className='checkbox'> |
| 89 | + <span className='checkbox__text'>Night Vision</span> |
| 90 | + <input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.nightVision} /> |
| 91 | + <span class='checkbox__control'/> |
| 92 | + </label> |
| 93 | + </td> |
| 94 | + <td> |
| 95 | + <label className='checkbox'> |
| 96 | + <span className='checkbox__text'>Hardpoints</span> |
| 97 | + <input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.hardpointsDeployed} /> |
| 98 | + <span class='checkbox__control'/> |
| 99 | + </label> |
| 100 | + </td> |
| 101 | + <td> |
| 102 | + <label className='checkbox'> |
| 103 | + <span className='checkbox__text'>Landing Gear</span> |
| 104 | + <input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.landingGearDown} /> |
| 105 | + <span class='checkbox__control'/> |
| 106 | + </label> |
| 107 | + </td> |
| 108 | + </tr> |
| 109 | + </tbody> |
| 110 | + </table> |
| 111 | + <table className='table--layout'> |
| 112 | + <tbody> |
| 113 | + <tr> |
| 114 | + <td> |
| 115 | + <span className={ship.onBoard && cmdrStatus?.flags?.overHeating ? 'ship-panel__light--danger' : 'ship-panel__light--off'}> |
| 116 | + <span className='ship-panel__light-text'>Overheating</span> |
| 117 | + </span> |
| 118 | + </td> |
| 119 | + <td> |
| 120 | + <span className={ship.onBoard && cmdrStatus?.flags?.beingInterdicted ? 'ship-panel__light--danger' : 'ship-panel__light--off'}> |
| 121 | + <span className='ship-panel__light-text'>Interdiction Detected</span> |
| 122 | + </span> |
| 123 | + </td> |
| 124 | + <td> |
| 125 | + <span className={ship.onBoard && cmdrStatus?.flags?.lowFuel ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}> |
| 126 | + <span className='ship-panel__light-text'>Fuel Low</span> |
| 127 | + </span> |
| 128 | + </td> |
| 129 | + <td> |
| 130 | + <span className={ship.onBoard && cmdrStatus?.flags?.inDanger ? 'ship-panel__light--danger' : 'ship-panel__light--off'}> |
| 131 | + <span className='ship-panel__light-text'>Danger</span> |
| 132 | + </span> |
| 133 | + </td> |
| 134 | + </tr> |
| 135 | + <tr> |
| 136 | + <td> |
| 137 | + <span className={ship.onBoard && cmdrStatus?.flags?.fsdMassLocked ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}> |
| 138 | + <span className='ship-panel__light-text'>Mass Locked</span> |
| 139 | + </span> |
| 140 | + </td> |
| 141 | + <td> |
| 142 | + <span className={ship.onBoard && cmdrStatus?.flags?.fsdCooldown ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}> |
| 143 | + <span className='ship-panel__light-text'>Frame Shift Cooldown</span> |
| 144 | + </span> |
| 145 | + </td> |
| 146 | + <td> |
| 147 | + <span className={ship.onBoard && cmdrStatus?.flags?.fsdCharging ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}> |
| 148 | + <span className='ship-panel__light-text'>Frame Shift Charging</span> |
| 149 | + </span> |
| 150 | + </td> |
| 151 | + <td> |
| 152 | + <span className={ship.onBoard && cmdrStatus?.flags?.fsdJump ? 'ship-panel__light--danger' : 'ship-panel__light--off'}> |
| 153 | + <span className='ship-panel__light-text'>Frame Shift Jumping</span> |
| 154 | + </span> |
| 155 | + </td> |
| 156 | + </tr> |
| 157 | + <tr> |
| 158 | + <td> |
| 159 | + <span className={ship.onBoard && (cmdrStatus?.flags?.docked || cmdrStatus?.flags?.landed) ? 'ship-panel__light--info' : 'ship-panel__light--off'}> |
| 160 | + <span className='ship-panel__light-text'>Docked</span> |
| 161 | + </span> |
| 162 | + </td> |
| 163 | + <td> |
| 164 | + <span className={ship.onBoard && cmdrStatus?.flags?.supercruise ? 'ship-panel__light--info' : 'ship-panel__light--off'}> |
| 165 | + <span className='ship-panel__light-text'>Supercruise</span> |
| 166 | + </span> |
| 167 | + </td> |
| 168 | + <td> |
| 169 | + <span className={ship.onBoard && cmdrStatus?.flags?.scoopingFuel ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}> |
| 170 | + <span className='ship-panel__light-text'>Fuel Scooping</span> |
| 171 | + </span> |
| 172 | + </td> |
| 173 | + <td> |
| 174 | + <span className={ship.onBoard && cmdrStatus?.flags?.flightAssistOff ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}> |
| 175 | + <span className='ship-panel__light-text'>Flight Assist Off</span> |
| 176 | + </span> |
| 177 | + </td> |
| 178 | + </tr> |
| 179 | + </tbody> |
| 180 | + </table> |
| 181 | + </div> |
| 182 | + |
74 | 183 | <ShipModules
|
75 | 184 | name='Hardpoints'
|
76 | 185 | modules={
|
|
0 commit comments