Skip to content

Commit

Permalink
update artwork room api call
Browse files Browse the repository at this point in the history
  • Loading branch information
imhson committed Nov 11, 2024
1 parent 2076c21 commit 8077cc3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
3 changes: 1 addition & 2 deletions public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@
"IN_MAINTENANCE_MODE": false,
"GTM_ID": "GTM-5N2X4HSN",
"SEEKHYPE_URL": "https://seekhype.io/",
"WALLET_CONNECT_PROJECT_ID": "ec40291093ad80fa0def54b1fb44c8ef",
"DEFAULT_CHAIN_ID": 1516
"WALLET_CONNECT_PROJECT_ID": "ec40291093ad80fa0def54b1fb44c8ef"
}
14 changes: 7 additions & 7 deletions src/pages/events/ava-2024/map/artwork-room/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function PageDetail() {
const [page, setPage] = usePage()
const [showSlider, setShowSlider] = useState(false)
const { data, mutate, isLoading } = useSWR(
{ key: 'get-ava-artwork', user_id: account?.id },
({ user_id }) => eventService.story.getArtwork(user_id),
{ key: 'get-ava-artwork', user_id: account?.id, page },
({ user_id, page }) => eventService.story.getArtwork(user_id, page),
{
revalidateOnFocus: false,
}
Expand Down Expand Up @@ -112,7 +112,7 @@ function PageDetail() {
{artworks?.length ? (
<>
<div className='grid grid-cols-2 md:grid-cols-3 gap-5 mt-6'>
{artworks?.slice((page - 1) * artworkPerPage, page * artworkPerPage)?.map((artwork, index) => (
{artworks?.map((artwork, index) => (
<div
className={`rounded-xl cursor-pointer relative overflow-hidden ${
artwork.id == selected?.id ? 'border-[#00E160]' : 'border-black'
Expand Down Expand Up @@ -273,7 +273,7 @@ function PageDetail() {
<div className='fixed inset-0 z-50'>
<div className='absolute inset-0 bg-[#000000CC]' onClick={() => setShowSlider(false)}></div>
<div className='absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center gap-4 justify-center max-w-[95vw] w-full lg:w-fit'>
<div className='cursor-pointer p-1' onClick={prevHandler}>
{/* <div className='cursor-pointer p-1' onClick={prevHandler}>
<svg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'>
<g clip-path='url(#clip0_6205_29201)'>
<path
Expand All @@ -287,7 +287,7 @@ function PageDetail() {
</clipPath>
</defs>
</svg>
</div>
</div> */}
<div className=' lg:bg-neutral-700 lg:p-8 lg:pt-4 lg:rounded-mlg'>
<div className='flex flex-col items-center gap-4 lg:rounded-xl lg:bg-neutral-950 lg:p-4 max-h-[90vh] overflow-auto'>
<Image
Expand All @@ -300,7 +300,7 @@ function PageDetail() {
<div className='text-sm font-semibold text-white'>{selected.name}</div>
</div>
</div>
<div className='cursor-pointer p-1' onClick={nextHandler}>
{/* <div className='cursor-pointer p-1' onClick={nextHandler}>
<svg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'>
<g clip-path='url(#clip0_6205_29197)'>
<path
Expand All @@ -314,7 +314,7 @@ function PageDetail() {
</clipPath>
</defs>
</svg>
</div>
</div> */}
</div>
</div>
)}
Expand Down
6 changes: 4 additions & 2 deletions src/services/eventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export const eventService = {
),
submitArtwork: async (payload) =>
await privateAxios.post(`${getConfig().REST_API_URL}/story-event/submission/artwork`, payload),
getArtwork: async (userId) =>
getArtwork: async (userId, page) =>
await privateAxios.get(
`${getConfig().REST_API_URL}/story-event/artwork?limit=9999&offset=0${userId ? `&user_id=${userId}` : ``}`
`${getConfig().REST_API_URL}/story-event/artwork?limit=12&offset=${(page - 1) * 12}${
userId ? `&user_id=${userId}` : ``
}`
),
likeArtwork: async (id) => await privateAxios.post(`${getConfig().REST_API_URL}/user/artwork/${id}/like`),
unlikeArtwork: async (id) => await privateAxios.post(`${getConfig().REST_API_URL}/user/artwork/${id}/unlike`),
Expand Down

0 comments on commit 8077cc3

Please sign in to comment.