-
Notifications
You must be signed in to change notification settings - Fork 5
/
OutputTemplatesCell.tsx
53 lines (46 loc) · 1.18 KB
/
OutputTemplatesCell.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
49
50
51
52
53
import type {
FindOutputTemplates,
FindOutputTemplatesVariables,
} from 'types/graphql'
import { Link, routes } from '@redwoodjs/router'
import type {
CellSuccessProps,
CellFailureProps,
TypedDocumentNode,
} from '@redwoodjs/web'
import OutputTemplates from 'src/components/OutputTemplate/OutputTemplates'
export const QUERY: TypedDocumentNode<
FindOutputTemplates,
FindOutputTemplatesVariables
> = gql`
query FindOutputTemplates {
outputTemplates {
id
name
version
effectiveDate
rulesGeneratedAt
createdAt
updatedAt
}
}
`
export const Loading = () => <div>Loading...</div>
export const Empty = () => {
return (
<div className="rw-text-center">
{'No outputTemplates yet. '}
<Link to={routes.newOutputTemplate()} className="rw-link">
{'Create one?'}
</Link>
</div>
)
}
export const Failure = ({ error }: CellFailureProps<FindOutputTemplates>) => (
<div className="rw-cell-error">{error?.message}</div>
)
export const Success = ({
outputTemplates,
}: CellSuccessProps<FindOutputTemplates, FindOutputTemplatesVariables>) => {
return <OutputTemplates outputTemplates={outputTemplates} />
}