@@ -2,12 +2,16 @@ import React, { useState, useEffect } from 'react';
22import { Link } from 'react-router-dom' ;
33import clientService from '../../services/client.service' ;
44import groupService from '../../services/group.service' ;
5- import { Client , Group } from '../../types' ;
5+ import { Client , Group , User } from '../../types' ;
66import { formatBytes , downloadFile , formatDate } from '../../utils/helpers' ;
77import { Download , Lock , Unlock , Pencil , Trash2 , Search } from 'lucide-react' ;
88import './ClientList.css' ;
99
10- const ClientList : React . FC = ( ) => {
10+ interface ClientListProps {
11+ user : User | null ;
12+ }
13+
14+ const ClientList : React . FC < ClientListProps > = ( { user } ) => {
1115 const [ clients , setClients ] = useState < Client [ ] > ( [ ] ) ;
1216 const [ groups , setGroups ] = useState < Group [ ] > ( [ ] ) ;
1317 const [ loading , setLoading ] = useState ( true ) ;
@@ -89,9 +93,11 @@ const ClientList: React.FC = () => {
8993 < div className = "page-header" >
9094 < h1 > All Clients</ h1 >
9195 < div className = "header-actions" >
92- < button onClick = { ( ) => setShowCreateModal ( true ) } className = "btn-primary" >
93- + New Client
94- </ button >
96+ { user ?. can_create_clients && (
97+ < button onClick = { ( ) => setShowCreateModal ( true ) } className = "btn-primary" >
98+ + New Client
99+ </ button >
100+ ) }
95101 </ div >
96102 </ div >
97103
0 commit comments