reboot alterflixhub

This commit is contained in:
Bkk1234 committed 2026-11-01 17:24:44 +07:00
commit 1e84023a44
188 files changed
+31629

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
/** จำนวนช่องภาพที่แกลเลอรีแสดงจริง: 1 ภาพหลัก + 2 ภาพย่อย */
export const GALLERY_SLOTS = 3;
const THUMB_SLOTS = GALLERY_SLOTS - 1;
export type GalleryView = {
main: string | null;
thumbs: string[];
/** จำนวนรูปที่ยังไม่ถูกแสดง ใช้ทำป้าย "+N" — 0 คือไม่ต้องมีป้าย */
remaining: number;
};
/**
* แบ่งรูปทั้งหมดเป็นภาพหลัก + ภาพย่อย และนับรูปที่เหลือ
* ป้าย "+N" จึงมาจากจำนวนรูปจริง ไม่ใช่ค่าคงที่ในโค้ด
*/
export function splitGallery(photos: string[]): GalleryView {
const [main = null, ...rest] = photos;
return {
main,
thumbs: rest.slice(0, THUMB_SLOTS),
remaining: Math.max(rest.length - THUMB_SLOTS, 0),
};
}