3
3
import type { ColumnDef } from "@tanstack/react-table" ;
4
4
import type { ReactNode } from "react" ;
5
5
6
- import React , { useMemo , useState } from "react" ;
6
+ import { useMemo , useState } from "react" ;
7
7
import Link from "next/link" ;
8
8
import { usePathname } from "next/navigation" ;
9
9
10
- import type { ActionInstances , PubTypes , Stages } from "db/public" ;
10
+ import type { ProcessedPubWithForm } from "contracts" ;
11
+ import type { PubTypes , Stages } from "db/public" ;
11
12
import { Badge } from "ui/badge" ;
12
13
import { Button } from "ui/button" ;
13
14
import { Checkbox } from "ui/checkbox" ;
14
15
import { DataTableColumnHeader } from "ui/data-table" ;
15
16
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" ;
19
17
import { DataTable } from "~/app/components/DataTable/DataTable" ;
20
18
import { dateFormatOptions } from "~/lib/dates" ;
21
19
import { getPubTitle } from "~/lib/pubs" ;
@@ -95,14 +93,29 @@ const getRelatedPubsColumns = (relatedPubActionsDropdowns: Record<string, ReactN
95
93
return relatedPubActionsDropdowns [ row . original . id ] ;
96
94
} ,
97
95
} ,
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
+ > [ ] ;
99
106
} ;
100
107
101
108
const Table = ( {
102
109
pubs,
103
110
relatedPubActionsDropdowns,
104
111
} : {
105
- pubs : FullProcessedPub [ ] ;
112
+ pubs : ProcessedPubWithForm < {
113
+ withRelatedPubs : true ;
114
+ withStage : true ;
115
+ withPubType : true ;
116
+ withMembers : true ;
117
+ withStageActionInstances : true ;
118
+ } > [ ] ;
106
119
relatedPubActionsDropdowns : Record < string , ReactNode > ;
107
120
} ) => {
108
121
const columns = getRelatedPubsColumns ( relatedPubActionsDropdowns ) ;
@@ -114,11 +127,29 @@ export const RelatedPubsTable = ({
114
127
pub,
115
128
relatedPubActionsDropdowns,
116
129
} : {
117
- pub : FullProcessedPub ;
130
+ pub : ProcessedPubWithForm < {
131
+ withRelatedPubs : true ;
132
+ withStage : true ;
133
+ withPubType : true ;
134
+ withMembers : true ;
135
+ withStageActionInstances : true ;
136
+ } > ;
118
137
relatedPubActionsDropdowns : Record < string , ReactNode > ;
119
138
} ) => {
120
139
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
+ > = { } ;
122
153
for ( const value of pub . values ) {
123
154
const { relatedPub, fieldSlug, fieldName } = value ;
124
155
if ( relatedPub ) {
0 commit comments