Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit a7d7624a
authored
2024-06-06 15:45:56 +0530
by
Ravindra Kanojiya
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
https://git.logicloop.io/jaymehta/zango-frontend
2 parents
2e2316ed
acd5d738
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
25 deletions
components/detail/Detail.js
components/home/SearchBar.js
components/layout/Header.js
components/listing/ListingInner.js
components/listing/ListingItems.js
pages/listing.js
redux/actions/activityAction.js
redux/actions/vendorActions.js
components/detail/Detail.js
View file @
a7d7624
...
@@ -24,7 +24,7 @@ const Detail = () => {
...
@@ -24,7 +24,7 @@ const Detail = () => {
dispatch
(
getActivitiesByFilters
({
category
:
activityById
?.
data
.
attributes
.
category
?.
data
?.
id
}));
dispatch
(
getActivitiesByFilters
({
category
:
activityById
?.
data
.
attributes
.
category
?.
data
?.
id
}));
},
[
activityById
]);
},
[
activityById
]);
console
.
log
(
"faqs=>"
,
faqs
);
//
console.log("faqs=>", faqs);
console
.
log
(
"activityById"
,
activityById
);
console
.
log
(
"activityById"
,
activityById
);
console
.
log
(
"loadedUser"
,
loadedUser
);
console
.
log
(
"loadedUser"
,
loadedUser
);
return
(
return
(
...
...
components/home/SearchBar.js
View file @
a7d7624
...
@@ -13,7 +13,7 @@ const SearchBar = () => {
...
@@ -13,7 +13,7 @@ const SearchBar = () => {
const
[
options
,
setoptions
]
=
useState
([]);
const
[
options
,
setoptions
]
=
useState
([]);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
router
=
useRouter
();
const
router
=
useRouter
();
console
.
log
(
"options"
,
options
);
//
console.log("options", options);
return
(
return
(
<>
<>
<
section
className
=
"searchbar-session"
>
<
section
className
=
"searchbar-session"
>
...
@@ -67,7 +67,7 @@ const SearchBar = () => {
...
@@ -67,7 +67,7 @@ const SearchBar = () => {
return
{
id
:
item
.
id
,
label
:
`
${
item
.
name
}
- experience`
};
return
{
id
:
item
.
id
,
label
:
`
${
item
.
name
}
- experience`
};
});
});
}
}
console
.
log
(
"opts"
,
opts
);
//
console.log("opts", opts);
setoptions
(
opts
);
setoptions
(
opts
);
setopen
(
true
);
setopen
(
true
);
}
}
...
...
components/layout/Header.js
View file @
a7d7624
...
@@ -17,7 +17,7 @@ const Header = () => {
...
@@ -17,7 +17,7 @@ const Header = () => {
const
{
endUser
}
=
useSelector
(
state
=>
state
.
endUser
);
const
{
endUser
}
=
useSelector
(
state
=>
state
.
endUser
);
const
[
open
,
setopen
]
=
useState
(
false
);
const
[
open
,
setopen
]
=
useState
(
false
);
const
[
options
,
setoptions
]
=
useState
([]);
const
[
options
,
setoptions
]
=
useState
([]);
console
.
log
(
"options"
,
options
);
//
console.log("options", options);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
// console.log("user", loadedUser);
// console.log("user", loadedUser);
const
[
isSticky
,
setIsSticky
]
=
useState
(
false
);
const
[
isSticky
,
setIsSticky
]
=
useState
(
false
);
...
@@ -124,7 +124,7 @@ const Header = () => {
...
@@ -124,7 +124,7 @@ const Header = () => {
return
{
id
:
item
.
id
,
label
:
`
${
item
.
name
}
- experience`
};
return
{
id
:
item
.
id
,
label
:
`
${
item
.
name
}
- experience`
};
});
});
}
}
console
.
log
(
"opts"
,
opts
);
//
console.log("opts", opts);
setoptions
(
opts
);
setoptions
(
opts
);
setopen
(
true
);
setopen
(
true
);
}
}
...
...
components/listing/ListingInner.js
View file @
a7d7624
...
@@ -31,7 +31,6 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
...
@@ -31,7 +31,6 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
setGridClass
(
className
);
setGridClass
(
className
);
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
const
handleResize
=
()
=>
{
const
handleResize
=
()
=>
{
// console.log("Window Width:");
// console.log("Window Width:");
...
@@ -94,7 +93,7 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
...
@@ -94,7 +93,7 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
if
(
activityFilters
.
priceUpperLimit
)
{
if
(
activityFilters
.
priceUpperLimit
)
{
filters
[
"priceUpperLimit"
]
=
activityFilters
.
priceUpperLimit
;
filters
[
"priceUpperLimit"
]
=
activityFilters
.
priceUpperLimit
;
}
}
// console.log("subcategory >>", filters
);
console
.
log
(
"router >>"
,
router
.
query
.
page
);
dispatch
(
dispatch
(
getActivitiesByFilters
({
getActivitiesByFilters
({
subCategory
:
filters
.
subCategory
,
subCategory
:
filters
.
subCategory
,
...
@@ -108,10 +107,18 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
...
@@ -108,10 +107,18 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
maxGroupSize
:
filters
.
maxGroupSize
,
maxGroupSize
:
filters
.
maxGroupSize
,
ageLowerLimit
:
filters
.
ageLowerLimit
,
ageLowerLimit
:
filters
.
ageLowerLimit
,
sort
:
filters
.
sort
,
sort
:
filters
.
sort
,
priceUpperLimit
:
filters
.
priceUpperLimit
priceUpperLimit
:
filters
.
priceUpperLimit
,
currentPage
:
router
.
query
.
page
})
})
);
);
},
[
activityFilters
]);
},
[
activityFilters
]);
useEffect
(()
=>
{
dispatch
(
getActivitiesByFilters
({
currentPage
:
router
.
query
.
page
})
);
},
[]);
return
(
return
(
<>
<>
...
...
components/listing/ListingItems.js
View file @
a7d7624
import
{
Empty
}
from
"antd"
;
import
{
Empty
}
from
"antd"
;
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
{
useRouter
}
from
"next/router"
;
import
{
useRouter
}
from
"next/router"
;
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
use
Effect
,
use
State
}
from
"react"
;
import
{
Button
}
from
"react-bootstrap"
;
import
{
Button
}
from
"react-bootstrap"
;
import
{
Loader
}
from
"react-bootstrap-typeahead"
;
import
{
Loader
}
from
"react-bootstrap-typeahead"
;
import
{
useSelector
}
from
"react-redux"
;
import
{
use
Dispatch
,
use
Selector
}
from
"react-redux"
;
import
{
cleanImage
}
from
"../../services/imageHandling"
;
import
{
cleanImage
}
from
"../../services/imageHandling"
;
import
WishlistComponent
from
"../detail/WIshlistComponent"
;
import
WishlistComponent
from
"../detail/WIshlistComponent"
;
import
Pagination
from
"react-js-pagination"
;
import
Pagination
from
"react-js-pagination"
;
import
{
getActivitiesByFilters
}
from
"../../redux/actions/activityAction"
;
const
ListingItems
=
({
allActivitiesData
,
loading
,
gridClass
,
totalCount
})
=>
{
const
ListingItems
=
({
allActivitiesData
,
loading
,
gridClass
,
totalCount
})
=>
{
// const [gridClass, setGridClass] = useState('col-md-3');
// const [gridClass, setGridClass] = useState('col-md-3');
const
{
endUser
}
=
useSelector
(
state
=>
state
.
endUser
);
const
{
endUser
}
=
useSelector
(
state
=>
state
.
endUser
);
console
.
log
(
"endUser"
,
endUser
);
const
router
=
useRouter
();
const
router
=
useRouter
();
const
dispatch
=
useDispatch
();
// useEffect(() => {
// dispatch(getActivitiesByFilters({ currentPage: router.query.page }));
// }, [router]);
console
.
log
(
"endUser"
,
endUser
);
// console.log("router", router);
// console.log("router", router);
let
{
page
=
1
,
location
=
""
}
=
router
.
query
;
let
{
page
,
location
=
""
}
=
router
.
query
;
page
=
Number
(
page
);
page
=
Number
(
page
);
let
queryParams
;
let
queryParams
;
...
@@ -34,10 +39,17 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
...
@@ -34,10 +39,17 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
}
else
{
}
else
{
queryParams
.
append
(
"page"
,
pageNumber
);
queryParams
.
append
(
"page"
,
pageNumber
);
}
}
router
.
replace
({
search
:
queryParams
.
toString
()
// dispatch(getActivitiesByFilters({ currentPage: pageNumber }));
router
.
push
({
query
:
queryParams
.
toString
()
});
});
};
};
console
.
log
(
"page"
,
page
);
// useEffect(() => {
// dispatch(getActivitiesByFilters({ currentPage: page }));
// }, [])
return
(
return
(
<>
<>
{
allActivitiesData
&&
!
allActivitiesData
.
data
.
length
==
0
?
(
{
allActivitiesData
&&
!
allActivitiesData
.
data
.
length
==
0
?
(
...
@@ -110,7 +122,10 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
...
@@ -110,7 +122,10 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
activePage
=
{
page
}
activePage
=
{
page
}
itemsCountPerPage
=
{
12
}
itemsCountPerPage
=
{
12
}
totalItemsCount
=
{
totalCount
}
totalItemsCount
=
{
totalCount
}
onChange
=
{
handlePagination
}
onChange
=
{
async
(
e
)
=>
{
console
.
log
(
"log >"
,
e
);
await
handlePagination
(
e
);
}}
nextPageText
=
{
"›"
}
nextPageText
=
{
"›"
}
prevPageText
=
{
"‹"
}
prevPageText
=
{
"‹"
}
firstPageText
=
{
"«"
}
firstPageText
=
{
"«"
}
...
...
pages/listing.js
View file @
a7d7624
import
{
useRouter
}
from
"next/router"
;
import
{
useEffect
}
from
"react"
;
import
{
useDispatch
}
from
"react-redux"
;
import
Layout
from
"../components/layout/Layout"
;
import
Layout
from
"../components/layout/Layout"
;
import
Listing
from
"../components/listing/Listing"
;
import
Listing
from
"../components/listing/Listing"
;
import
{
getActivitiesByFilters
}
from
"../redux/actions/activityAction"
;
import
{
getActivitiesByFilters
}
from
"../redux/actions/activityAction"
;
...
@@ -6,13 +9,11 @@ import { wrapper } from "../redux/store";
...
@@ -6,13 +9,11 @@ import { wrapper } from "../redux/store";
export
default
function
ListingPage
()
{
export
default
function
ListingPage
()
{
/** Client side rendering, traditional API call. */
/** Client side rendering, traditional API call. */
// const dispatch = useDispatch();
const
router
=
useRouter
();
const
dispatch
=
useDispatch
();
// useEffect(() => {
// useEffect(() => {
// const fetchData = async () => {
// dispatch(getActivitiesByFilters({ currentPage: router.query.page }));
// await dispatch(getProjects({ currentPage: 1, featuredOnHome: true }));
// }, []);
// };
// fetchData();
// });
return
(
return
(
<
Layout
>
<
Layout
>
...
...
redux/actions/activityAction.js
View file @
a7d7624
...
@@ -391,11 +391,12 @@ export const getActivitiesByFilters =
...
@@ -391,11 +391,12 @@ export const getActivitiesByFilters =
sort
,
sort
,
priceLowerLimit
,
priceLowerLimit
,
priceUpperLimit
,
priceUpperLimit
,
currentPage
=
1
currentPage
})
=>
})
=>
async
dispatch
=>
{
async
dispatch
=>
{
let
sortFilter
=
[];
let
sortFilter
=
[];
try
{
try
{
console
.
log
(
"page num"
,
currentPage
);
dispatch
({
dispatch
({
type
:
GET_ACTIVITIES_REQUEST
,
type
:
GET_ACTIVITIES_REQUEST
,
loading
:
true
loading
:
true
...
@@ -413,8 +414,8 @@ export const getActivitiesByFilters =
...
@@ -413,8 +414,8 @@ export const getActivitiesByFilters =
}
}
let
query
=
{
let
query
=
{
pagination
:
{
pagination
:
{
pageSize
:
12
,
pageSize
:
12
page
:
currentPage
// page: Number(currentPage)
},
},
filters
:
{
filters
:
{
approved
:
{
$eq
:
"approved"
}
approved
:
{
$eq
:
"approved"
}
...
@@ -438,6 +439,12 @@ export const getActivitiesByFilters =
...
@@ -438,6 +439,12 @@ export const getActivitiesByFilters =
]
]
// sort: ["pricePerPerson:asc"]
// sort: ["pricePerPerson:asc"]
};
};
if
(
currentPage
)
{
query
.
pagination
[
"page"
]
=
Number
(
currentPage
);
}
else
{
query
.
pagination
[
"page"
]
=
1
;
}
console
.
log
(
"page query"
,
query
);
if
(
category
)
{
if
(
category
)
{
query
.
filters
[
"category"
]
=
category
;
query
.
filters
[
"category"
]
=
category
;
}
}
...
...
redux/actions/vendorActions.js
View file @
a7d7624
...
@@ -209,7 +209,8 @@ export const getAllVendors = () => async dispatch => {
...
@@ -209,7 +209,8 @@ export const getAllVendors = () => async dispatch => {
// }
// }
// }
// }
// },
// },
populate
:
[
"user"
,
"experiences"
]
populate
:
[
"user"
,
"experiences"
],
sort
:
[
"createdAt:desc"
]
};
};
// console.log("here 3", query);
// console.log("here 3", query);
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment