-
Notifications
You must be signed in to change notification settings - Fork 5
/
AgenciesCell.tsx
40 lines (33 loc) · 1011 Bytes
/
AgenciesCell.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
import type { FindAgenciesByOrganizationId } from 'types/graphql'
import { Link, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import Agencies from 'src/components/Agency/Agencies'
export const QUERY = gql`
query FindAgenciesByOrganizationId($organizationId: Int!) {
agenciesByOrganization(organizationId: $organizationId) {
id
name
abbreviation
code
}
}
`
export const Loading = () => <div>Loading...</div>
export const Empty = () => {
return (
<div className="rw-text-center">
{'No agencies yet. '}
<Link to={routes.newAgency()} className="rw-link">
{'Create one?'}
</Link>
</div>
)
}
export const Failure = ({ error }: CellFailureProps) => (
<div className="rw-cell-error">{error?.message}</div>
)
export const Success = ({
agenciesByOrganization,
}: CellSuccessProps<FindAgenciesByOrganizationId>) => {
return <Agencies agencies={agenciesByOrganization} />
}