mirror of
https://github.com/owncast/owncast.git
synced 2024-11-26 06:46:01 +03:00
Merge pull request #6 from owncast/gek/viewers-page-fixes
Admin viewers page fixes
This commit is contained in:
commit
d944eeff9f
2 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { LineChart } from 'react-chartkick'
|
import { LineChart } from 'react-chartkick'
|
||||||
import styles from '../../styles/styles.module.scss';
|
import styles from '../../styles/styles.module.scss';
|
||||||
import 'chart.js';
|
import 'chart.js';
|
||||||
|
import format from 'date-fns/format'
|
||||||
|
|
||||||
interface TimedValue {
|
interface TimedValue {
|
||||||
time: Date;
|
time: Date;
|
||||||
|
@ -19,7 +20,7 @@ function createGraphDataset(dataArray) {
|
||||||
const dataValues = {};
|
const dataValues = {};
|
||||||
dataArray.forEach(item => {
|
dataArray.forEach(item => {
|
||||||
const dateObject = new Date(item.time);
|
const dateObject = new Date(item.time);
|
||||||
const dateString = `${dateObject.getFullYear() }-${ dateObject.getMonth() }-${ dateObject.getDay() } ${ dateObject.getHours() }:${ dateObject.getMinutes()}`;
|
const dateString = format(dateObject, 'p P');
|
||||||
dataValues[dateString] = item.value;
|
dataValues[dateString] = item.value;
|
||||||
})
|
})
|
||||||
return dataValues;
|
return dataValues;
|
||||||
|
|
|
@ -120,7 +120,7 @@ export default function ViewersOverTime() {
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
<Chart title="Viewers" data={viewerInfo} color="#2087E2" unit="" />
|
<Chart title="Viewers" data={viewerInfo} color="#2087E2" unit="" />
|
||||||
<Table dataSource={clients} columns={columns} rowKey={(row) => row.userAgent} />
|
<Table dataSource={clients} columns={columns} rowKey={(row) => row.clientID} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue