@@ -4,13 +4,22 @@ import { Link } from '@reach/router';
4
4
import { FormattedMessage } from 'react-intl' ;
5
5
import ReactPlaceholder from 'react-placeholder' ;
6
6
import { Form , Field } from 'react-final-form' ;
7
+ import { useQueryParams , StringParam } from 'use-query-params' ;
7
8
8
9
import messages from './messages' ;
9
10
import { useEditTeamAllowed } from '../../hooks/UsePermissions' ;
10
11
import { UserAvatar , UserAvatarList } from '../user/avatar' ;
11
- import { AddButton , ViewAllLink , Management , VisibilityBox , InviteOnlyBox } from './management' ;
12
+ import {
13
+ AddButton ,
14
+ ViewAllLink ,
15
+ Management ,
16
+ VisibilityBox ,
17
+ InviteOnlyBox ,
18
+ TeamFilter ,
19
+ } from './management' ;
12
20
import { SwitchToggle , RadioField , OrganisationSelectInput } from '../formInputs' ;
13
21
import { Button , EditButton } from '../button' ;
22
+ import ClearFilters from '../projects/clearFilters' ;
14
23
15
24
export function TeamsManagement ( {
16
25
teams,
@@ -23,6 +32,12 @@ export function TeamsManagement({
23
32
( state ) => state . auth . get ( 'organisations' ) && state . auth . get ( 'organisations' ) . length > 0 ,
24
33
) ;
25
34
35
+ const [ query , setQuery ] = useQueryParams ( { organisation : StringParam } ) ;
36
+
37
+ const filteredTeams = query . organisation
38
+ ? teams . filter ( ( t ) => t . organisation === query . organisation )
39
+ : teams ;
40
+
26
41
return (
27
42
< Management
28
43
title = {
@@ -42,8 +57,15 @@ export function TeamsManagement({
42
57
setUserOnly = { setUserTeamsOnly }
43
58
userOnlyLabel = { < FormattedMessage { ...messages . myTeams } /> }
44
59
>
45
- { teams . length ? (
46
- teams . map ( ( team , n ) => < TeamCard team = { team } key = { n } managementView = { managementView } /> )
60
+ < div >
61
+ < TeamFilter query = { query } setQuery = { setQuery } />
62
+ < ClearFilters url = { '/manage/teams/' } className = "v-top mh1 mt1 mt2-ns dib" />
63
+ </ div >
64
+
65
+ { filteredTeams . length ? (
66
+ filteredTeams . map ( ( team , n ) => (
67
+ < TeamCard team = { team } key = { n } managementView = { managementView } />
68
+ ) )
47
69
) : (
48
70
< div className = "pb3 pt2" >
49
71
< FormattedMessage { ...messages . noTeams } />
0 commit comments