Skip to content

Commit ff5defc

Browse files
committed
fix build
Signed-off-by: aabidsofi19 <[email protected]>
1 parent 1fa6e51 commit ff5defc

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

src/constants/constants.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,22 @@ export const DEFAULT_STROKE_WIDTH = '2';
99
export const CLOUD_URL = 'https://cloud.layer5.io';
1010

1111
export const KANVAS_MODE = {
12-
DESIGN: "design",
13-
OPERATOR: "operator"
12+
DESIGNER: 'design',
13+
OPERATOR: 'operator'
1414
} as const;
1515

16-
17-
export const PLAYGROUND_MODES = KANVAS_MODE
16+
export const PLAYGROUND_MODES = KANVAS_MODE;
1817

1918
export const VISIBILITY = {
20-
PUBLIC : "public",
21-
PRIVATE :"private"
22-
}
19+
PUBLIC: 'public',
20+
PRIVATE: 'private'
21+
};
2322

2423
export const RESOURCE_TYPE = {
25-
FILTER: "filter",
26-
DESIGN: "design",
27-
CATALOG: "catalog",
28-
VIEW: "view"
24+
FILTER: 'filter',
25+
DESIGN: 'design',
26+
CATALOG: 'catalog',
27+
VIEW: 'view'
2928
} as const;
3029

31-
3230
export type ResourceType = (typeof RESOURCE_TYPE)[keyof typeof RESOURCE_TYPE];
33-

src/custom/UserSearchField/UserSearchField.tsx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Button } from '@mui/material';
22
import Autocomplete from '@mui/material/Autocomplete';
33
import CircularProgress from '@mui/material/CircularProgress';
4-
import React, { useState } from 'react';
4+
import React, { useState } from 'react';
5+
import { useDebounce } from 'use-debounce';
56
import { Avatar, Box, Chip, Grid, TextField, Typography } from '../../base';
67
import { PersonIcon } from '../../icons/Person';
78
import { useTheme } from '../../theme';
8-
import { useDebounce } from 'use-debounce';
99

1010
interface User {
1111
id: string;
@@ -22,7 +22,8 @@ interface UserSearchFieldProps {
2222
usersData: User[];
2323
disabled?: boolean;
2424
shareWithNewUsers: (newUsers: User[]) => Promise<{ error: string }>;
25-
useGetAllUsersQuery: any
25+
/* eslint-disable @typescript-eslint/no-explicit-any */
26+
useGetAllUsersQuery: any;
2627
}
2728

2829
const UserShareSearch: React.FC<UserSearchFieldProps> = ({
@@ -36,22 +37,23 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
3637
const [usersToShareWith, setUsersToShareWith] = useState<User[]>([]);
3738
const [isSharing, setIsSharing] = useState(false);
3839
const theme = useTheme();
39-
const [debouncedInput] = useDebounce(inputValue,300)
40-
41-
const {data:usersMatchingSearch,isLoading:searchUserLoading} = useGetAllUsersQuery({
42-
search:debouncedInput,
43-
page:0,
44-
pagesize:10,
45-
},{skip: debouncedInput.trim().length == 0})
46-
40+
const [debouncedInput] = useDebounce(inputValue, 300);
41+
42+
const { data: usersMatchingSearch, isLoading: searchUserLoading } = useGetAllUsersQuery(
43+
{
44+
search: debouncedInput,
45+
page: 0,
46+
pagesize: 10
47+
},
48+
{ skip: debouncedInput.trim().length == 0 }
49+
);
4750

48-
const suggestions = usersMatchingSearch?.data ?? [] as User[]
51+
const suggestions = usersMatchingSearch?.data ?? ([] as User[]);
4952

5053
// const open = inputValue.trim().length > 0 && suggestions?.length > 0
5154

52-
5355
const handleShareWithNewUsers = async () => {
54-
console.log("users to share with",usersToShareWith)
56+
console.log('users to share with', usersToShareWith);
5557
try {
5658
setIsSharing(true);
5759
const result = await shareWithNewUsers(usersToShareWith);
@@ -85,11 +87,9 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
8587
};
8688

8789
const filteredOptions = suggestions.filter(
88-
(option) => !usersToShareWith.concat(usersData).find((u) => u.email === option.email)
90+
(option: User) => !usersToShareWith.concat(usersData).find((u) => u.email === option.email)
8991
);
9092

91-
92-
9393
const isShareDisabled = disabled || isSharing || usersToShareWith.length === 0;
9494

9595
const UserChip = ({ avatarObj, ...props }: { avatarObj: User }) => (
@@ -130,7 +130,13 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
130130
loading={searchUserLoading}
131131
value={usersToShareWith}
132132
getOptionLabel={(user) => user.email}
133-
noOptionsText={searchUserLoading ? 'Loading...' : (inputValue=="" ? "Search using name or email" :'No users found')}
133+
noOptionsText={
134+
searchUserLoading
135+
? 'Loading...'
136+
: inputValue == ''
137+
? 'Search using name or email'
138+
: 'No users found'
139+
}
134140
onChange={handleAdd}
135141
onInputChange={handleInputChange}
136142
isOptionEqualToValue={(option, value) => option.email === value.email}

0 commit comments

Comments
 (0)