Generate List Page from graphql query and with urql graphql client
jozef-slezak opened this issue · comments
Goal: we are going to automatize iteria-app/material-ui-starter#9 using code generation
API
we allready have facade codegen/index.ts
- please revisit following function and let me know what do you propose to tweak:
generatePages()
Template
- Create simplified *.tsx template and apply refactoring rules based on https://github.com/iteria-app/example-material-ui/tree/main/src/views/customer/CustomerListView (no need to generate many files, one file could be good enough for this issue)
- generated file
<prefix>-list.tsx
displays query response with following technical requirements: - apply refactoring rule (lets disscuss: grep all incase sensitive
customer
and than replace by preserging "camel case").
GraphQL Client
- graphql query string prefixed with macro
gql
- urql graphql client calling above graphql query string by calling generated hook (for exaumple
useSearchCustomersQuery
https://github.com/iteria-app/example-material-ui/blob/530d46dd12c06561409383b63be593ef6a957660/src/views/customer/CustomerListView/index.tsx#L26)
Data Table
- query response displayed using
DataTable
react component (codegen
from@iteria-app/react-lowcode
is already generating this code #45