review-list.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { graphql } from '@/graphql/graphql';
  2. import { DashboardRouteDefinition, DetailPageButton, ListPage } from '@vendure/dashboard';
  3. const getReviewList = graphql(`
  4. query GetProductReviews($options: ProductReviewListOptions) {
  5. productReviews(options: $options) {
  6. items {
  7. id
  8. createdAt
  9. updatedAt
  10. product {
  11. id
  12. name
  13. }
  14. productVariant {
  15. id
  16. name
  17. sku
  18. }
  19. summary
  20. body
  21. rating
  22. authorName
  23. authorLocation
  24. upvotes
  25. downvotes
  26. state
  27. response
  28. responseCreatedAt
  29. }
  30. }
  31. }
  32. `);
  33. export const reviewList: DashboardRouteDefinition = {
  34. navMenuItem: {
  35. sectionId: 'catalog',
  36. id: 'reviews',
  37. url: '/reviews',
  38. title: 'Product Reviews',
  39. },
  40. path: '/reviews',
  41. loader: () => ({
  42. breadcrumb: 'Reviews',
  43. }),
  44. component: route => (
  45. <ListPage
  46. pageId="review-list"
  47. title="Product Reviews"
  48. listQuery={getReviewList}
  49. route={route}
  50. defaultVisibility={{
  51. product: true,
  52. summary: true,
  53. rating: true,
  54. authorName: true,
  55. }}
  56. customizeColumns={{
  57. product: {
  58. header: 'Product',
  59. cell: ({ row }) => {
  60. return <DetailPageButton id={row.original.id} label={row.original.product.name} />;
  61. },
  62. },
  63. }}
  64. />
  65. ),
  66. };