Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-16 00:53:16 +03:00
parent e46363a758
commit 720ba8354f
4 changed files with 70 additions and 183 deletions

View File

@@ -660,25 +660,19 @@ function resolveProductImageUrl(item) {
return { contentUrl, publicUrl, thumbUrl, fullUrl }
}
function extractImageOrder(fileName, fallbackIndex) {
const name = String(fileName || '').trim()
const mg = name.match(/gallery[-_\s]?(\d+)/i)
if (mg) return Number(mg[1] || 999999)
const m = name.match(/\((\d+)\)(?=\.[a-z0-9]+$)/i)
if (m) return Number(m[1] || 999999)
const m2 = name.match(/[-_ ](\d+)(?=\.[a-z0-9]+$)/i)
if (m2) return Number(m2[1] || 999999)
return 1000000 + Number(fallbackIndex || 0)
function sortImagesForDisplay(list) {
// #gallery-1 mantigi icin frontend render sirasini (API'den gelen sira) koruyoruz.
return Array.isArray(list) ? [...list] : []
}
function sortImagesForDisplay(list) {
return (Array.isArray(list) ? list : [])
.map((item, idx) => ({ item, idx, order: extractImageOrder(item?.file_name || item?.FileName || '', idx) }))
.sort((a, b) => {
if (a.order !== b.order) return a.order - b.order
return a.idx - b.idx
})
.map((x) => x.item)
function parseGalleryHashIndex() {
if (typeof window === 'undefined') return 0
const hash = String(window.location?.hash || '').trim()
const m = hash.match(/^#gallery-(\d+)$/i)
if (!m) return 0
const n = Number(m[1] || 1)
if (!Number.isFinite(n) || n < 1) return 0
return n - 1
}
async function resolveProductImageUrlForCarousel(item) {
@@ -1336,7 +1330,8 @@ async function openProductCard(grp1, grp2) {
}
productCardImages.value = uniqueImages
productCardSlide.value = 0
const hashIndex = parseGalleryHashIndex()
productCardSlide.value = Math.min(Math.max(hashIndex, 0), Math.max(uniqueImages.length - 1, 0))
productCardData.value = {
productCode,
colorCode,

View File

@@ -639,23 +639,19 @@ function resolveProductImageUrl(item) {
return { contentUrl, publicUrl, thumbUrl, fullUrl }
}
function extractImageOrder(fileName, fallbackIndex) {
const name = String(fileName || '').trim()
const m = name.match(/\((\d+)\)(?=\.[a-z0-9]+$)/i)
if (m) return Number(m[1] || 999999)
const m2 = name.match(/[-_ ](\d+)(?=\.[a-z0-9]+$)/i)
if (m2) return Number(m2[1] || 999999)
return 1000000 + Number(fallbackIndex || 0)
function sortImagesForDisplay(list) {
// #gallery-1 mantigi icin frontend render sirasini (API'den gelen sira) koruyoruz.
return Array.isArray(list) ? [...list] : []
}
function sortImagesForDisplay(list) {
return (Array.isArray(list) ? list : [])
.map((item, idx) => ({ item, idx, order: extractImageOrder(item?.file_name || item?.FileName || '', idx) }))
.sort((a, b) => {
if (a.order !== b.order) return a.order - b.order
return a.idx - b.idx
})
.map((x) => x.item)
function parseGalleryHashIndex() {
if (typeof window === 'undefined') return 0
const hash = String(window.location?.hash || '').trim()
const m = hash.match(/^#gallery-(\d+)$/i)
if (!m) return 0
const n = Number(m[1] || 1)
if (!Number.isFinite(n) || n < 1) return 0
return n - 1
}
async function resolveProductImageUrlForCarousel(item) {
@@ -1144,7 +1140,8 @@ async function openProductCard(grp1, grp2) {
}
productCardImages.value = uniqueImages
productCardSlide.value = 0
const hashIndex = parseGalleryHashIndex()
productCardSlide.value = Math.min(Math.max(hashIndex, 0), Math.max(uniqueImages.length - 1, 0))
productCardData.value = {
productCode,
colorCode,