import React from 'react';
import { WorkgroupsPanel } from './WorkgroupsPanel';
import { DecisionSupportFilePanel } from './DecisionSupportFilePanel';
import { Timeline } from '../Timeline';
import { useEvents } from '../../gql/queries/event';

const from = new Date();
from.setDate(from.getDate() - 7);

export function Dashboard() {
  const { events } = useEvents({
    variables: {
      filter: {
        from,
      }
    }
  });

  return (
    <div className="columns">
      <div className="column is-5">
        <div className="box">
          <h3 className="is-size-3 mb-3">Ces 7 derniers jours</h3>
          <Timeline events={events} />
        </div>
      </div>
      <div className="column is-4">
        <DecisionSupportFilePanel />
      </div>
      <div className="column is-3">
        <WorkgroupsPanel />
      </div>
    </div>
  );
}