11/* eslint-disable @typescript-eslint/no-explicit-any */
2- import ExpandMoreIcon from '@mui/icons-material/ExpandMore ' ;
2+ import AddIcon from '@mui/icons-material/Add ' ;
33import { useState } from 'react' ;
4- import { Accordion , AccordionDetails , AccordionSummary , Typography } from '../../base' ;
4+ import { Button } from '../../base' ;
55import { TeamsIcon } from '../../icons' ;
66import { useTheme } from '../../theme' ;
77import { CustomColumnVisibilityControl } from '../CustomColumnVisibilityControl' ;
@@ -10,7 +10,7 @@ import { TeamTableConfiguration } from '../TeamTable';
1010import TeamTable from '../TeamTable/TeamTable' ;
1111import AssignmentModal from './AssignmentModal' ;
1212import useTeamAssignment from './hooks/useTeamAssignment' ;
13- import { L5EditIcon , TableHeader , TableRightActionHeader } from './styles' ;
13+ import { TableHeader , TableRightActionHeader } from './styles' ;
1414
1515export interface TeamsTableProps {
1616 workspaceId : string ;
@@ -50,10 +50,6 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
5050 const [ pageSize , setPageSize ] = useState < number > ( 10 ) ;
5151 const [ sortOrder , setSortOrder ] = useState < string > ( 'updated_at desc' ) ;
5252 const [ bulkSelect , setBulkSelect ] = useState < boolean > ( false ) ;
53- const [ expanded , setExpanded ] = useState < boolean > ( false ) ;
54- const handleAccordionChange = ( ) => {
55- setExpanded ( ! expanded ) ;
56- } ;
5753 const [ search , setSearch ] = useState < string > ( '' ) ;
5854 const [ isSearchExpanded , setIsSearchExpanded ] = useState < boolean > ( false ) ;
5955
@@ -107,60 +103,51 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
107103 const theme = useTheme ( ) ;
108104 return (
109105 < >
110- < Accordion expanded = { expanded } onChange = { handleAccordionChange } style = { { margin : 0 } } >
111- < AccordionSummary
112- expandIcon = { < ExpandMoreIcon /> }
113- sx = { { backgroundColor : 'background.paper' } }
106+ < TableHeader >
107+ < Button
108+ variant = "contained"
109+ startIcon = { < AddIcon /> }
110+ onClick = { teamAssignment . handleAssignModal }
111+ style = { { margin : '1rem' } }
114112 >
115- < TableHeader >
116- < Typography variant = "body1" fontWeight = { 'bold' } >
117- Assigned Teams
118- </ Typography >
119- < TableRightActionHeader >
120- < SearchBar
121- onSearch = { ( value ) => {
122- setSearch ( value ) ;
123- } }
124- onClear = { ( ) => {
125- setSearch ( '' ) ;
126- } }
127- expanded = { isSearchExpanded }
128- setExpanded = { setIsSearchExpanded }
129- placeholder = "Search workspaces..."
130- />
131- < CustomColumnVisibilityControl
132- columns = { tableProps . columns }
133- customToolsProps = { {
134- columnVisibility : tableProps . columnVisibility ,
135- setColumnVisibility : tableProps . setColumnVisibility
136- } }
137- id = { 'teams-table' }
138- />
139- < L5EditIcon
140- onClick = { teamAssignment . handleAssignModal }
141- disabled = { ! isAssignTeamAllowed }
142- title = "Assign Teams"
143- />
144- </ TableRightActionHeader >
145- </ TableHeader >
146- </ AccordionSummary >
147- < AccordionDetails style = { { padding : 0 } } >
148- < TeamTable
149- teams = { teamsOfWorkspace ?. teams }
150- tableOptions = { tableProps . tableOptions }
151- columnVisibility = { tableProps . columnVisibility }
152- colViews = { tableProps . colViews }
153- tableCols = { tableProps . tableCols }
154- updateCols = { tableProps . updateCols }
113+ Assign Teams
114+ </ Button >
115+ < TableRightActionHeader >
116+ < SearchBar
117+ onSearch = { ( value ) => {
118+ setSearch ( value ) ;
119+ } }
120+ onClear = { ( ) => {
121+ setSearch ( '' ) ;
122+ } }
123+ expanded = { isSearchExpanded }
124+ setExpanded = { setIsSearchExpanded }
125+ placeholder = "Search workspaces..."
126+ />
127+ < CustomColumnVisibilityControl
155128 columns = { tableProps . columns }
156- isRemoveFromTeamAllowed = { isRemoveTeamFromWorkspaceAllowed }
157- org_id = { org_id }
158- useGetUsersForOrgQuery = { useGetUsersForOrgQuery }
159- useNotificationHandlers = { useNotificationHandlers }
160- useRemoveUserFromTeamMutation = { useRemoveUserFromTeamMutation }
129+ customToolsProps = { {
130+ columnVisibility : tableProps . columnVisibility ,
131+ setColumnVisibility : tableProps . setColumnVisibility
132+ } }
133+ id = { 'teams-table' }
161134 />
162- </ AccordionDetails >
163- </ Accordion >
135+ </ TableRightActionHeader >
136+ </ TableHeader >
137+ < TeamTable
138+ teams = { teamsOfWorkspace ?. teams }
139+ tableOptions = { tableProps . tableOptions }
140+ columnVisibility = { tableProps . columnVisibility }
141+ colViews = { tableProps . colViews }
142+ tableCols = { tableProps . tableCols }
143+ updateCols = { tableProps . updateCols }
144+ columns = { tableProps . columns }
145+ isRemoveFromTeamAllowed = { isRemoveTeamFromWorkspaceAllowed }
146+ org_id = { org_id }
147+ useGetUsersForOrgQuery = { useGetUsersForOrgQuery }
148+ useNotificationHandlers = { useNotificationHandlers }
149+ useRemoveUserFromTeamMutation = { useRemoveUserFromTeamMutation }
150+ />
164151
165152 < AssignmentModal
166153 open = { teamAssignment . assignModal }
0 commit comments