1import CircularProgress from '@material-ui/core/CircularProgress';
2import React from 'react';
3
4import Timeline from './Timeline';
5import { useTimelineQuery } from './TimelineQuery.generated';
6
7type Props = {
8 id: string;
9};
10
11const TimelineQuery = ({ id }: Props) => {
12 const { loading, error, data } = useTimelineQuery({
13 variables: {
14 id,
15 first: 100,
16 },
17 });
18
19 if (loading) return <CircularProgress />;
20 if (error) return <p>Error: {error}</p>;
21
22 const nodes = data?.repository?.bug?.timeline.nodes;
23 if (!nodes) {
24 return null;
25 }
26
27 return <Timeline ops={nodes} />;
28};
29
30export default TimelineQuery;