-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathReportingPeriodsCell.tsx
45 lines (38 loc) · 1.04 KB
/
ReportingPeriodsCell.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import type { FindReportingPeriods } from 'types/graphql'
import { Link, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import ReportingPeriods from 'src/components/ReportingPeriod/ReportingPeriods'
export const QUERY = gql`
query FindReportingPeriods {
reportingPeriods {
id
name
startDate
endDate
organizationId
inputTemplateId
outputTemplateId
createdAt
updatedAt
}
}
`
export const Loading = () => <div>Loading...</div>
export const Empty = () => {
return (
<div className="rw-text-center">
{'No reportingPeriods yet. '}
<Link to={routes.newReportingPeriod()} className="rw-link">
{'Create one?'}
</Link>
</div>
)
}
export const Failure = ({ error }: CellFailureProps) => (
<div className="rw-cell-error">{error?.message}</div>
)
export const Success = ({
reportingPeriods,
}: CellSuccessProps<FindReportingPeriods>) => {
return <ReportingPeriods reportingPeriods={reportingPeriods} />
}