PageStats.jsx 1.23 KB
Newer Older
1
2
3
import React from "react";
import { compose } from "recompose";
import Typography from "@material-ui/core/Typography";
4
5
import { Line } from "react-chartjs-2";
import alasql from "alasql";
6
7
import { withPaddedPaper } from "./shared";

8
9
10
11
12
13
14
15
16
17
18
const data = [
  { a: 1, b: 1, c: 1 },
  { a: 1, b: 2, c: 1 },
  { a: 1, b: 3, c: 1 },
  { a: 2, b: 1, c: 1 },
];
const res = alasql("SELECT a, COUNT(*) AS c FROM ? GROUP BY a", [data]);

// eslint-disable-next-line no-console
console.log(res);

19
20
21
22
23
24
25
/**
 * Component corresponding to the stats page of the site
 */
function PageStats() {
  return (
    <>
      <Typography variant="h3">Vive les stats</Typography>
26
      <br />
27
      More to come...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
      <Line
        data={{
          labels: [
            "January",
            "February",
            "March",
            "April",
            "May",
            "June",
            "July",
          ],
          datasets: [
            {
              label: "My First dataset",
              backgroundColor: "rgb(255, 99, 132)",
              borderColor: "rgb(255, 99, 132)",
              data: [0, 10, 5, 2, 20, 30, 45],
            },
          ],
        }}
      />
49
50
51
52
53
54
55
    </>
  );
}

PageStats.propTypes = {};

export default compose(withPaddedPaper())(PageStats);