Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
sujata
/
Akruti-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 87c12ee4
authored
2026-04-07 18:44:42 +0530
by
Ravindra Kanojiya
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updated collection page
1 parent
037b0fd1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
16 deletions
pages/collections/[category]/[subCategory]/[productSlug].js
pages/collections/[category]/[subCategory]/index.js
services/collectionDetailCategoryApi.js
pages/collections/[category]/[subCategory]/[productSlug].js
View file @
87c12ee
...
@@ -8,7 +8,6 @@ import Catalogues from "@/container/Home/Catalogues";
...
@@ -8,7 +8,6 @@ import Catalogues from "@/container/Home/Catalogues";
import
{
Contact
}
from
"@/container/Home/Contact"
;
import
{
Contact
}
from
"@/container/Home/Contact"
;
import
{
getCollectionDetailCategoryData
}
from
"@/services/collectionDetailCategoryApi"
;
import
{
getCollectionDetailCategoryData
}
from
"@/services/collectionDetailCategoryApi"
;
import
{
getCataloguesBySlug
}
from
"@/services/cataloguesApi"
;
import
{
getCataloguesBySlug
}
from
"@/services/cataloguesApi"
;
import
{
getRedisClient
}
from
"@/redis-client"
;
import
CompanyOverview
from
"@/components/Collection/CompanyOverview"
;
import
CompanyOverview
from
"@/components/Collection/CompanyOverview"
;
import
TechnicalDetails
from
"@/components/Collection/TechnicalDetails"
;
import
TechnicalDetails
from
"@/components/Collection/TechnicalDetails"
;
import
Explore
from
"@/components/Collection/Explore"
;
import
Explore
from
"@/components/Collection/Explore"
;
...
@@ -17,6 +16,7 @@ import { useEffect, useState } from "react";
...
@@ -17,6 +16,7 @@ import { useEffect, useState } from "react";
import
StoneFinishCabinet
from
"@/components/StoneFinishCabinet/StoneFinishCabinet"
;
import
StoneFinishCabinet
from
"@/components/StoneFinishCabinet/StoneFinishCabinet"
;
const
ProductPage
=
({
productData
,
cataloguesData
})
=>
{
const
ProductPage
=
({
productData
,
cataloguesData
})
=>
{
console
.
log
(
"productData"
,
productData
)
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
category
,
subCategory
:
subCategorySlug
,
productSlug
}
=
router
.
query
;
const
{
category
,
subCategory
:
subCategorySlug
,
productSlug
}
=
router
.
query
;
...
@@ -104,7 +104,12 @@ const isStoneLayout =
...
@@ -104,7 +104,12 @@ const isStoneLayout =
{
isStoneLayout
&&
(
{
isStoneLayout
&&
(
<
StoneFinishCabinet
StoneFinishCabinet
=
{
productData
?.
aboutInfoStone
}
/
>
<
StoneFinishCabinet
StoneFinishCabinet
=
{
productData
?.
aboutInfoStone
}
/
>
)}
)}
{
isStoneLayout
&&
(
<
Video
productData
=
{
productData
?.
aboutInfoStone
?.
video
}
/
>
)}
{
isStoneLayout
&&
productData
?.
aboutInfoStone
?.
gallery
?.
length
>
0
&&
(
<
Gallery
productData
=
{
productData
.
aboutInfoStone
.
gallery
}
/
>
)}
{
productData
?.
video
&&
(
{
productData
?.
video
&&
(
<
Video
productData
=
{
productData
.
video
}
/
>
<
Video
productData
=
{
productData
.
video
}
/
>
)}
)}
...
@@ -154,17 +159,8 @@ export default ProductPage;
...
@@ -154,17 +159,8 @@ export default ProductPage;
/* ---------- SSR ---------- */
/* ---------- SSR ---------- */
export
async
function
getServerSideProps
({
params
})
{
export
async
function
getServerSideProps
({
params
})
{
const
{
productSlug
}
=
params
;
const
redis
=
getRedisClient
();
const
REDIS_KEY
=
`
${
process
.
env
.
REDIS_KEY_PREFIX
}
_product_
${
productSlug
}
`
;
const
REDIS_EXPIRE
=
parseInt
(
process
.
env
.
REDIS_KEY_EXPIRE
)
||
86400
;
try
{
try
{
const
cachedData
=
await
redis
.
get
(
REDIS_KEY
);
const
{
productSlug
}
=
params
;
if
(
cachedData
)
{
console
.
log
(
"redis data fetched"
);
return
{
props
:
JSON
.
parse
(
cachedData
)
};
}
const
productData
=
await
getCollectionDetailCategoryData
(
productSlug
);
const
productData
=
await
getCollectionDetailCategoryData
(
productSlug
);
const
cataloguesData
=
await
getCataloguesBySlug
();
const
cataloguesData
=
await
getCataloguesBySlug
();
...
@@ -173,10 +169,12 @@ export async function getServerSideProps({ params }) {
...
@@ -173,10 +169,12 @@ export async function getServerSideProps({ params }) {
return
{
notFound
:
true
};
return
{
notFound
:
true
};
}
}
const
result
=
{
productData
:
productData
[
0
],
cataloguesData
};
return
{
await
redis
.
set
(
REDIS_KEY
,
JSON
.
stringify
(
result
),
"EX"
,
REDIS_EXPIRE
);
props
:
{
console
.
log
(
"normal data fetched"
);
productData
:
productData
[
0
],
// ✅ single product
return
{
props
:
result
};
cataloguesData
,
},
};
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
"Product page SSR error:"
,
error
);
console
.
error
(
"Product page SSR error:"
,
error
);
return
{
notFound
:
true
};
return
{
notFound
:
true
};
...
...
pages/collections/[category]/[subCategory]/index.js
View file @
87c12ee
...
@@ -117,6 +117,9 @@ const isStoneLayout =
...
@@ -117,6 +117,9 @@ const isStoneLayout =
{
isStoneLayout
&&
(
{
isStoneLayout
&&
(
<
StoneFinishCabinet
StoneFinishCabinet
=
{
productData
?.
aboutInfoStone
}
/
>
<
StoneFinishCabinet
StoneFinishCabinet
=
{
productData
?.
aboutInfoStone
}
/
>
)}
)}
{
isStoneLayout
&&
(
<
Video
productData
=
{
productData
?.
aboutInfoStone
?.
video
}
/
>
)}
{
productData
?.
technicalDetails
?.
length
>
0
&&
(
{
productData
?.
technicalDetails
?.
length
>
0
&&
(
<
TechnicalDetails
productData
=
{
productData
?.
technicalDetails
}
/
>
<
TechnicalDetails
productData
=
{
productData
?.
technicalDetails
}
/
>
)}
)}
...
...
services/collectionDetailCategoryApi.js
View file @
87c12ee
...
@@ -79,6 +79,14 @@ export async function getCollectionDetailCategoryData(productSlug) {
...
@@ -79,6 +79,14 @@ export async function getCollectionDetailCategoryData(productSlug) {
bottomInfo
:
{
bottomInfo
:
{
populate
:
"*"
,
populate
:
"*"
,
},
},
video
:
{
populate
:
"*"
,
},
gallery
:
{
populate
:
{
image
:
true
,
},
},
},
},
},
},
...
...
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