33import type { ColumnDef } from "@tanstack/react-table" ;
44import type { ReactNode } from "react" ;
55
6- import React , { useMemo , useState } from "react" ;
6+ import { useMemo , useState } from "react" ;
77import Link from "next/link" ;
88import { usePathname } from "next/navigation" ;
99
10- import type { ActionInstances , PubTypes , Stages } from "db/public" ;
10+ import type { ProcessedPubWithForm } from "contracts" ;
11+ import type { PubTypes , Stages } from "db/public" ;
1112import { Badge } from "ui/badge" ;
1213import { Button } from "ui/button" ;
1314import { Checkbox } from "ui/checkbox" ;
1415import { DataTableColumnHeader } from "ui/data-table" ;
1516
16- import type { PageContext } from "~/app/components/ActionUI/PubsRunActionDropDownMenu" ;
17- import type { FullProcessedPub } from "~/lib/server/pub" ;
18- import { PubsRunActionDropDownMenu } from "~/app/components/ActionUI/PubsRunActionDropDownMenu" ;
1917import { DataTable } from "~/app/components/DataTable/DataTable" ;
2018import { dateFormatOptions } from "~/lib/dates" ;
2119import { getPubTitle } from "~/lib/pubs" ;
@@ -95,14 +93,29 @@ const getRelatedPubsColumns = (relatedPubActionsDropdowns: Record<string, ReactN
9593 return relatedPubActionsDropdowns [ row . original . id ] ;
9694 } ,
9795 } ,
98- ] as const satisfies ColumnDef < FullProcessedPub , unknown > [ ] ;
96+ ] as const satisfies ColumnDef <
97+ ProcessedPubWithForm < {
98+ withRelatedPubs : true ;
99+ withStage : true ;
100+ withPubType : true ;
101+ withMembers : true ;
102+ withStageActionInstances : true ;
103+ } > ,
104+ unknown
105+ > [ ] ;
99106} ;
100107
101108const Table = ( {
102109 pubs,
103110 relatedPubActionsDropdowns,
104111} : {
105- pubs : FullProcessedPub [ ] ;
112+ pubs : ProcessedPubWithForm < {
113+ withRelatedPubs : true ;
114+ withStage : true ;
115+ withPubType : true ;
116+ withMembers : true ;
117+ withStageActionInstances : true ;
118+ } > [ ] ;
106119 relatedPubActionsDropdowns : Record < string , ReactNode > ;
107120} ) => {
108121 const columns = getRelatedPubsColumns ( relatedPubActionsDropdowns ) ;
@@ -114,11 +127,29 @@ export const RelatedPubsTable = ({
114127 pub,
115128 relatedPubActionsDropdowns,
116129} : {
117- pub : FullProcessedPub ;
130+ pub : ProcessedPubWithForm < {
131+ withRelatedPubs : true ;
132+ withStage : true ;
133+ withPubType : true ;
134+ withMembers : true ;
135+ withStageActionInstances : true ;
136+ } > ;
118137 relatedPubActionsDropdowns : Record < string , ReactNode > ;
119138} ) => {
120139 const groupedBySlug = useMemo ( ( ) => {
121- const grouped : Record < string , { pub : FullProcessedPub ; fieldName : string } [ ] > = { } ;
140+ const grouped : Record <
141+ string ,
142+ {
143+ pub : ProcessedPubWithForm < {
144+ withRelatedPubs : true ;
145+ withStage : true ;
146+ withPubType : true ;
147+ withMembers : true ;
148+ withStageActionInstances : true ;
149+ } > ;
150+ fieldName : string ;
151+ } [ ]
152+ > = { } ;
122153 for ( const value of pub . values ) {
123154 const { relatedPub, fieldSlug, fieldName } = value ;
124155 if ( relatedPub ) {
0 commit comments