New bodies are added to UI when scanned!

This commit is contained in:
punkfairie 2023-05-09 16:13:27 -07:00
parent 9d5042cc05
commit 8b190c8054
2 changed files with 12 additions and 2 deletions

View file

@ -69,6 +69,7 @@ journal.once('INIT_COMPLETE', () => {
if (journal.location.bodies.length > 0) {
journal.location.bodies.forEach((body) => {
const row = createBodyRow(body)
// TODO APPRAISAL DATA
$('#lowValueScans').appendChild(row)
})
}
@ -91,8 +92,17 @@ journal.on('BODY_SCANNED', (body, DSS) => {
if (DSS) {
const bodyRow = $(`#${body.BodyID}`)
if (bodyRow.length > 0) {
if (bodyRow.length > 0) { // check just in case body was missed in earlier scans
bodyRow.removeClass('highlighted uncharted').addClass('charted')
} else {
const row = createBodyRow(body)
// TODO APPRAISAL DATA
$('#lowValueScans').appendChild(row)
}
} else { // else it's an FSS/auto scan and won't be in the list yet
const row = createBodyRow(body)
// TODO APPRAISAL DATA
$('#lowValueScans').appendChild(row)
}
})

View file

@ -44,7 +44,7 @@ const buildRings = (body) => {
/* --------------------------------------------------------------------------- createBodyRow ---- */
export const createBodyRow = (body) => {
const chartedStyle = body.WasDiscovered ? 'charted' : 'uncharted'
const chartedStyle = body.WasDiscovered && !body.DSSDone ? 'charted' : 'uncharted'
const row = $('<div>').addClass('row ms-1 me-1')
row.attr('id', body.bodyID)