<commit_before>import React from 'react';

import { Alert, Col, Grid, Row } from 'react-bootstrap';

import Navigation from 'components/Navigation';
import CurrentReadingsService from 'services/CurrentReadingsService';
import FormattingService from 'services/FormattingService';

const currentReadingsService = new CurrentReadingsService();
const formattingService = new FormattingService();

class CurrentReadingsPage extends React.Component {
    constructor() {
        super();
        this.state = {};
    }

    componentDidMount() {
        currentReadingsService.connect((data) => {
            this.setState({
                currentReading: data,
            });
        });
    }

    componentWillUnmount() {
        currentReadingsService.disconnect();
    }

    renderLastUpdated() {
        const consumption = this.state.currentReading.consumption;
        const production = this.state.currentReading.production;
        return (<Grid>
            <Row>
                <Col><strong>Last updated:</strong></Col>
                <Col>{ formattingService.formatDateFull(this.state.currentReading.ts) }</Col>
            </Row>
            <Row>
                <Col><strong>Current consumption:</strong></Col>
                <Col>{ formattingService.formatNumberPower(consumption) }</Col>
            </Row>
            <Row>
                <Col><strong>Current production:</strong></Col>
                <Col>{ formattingService.formatNumberPower(production) }</Col>
            </Row>
            <Row>
                <Col><strong>Current tariff:</strong></Col>
                <Col>{ this.state.currentReading.tariff === '0001' ? 'Low' : 'Normal' }</Col>
            </Row>
        </Grid>);
    }

    render() {
        const noDataWarning = (<Alert bsStyle="warning">
            <strong>No data received yet</strong>
            <span>&nbsp;Please wait, it should not take more than 10 seconds.</span>
        </Alert>);

        return (
            <div>
                <Navigation activePage="current" />

                { this.state.currentReading ? this.renderLastUpdated() : noDataWarning }
            </div>
        );
    }
}
<commit_msg>Display current readings in a tabular form on bigger screens<commit_after>import React from 'react';

import { Alert, Col, Grid, Row } from 'react-bootstrap';

import Navigation from 'components/Navigation';
import CurrentReadingsService from 'services/CurrentReadingsService';
import FormattingService from 'services/FormattingService';

const currentReadingsService = new CurrentReadingsService();
const formattingService = new FormattingService();

class CurrentReadingsPage extends React.Component {
    constructor() {
        super();
        this.state = {};
    }

    componentDidMount() {
        currentReadingsService.connect((data) => {
            this.setState({
                currentReading: data,
            });
        });
    }

    componentWillUnmount() {
        currentReadingsService.disconnect();
    }

    renderLastUpdated() {
        const consumption = this.state.currentReading.consumption;
        const production = this.state.currentReading.production;
        return (<Grid>
            <Row>
                <Col lg={ 6 }><strong>Last updated:</strong></Col>
                <Col lg={ 6 }>{ formattingService.formatDateFull(this.state.currentReading.ts) }</Col>
            </Row>
            <Row>
                <Col lg={ 6 }><strong>Electricity consumption:</strong></Col>
                <Col lg={ 6 }>{ formattingService.formatNumberPower(consumption) }</Col>
            </Row>
            <Row>
                <Col lg={ 6 }><strong>Electricity production:</strong></Col>
                <Col lg={ 6 }>{ formattingService.formatNumberPower(production) }</Col>
            </Row>
            <Row>
                <Col lg={ 6 }><strong>Current tariff:</strong></Col>
                <Col lg={ 6 }>{ this.state.currentReading.tariff === '0001' ? 'Low' : 'Normal' }</Col>
            </Row>
        </Grid>);
    }

    render() {
        const noDataWarning = (<Alert bsStyle="warning">
            <strong>No data received yet</strong>
            <span>&nbsp;Please wait, it should not take more than 10 seconds.</span>
        </Alert>);

        return (
            <div>
                <Navigation activePage="current" />

                { this.state.currentReading ? this.renderLastUpdated() : noDataWarning }
            </div>
        );
    }
}

{'fraction_non_alphanumeric': 0.12731740004467276, 'fraction_numerical': 0.004467277194549922, 'mean_word_length': 2.1358543417366946, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1870965', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1134, 'n_words': 257}