1
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore ' ;
2
+ import AddIcon from '@mui/icons-material/Add ' ;
3
3
import { useState } from 'react' ;
4
- import { Accordion , AccordionDetails , AccordionSummary , Typography } from '../../base' ;
4
+ import { Button } from '../../base' ;
5
5
import { TeamsIcon } from '../../icons' ;
6
6
import { useTheme } from '../../theme' ;
7
7
import { CustomColumnVisibilityControl } from '../CustomColumnVisibilityControl' ;
@@ -10,7 +10,7 @@ import { TeamTableConfiguration } from '../TeamTable';
10
10
import TeamTable from '../TeamTable/TeamTable' ;
11
11
import AssignmentModal from './AssignmentModal' ;
12
12
import useTeamAssignment from './hooks/useTeamAssignment' ;
13
- import { L5EditIcon , TableHeader , TableRightActionHeader } from './styles' ;
13
+ import { TableHeader , TableRightActionHeader } from './styles' ;
14
14
15
15
export interface TeamsTableProps {
16
16
workspaceId : string ;
@@ -50,10 +50,6 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
50
50
const [ pageSize , setPageSize ] = useState < number > ( 10 ) ;
51
51
const [ sortOrder , setSortOrder ] = useState < string > ( 'updated_at desc' ) ;
52
52
const [ bulkSelect , setBulkSelect ] = useState < boolean > ( false ) ;
53
- const [ expanded , setExpanded ] = useState < boolean > ( false ) ;
54
- const handleAccordionChange = ( ) => {
55
- setExpanded ( ! expanded ) ;
56
- } ;
57
53
const [ search , setSearch ] = useState < string > ( '' ) ;
58
54
const [ isSearchExpanded , setIsSearchExpanded ] = useState < boolean > ( false ) ;
59
55
@@ -107,60 +103,51 @@ const TeamsTable: React.FC<TeamsTableProps> = ({
107
103
const theme = useTheme ( ) ;
108
104
return (
109
105
< >
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' } }
114
112
>
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
155
128
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' }
161
134
/>
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
+ />
164
151
165
152
< AssignmentModal
166
153
open = { teamAssignment . assignModal }
0 commit comments