Skip to content

Commit

Permalink
Improve system imports/exports
Browse files Browse the repository at this point in the history
Highlight (and sort by) category, number of importers/exporters and filter out where import demand is zero.
  • Loading branch information
iaincollins committed Oct 9, 2024
1 parent a41d6cb commit 35884f6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/system-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ module.exports = async (systemName) => {

return Object.values(exportOrdersGroupedByCommodity)
.sort((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.category.localeCompare(b.category))
}
2 changes: 2 additions & 0 deletions lib/system-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ module.exports = async (systemName) => {
})

return Object.values(importOrdersGroupedByCommodity)
.filter(c => c.totalDemand)
.sort((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.category.localeCompare(b.category))
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ardent-www",
"version": "0.69.0",
"version": "0.70.0",
"description": "Ardent Industry",
"main": "index.js",
"scripts": {
Expand Down
33 changes: 29 additions & 4 deletions pages/system/[system-name]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@ export default () => {
render: (v, r) =>
<>
<i className='icon icarus-terminal-cargo' />{v}<br />
<small>{r.importOrders.length === 1 ? '1 importer ' : `${r.importOrders.length} importers`}</small>
<div className='is-visible-mobile'>
<small style={{ float: 'right' }}>{r.importOrders.length === 1 ? '1 importer ' : `${r.importOrders.length} importers`}</small>
</div>
<small>{r.category}</small>
{r?.consumer === true && <small> | Consumer</small>}
<div className='is-visible-mobile'>
<table className='data-table--mini data-table--compact two-column-table'>
Expand All @@ -440,6 +443,16 @@ export default () => {
</div>
</>
},
{
title: 'Importers',
dataIndex: 'importOrders',
key: 'importOrders',
align: 'center',
width: 100,
className: 'is-hidden-mobile',
render: (v) => <span className='muted'>{v.length === 1 ? '1 ' : `${v.length}`}<i style={{fontSize: '1.25rem', position: 'absolute', top: '1.3rem', marginLeft: '.25rem'}} className='icarus-terminal-settlement muted' /></span>
},

{
title: 'Updated',
dataIndex: 'updatedAt',
Expand All @@ -454,7 +467,7 @@ export default () => {
dataIndex: 'totalDemand',
key: 'totalDemand',
align: 'right',
width: 150,
width: 200,
className: 'is-hidden-mobile no-wrap',
render: (v) => <>{v > 0 ? `${v.toLocaleString()} T` : <small>{NO_DEMAND_TEXT}</small>}</>
},
Expand Down Expand Up @@ -519,7 +532,10 @@ export default () => {
render: (v, r) =>
<>
<i className='icon icarus-terminal-cargo' />{v}<br />
<small>{r.exportOrders.length === 1 ? '1 exporter ' : `${r.exportOrders.length} exporters`}</small>
<div className='is-visible-mobile'>
<small style={{ float: 'right' }}>{r.exportOrders.length === 1 ? '1 exporter ' : `${r.exportOrders.length} exporters`}</small>
</div>
<small>{r.category}</small>
{r?.producer === true && <small> | Producer</small>}
{r?.rare === true && <small> | Rare</small>}
<div className='is-visible-mobile'>
Expand All @@ -541,6 +557,15 @@ export default () => {
</div>
</>
},
{
title: 'Exporters',
dataIndex: 'exportOrders',
key: 'exportOrders',
align: 'center',
width: 100,
className: 'is-hidden-mobile',
render: (v) => <span className='muted'>{v.length === 1 ? '1 ' : `${v.length}`}<i style={{fontSize: '1.25rem', position: 'absolute', top: '1.3rem', marginLeft: '.25rem'}} className='icarus-terminal-settlement muted' /></span>
},
{
title: 'Updated',
dataIndex: 'updatedAt',
Expand All @@ -555,7 +580,7 @@ export default () => {
dataIndex: 'totalStock',
key: 'totalStock',
align: 'right',
width: 150,
width: 200,
className: 'is-hidden-mobile no-wrap',
render: (v) => <>{v.toLocaleString()} T</>
},
Expand Down

0 comments on commit 35884f6

Please sign in to comment.