Skip to content

Commit

Permalink
Add dedicated About page
Browse files Browse the repository at this point in the history
  • Loading branch information
iaincollins committed Sep 5, 2024
1 parent 9582057 commit 21c9756
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 59 deletions.
77 changes: 24 additions & 53 deletions components/dialog/about-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,35 @@ export default ({ toggle }) => {
[ API v{version.version} ]
</a>}
{' '}
for <a href='https://www.elitedangerous.com/' rel='noreferrer' target='_blank'>Elite Dangerous</a>.
for <a href='https://www.elitedangerous.com/' rel='noreferrer' target='_blank'>Elite Dangerous</a>.
</p>
{stats &&
<>
<p>
Processed {stats.updatedInLast24Hours.toLocaleString()} updates in the last 24 hours.
</p>
<p>
Processed {stats.updatedInLast24Hours.toLocaleString()} updates in the last 24 hours.
</p>
<ul className='clear'>
<li>
Star systems: {stats.systems.toLocaleString()}
</li>
<li>
Stations &amp; settlements: {stats.stations.stations.toLocaleString()}
</li>
<li>
Fleet Carriers: {stats.stations.carriers.toLocaleString()}
</li>
<li>
Trade orders: {stats.trade.tradeOrders.toLocaleString()}
</li>
<li>
Trade markets: {(stats.trade.stations + stats.trade.carriers).toLocaleString()}
</li>
<li>
Trade systems: {stats.trade.systems.toLocaleString()}
</li>
<li>
Points of interest: {stats.pointsOfInterest.toLocaleString()}
</li>
Star systems: {stats.systems.toLocaleString()}
</li>
<li>
Stations/settlements: {stats.stations.stations.toLocaleString()}
</li>
<li>
Fleet carriers: {stats.stations.carriers.toLocaleString()}
</li>
<li>
Trade orders: {stats.trade.tradeOrders.toLocaleString()}
</li>
<li>
Trade markets: {(stats.trade.stations + stats.trade.carriers).toLocaleString()}
</li>
<li>
Trade systems: {stats.trade.systems.toLocaleString()}
</li>
<li>
Points of interest: {stats.pointsOfInterest.toLocaleString()}
</li>
</ul>
</>}
<p>
Expand All @@ -78,30 +78,6 @@ export default ({ toggle }) => {
<span className='muted'> | </span>
<a href='/downloads' rel='noreferrer' target='_blank'>Download Data</a>
</p>


{/* ? 'Locations:\n' +
`* Star systems: ${stats.systems.toLocaleString()}\n` +
`* Points of interest: ${stats.pointsOfInterest.toLocaleString()}\n` +
'Stations:\n' +
`* Stations: ${stats.stations.stations.toLocaleString()}\n` +
`* Fleet Carriers: ${stats.stations.carriers.toLocaleString()}\n` +
`* Station updates in last hour: ${stats.stations.updatedInLastHour.toLocaleString()}\n` +
`* Station updates in last 24 hours: ${stats.stations.updatedInLast24Hours.toLocaleString()}\n` +
`* Station updates in last 7 days: ${stats.stations.updatedInLast7Days.toLocaleString()}\n` +
`* Station updates in last 30 days: ${stats.stations.updatedInLast30Days.toLocaleString()}\n` +
'Trade:\n' +
`* Station Markets: ${stats.trade.stations.toLocaleString()}\n` +
`* Fleet Carrier Markets: ${stats.trade.carriers.toLocaleString()}\n` +
`* Trade systems: ${stats.trade.systems.toLocaleString()}\n` +
`* Trade orders: ${stats.trade.tradeOrders.toLocaleString()}\n` +
`* Trade updates in last hour: ${stats.trade.updatedInLastHour.toLocaleString()}\n` +
`* Trade updates in last 24 hours: ${stats.trade.updatedInLast24Hours.toLocaleString()}\n` +
`* Trade updates in last 7 days: ${stats.trade.updatedInLast7Days.toLocaleString()}\n` +
`* Trade updates in last 30 days: ${stats.trade.updatedInLast30Days.toLocaleString()}\n` +
`* Unique commodities: ${stats.trade.uniqueCommodities.toLocaleString()}\n` +
`Stats last updated: ${stats.timestamp}\nStats updated every 15 minutes.`
: 'Stats not generated yet') */}
<h3>Legal</h3>
<p className='clear'>
Released under GNU Affero General Public License.
Expand All @@ -111,11 +87,6 @@ export default ({ toggle }) => {
not endorsed by nor reflects the views or opinions of Frontier Developments and
no employee of Frontier Developments was involved in the making of it.
</p>
{/*
<pre>
{JSON.stringify(stats, 0, 2)}
</pre>
*/}
</Dialog>
)
}
7 changes: 4 additions & 3 deletions lib/consts.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const API_BASE_URL_PROD = 'https://api.ardent-industry.com'
const API_BASE_URL_LOCAL = 'http://localhost:3001/api'
const API_BASE_URL = API_BASE_URL_PROD

const API_BASE_URL = process?.env?.NODE_ENV === 'development'
? API_BASE_URL_LOCAL
: API_BASE_URL_PROD

const SOL_COORDINATES = [0, 0, 0]
const COLONIA_COORDINATES = [-9530.5, -910.28125, 19808.125]

module.exports = {
API_BASE_URL,
API_BASE_URL_PROD,
API_BASE_URL_LOCAL,
SOL_COORDINATES,
COLONIA_COORDINATES
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.38.10",
"version": "0.38.11",
"description": "Ardent Industry",
"main": "index.js",
"scripts": {
Expand Down
107 changes: 107 additions & 0 deletions pages/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { useState, useEffect } from 'react'
import Link from 'next/link'
import Layout from 'components/layout'
import { API_BASE_URL } from 'lib/consts'

import Package from 'package.json'
import Dialog from 'components/dialog'


export default () => {
const [stats, setStats] = useState()
const [version, setVersion] = useState()

useEffect(() => {
(async () => {
const res = await fetch(`${API_BASE_URL}/v1/stats`)
const stats = await res.json()
setStats(stats)
})()
;(async () => {
const res = await fetch(`${API_BASE_URL}/v1/version`)
const version = await res.json()
setVersion(version)
})()
}, [])


const [backupData, setBackupData] = useState()

useEffect(() => {
(async () => {
//const res = await fetch(`${API_BASE_URL}/v1/backup`)
//setBackupData(await res.json())
})()
}, [])
return (
<Layout>
<div className='fx__fade-in'>
<h1 className='heading--with-icon'>
About
</h1>
<p className='clear'>
Ardent Industry is companion software for <a href='https://www.elitedangerous.com/' rel='noreferrer' target='_blank'>Elite Dangerous</a>.
</p>
<p>
ArdentOS v{Package.version}
{' '}
{version &&
<a style={{ textTransform: 'none' }} href={API_BASE_URL} rel='noreferrer' target='_blank' className='muted'>
[ API v{version.version} ]
</a>}
</p>
{stats &&
<>
<p>
Processed {stats.updatedInLast24Hours.toLocaleString()} updates in the last 24 hours.
</p>
<ul className='clear'>
<li>
Star systems: {stats.systems.toLocaleString()}
</li>
<li>
Stations/settlements: {stats.stations.stations.toLocaleString()}
</li>
<li>
Fleet carriers: {stats.stations.carriers.toLocaleString()}
</li>
<li>
Trade orders: {stats.trade.tradeOrders.toLocaleString()}
</li>
<li>
Trade markets: {(stats.trade.stations + stats.trade.carriers).toLocaleString()}
</li>
<li>
Trade systems: {stats.trade.systems.toLocaleString()}
</li>
<li>
Points of interest: {stats.pointsOfInterest.toLocaleString()}
</li>
</ul>
</>}
<p>
Data from <a href='https://eddn.edcd.io' rel='noreferrer' target='_blank'>EDDN</a>, which is run by <a href='https://edcd.github.io/' rel='noreferrer' target='_blank'>EDCD</a>.
</p>
<h3>Downloads</h3>
<p className='clear'>
Both the source for the software and the raw data for Ardent Industry are available for download.
</p>
<ul>
<li><a href='https://github.com/iaincollins/ardent-www' rel='noreferrer' target='_blank'>ArdentOS</a></li>
<li><a href='https://github.com/iaincollins/ardent-api' rel='noreferrer' target='_blank'>Ardent API</a></li>
<li><a href='https://github.com/iaincollins/ardent-collector' rel='noreferrer' target='_blank'>Ardent Collector</a></li>
<li><a href='/downloads' rel='noreferrer' target='_blank'>Download Data</a></li>
</ul>
<h3>Legal</h3>
<p className='clear'>
Released under GNU Affero General Public License.
</p>
<p>
Elite Dangerous is copyright Frontier Developments plc. This software is
not endorsed by nor reflects the views or opinions of Frontier Developments and
no employee of Frontier Developments was involved in the making of it.
</p>
</div>
</Layout>
)
}

0 comments on commit 21c9756

Please sign in to comment.