@@ -18,12 +18,12 @@ const orgSuperRowSchema = userSchema.extend({
1818 netid : z . string ( ) . max ( 0 ) ,
1919 firstName : z . string ( ) . max ( 0 ) ,
2020 lastName : z . string ( ) . max ( 0 ) ,
21- subRows : userSchema . array ( ) ,
21+ subRows : userSchema . omit ( { org : true } ) . array ( ) , // redundant so omit org
2222} ) ;
2323
24+ export type Org = z . infer < typeof OrganizationListEnum > ;
2425export type User = z . infer < typeof userSchema > ;
2526export type OrgSuperRow = z . infer < typeof orgSuperRowSchema > ;
26- export type Org = z . infer < typeof OrganizationListEnum > ;
2727
2828function groupUsersByOrg ( users : User [ ] ) : OrgSuperRow [ ] {
2929 const grouped : Record < Org , User [ ] > = { } as Record < Org , User [ ] > ;
@@ -52,7 +52,7 @@ function groupUsersByOrg(users: User[]): OrgSuperRow[] {
5252
5353export const ScreenComponent : React . FC = ( ) => {
5454 const [ userList , setUserList ] = useState < OrgSuperRow [ ] > ( [ ] ) ;
55- const columns = useMemo < MRT_ColumnDef < User > [ ] > (
55+ const columns = useMemo < MRT_ColumnDef < OrgSuperRow > [ ] > (
5656 ( ) => [
5757 {
5858 accessorKey : 'org' ,
@@ -89,7 +89,7 @@ export const ScreenComponent: React.FC = () => {
8989 // return { ...item, upcoming: false };
9090 // });
9191
92- // get request for user orgs
92+ // mock data
9393 const userOrgsResponse = [
9494 { netid : 'johnd01' , org : 'SIGMusic' } ,
9595 { netid : 'miker44' , org : 'SIGPLAN' } ,
@@ -248,5 +248,17 @@ export const ScreenComponent: React.FC = () => {
248248 // getSubRows: (originalRow) => originalRow.subRows, //default, can customize
249249 // });
250250
251- return < MantineReactTable columns = { columns } data = { userList } enableExpanding /> ;
251+ return (
252+ < MantineReactTable
253+ columns = { columns }
254+ data = { userList }
255+ enableExpanding
256+ mantineTableBodyRowProps = { ( { row } ) => ( {
257+ // className: row.original.subRows ? 'super-row' : 'sub-row',
258+ style : row . original . subRows
259+ ? { fontWeight : 'bold' } // Super row styling
260+ : { fontWeight : 'lighter' } , // Sub-row styling
261+ } ) }
262+ />
263+ ) ;
252264} ;
0 commit comments