code cleanup and other fixes
This commit is contained in:
parent
45fba7f26d
commit
dbe1597d21
@ -1,35 +1,8 @@
|
||||
// import {useQuery} from '@tanstack/react-query';
|
||||
// type props={
|
||||
// artist:string,
|
||||
// asset_type:number,
|
||||
// genre:string,
|
||||
// language:string,
|
||||
// mood:string,
|
||||
// rights:number,
|
||||
// searchByValue:string,
|
||||
// territory:string,
|
||||
// validity:number,
|
||||
// }
|
||||
// export const postSearchList = async({artist,asset_type,genre,language,mood,rights,searchByValue,territory,validity,}:props)=>{
|
||||
// const response = await fetch(`${process.env.REACT_APP_API_URL}/project-list-search`);
|
||||
// const projectListData = await response.json()
|
||||
// return projectListData;
|
||||
// }
|
||||
|
||||
// export const usePostSearchListData = (searchBy: any) => {
|
||||
// return useQuery(
|
||||
// {
|
||||
// queryKey: ['search-project-list', searchBy],
|
||||
// queryFn: () => postSearchList(searchBy)
|
||||
// }
|
||||
// );
|
||||
// };
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
export const postSearchList = async (data: any)=> {
|
||||
const { data: response } = await axios.post(
|
||||
`${process.env.REACT_APP_API_URL}/add-user`,
|
||||
`${process.env.REACT_APP_API_URL}/project-list-search`,
|
||||
data
|
||||
);
|
||||
return await response.data;
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
} from '@mui/material';
|
||||
|
||||
const menuItemStyle = {
|
||||
fontSize: '13px', // Adjust the font size as needed
|
||||
fontSize: '13px',
|
||||
};
|
||||
|
||||
const AdvancedFilters = ({ advanceFilterData, setAdvanceFilterData }:any) => {
|
||||
@ -21,7 +21,7 @@ const AdvancedFilters = ({ advanceFilterData, setAdvanceFilterData }:any) => {
|
||||
|
||||
return (
|
||||
<Paper square sx={{ width:'100%', overflow: 'hidden', backgroundColor: 'rgb(13 13 13)' }}>
|
||||
<Grid container spacing={2} justifyContent="center" sx={{marginTop:'1%',marginBottom:'1%'}} >
|
||||
<Grid container spacing={1} justifyContent="center" sx={{marginTop:'1%',marginBottom:'1%'}} >
|
||||
<Grid item xs={6} sm={3} md={3} lg={1.6} >
|
||||
<FormControl fullWidth variant="standard">
|
||||
<InputLabel sx={{ color: 'white',paddingLeft:1,fontSize: '12px' }}>Assets</InputLabel>
|
||||
@ -102,8 +102,8 @@ const AdvancedFilters = ({ advanceFilterData, setAdvanceFilterData }:any) => {
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={6} sm={3} md={3} lg={1.6}>
|
||||
<FormControl fullWidth variant="standard">
|
||||
<InputLabel sx={{ color: 'white', paddingLeft: 1 }}>Territory</InputLabel>
|
||||
{/* <FormControl fullWidth variant="standard">
|
||||
<InputLabel sx={{ color: 'white', paddingLeft: 1 }}>Territory</InputLabel> */}
|
||||
<TextField
|
||||
variant="standard"
|
||||
value={advanceFilterData.territory}
|
||||
@ -111,13 +111,13 @@ const AdvancedFilters = ({ advanceFilterData, setAdvanceFilterData }:any) => {
|
||||
handleFilterChange('territory', e.target.value);
|
||||
}}
|
||||
InputProps={{
|
||||
style: { marginLeft:2 }, // Set the color and font size
|
||||
style: { marginLeft:2 },
|
||||
}}
|
||||
sx={{ color: 'white', border: '1px solid white', marginTop: 2,'& input': {
|
||||
color: 'white',
|
||||
}, }}
|
||||
/>
|
||||
</FormControl>
|
||||
{/* </FormControl> */}
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={6} sm={3} md={3} lg={1.6} >
|
||||
|
||||
@ -7,7 +7,7 @@ export default function Search() {
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [advanceFilterData, setAdvanceFilterData] = useState<any>(
|
||||
{
|
||||
searchText,
|
||||
searchByValue:searchText,
|
||||
rights: 0,
|
||||
asset_type: 0,
|
||||
territory: '',
|
||||
@ -20,20 +20,34 @@ export default function Search() {
|
||||
);
|
||||
const [showAdvancedFilters, setShowAdvancedFilters] = useState(false);
|
||||
|
||||
useEffect(()=>{
|
||||
postSearchList(advanceFilterData)
|
||||
},[advanceFilterData])
|
||||
// useEffect(()=>{
|
||||
// postSearchList(advanceFilterData)
|
||||
// },[advanceFilterData])
|
||||
|
||||
const handleSearch = () => {
|
||||
|
||||
postSearchList(advanceFilterData)
|
||||
};
|
||||
|
||||
const handleClear = () => {
|
||||
setSearchText('');
|
||||
handleAdvancedFilter()
|
||||
};
|
||||
|
||||
const handleAdvancedFilter = () => {
|
||||
setShowAdvancedFilters(!showAdvancedFilters);
|
||||
if (showAdvancedFilters==false){
|
||||
setAdvanceFilterData({
|
||||
searchText,
|
||||
rights: 0,
|
||||
asset_type: 0,
|
||||
territory: '',
|
||||
genre: '',
|
||||
language: '',
|
||||
mood: '',
|
||||
validity: 0,
|
||||
artist: ''
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user