-
Notifications
You must be signed in to change notification settings - Fork 5
/
ReportingPeriodsCell.tsx
48 lines (41 loc) · 1.12 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
46
47
48
import type { FindReportingPeriodsWithCertification } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import ReportingPeriods from 'src/components/ReportingPeriod/ReportingPeriods'
export const QUERY = gql`
query FindReportingPeriodsWithCertification {
reportingPeriodsWithCertification {
id
name
startDate
endDate
certificationForOrganization {
id
createdAt
certifiedBy {
id
email
}
}
}
organizationOfCurrentUser {
id
preferences
}
}
`
export const Loading = () => <div>Loading...</div>
export const Empty = () => <div>Empty</div>
export const Failure = ({ error }: CellFailureProps) => (
<div style={{ color: 'red' }}>Error: {error?.message}</div>
)
export const Success = ({
reportingPeriodsWithCertification,
organizationOfCurrentUser,
}: CellSuccessProps<FindReportingPeriodsWithCertification>) => {
return (
<ReportingPeriods
reportingPeriods={reportingPeriodsWithCertification}
organizationOfCurrentUser={organizationOfCurrentUser}
/>
)
}