chore(publish): replace source tree with static export at repo root
Publish the prerendered static export (index.html, 404.html, cinema/,
c/, about/, for-cinemas/, for-film-lovers/, assets/, images/, og/,
sitemap.xml, robots.txt) as the site root and remove the React Router
+ Nitro source tree from this branch. Source remains available in
history at 0548772.
Note: public/sw.js here reports VERSION v2.0.5 while the removed source
tree (v2.1.0) was newer, and .gitignore was not carried over.
This commit is contained in:
1 parent
05487728a7
commit
e6c4ebff48
394 files changed
+3977
-37891
No files matched your search
@@ -1,61 +0,0 @@
|
||||
import { useEffect, useRef, useState, type CSSProperties } from "react";
|
||||
|
||||
/**
|
||||
* ระยะที่ถือว่า "ใกล้พอจะโผล่"
|
||||
* - `2000px` ด้านบน: ถ้าผู้ใช้เลื่อนข้ามไกล ๆ (หรือกลับเข้าหน้าที่ scroll ค้างอยู่)
|
||||
* บล็อกที่อยู่เหนือจอจะถูกนับว่าถึงแล้ว → ไม่ค้างซ่อน
|
||||
* - `-6%` ด้านล่าง: รอให้บล็อกโผล่เข้ามาในจอก่อนเริ่มอนิเมชันเล็กน้อย
|
||||
*/
|
||||
const REVEAL_ROOT_MARGIN = "2000px 0px -6% 0px";
|
||||
|
||||
/** ต้องเห็นบล็อกอย่างน้อย 6% ก่อนจึงเริ่มโผล่ */
|
||||
const REVEAL_THRESHOLD = 0.06;
|
||||
|
||||
/**
|
||||
* hook สำหรับ "ค่อย ๆ โผล่" เมื่อเลื่อนมาถึง (IntersectionObserver)
|
||||
*
|
||||
* คืน ref + style ที่ใส่วงหน่วง (stagger) ให้เอง — class/animation อยู่ใน global.css
|
||||
* ใต้ `html.fx-motion` ดังนั้นถ้าผู้ใช้ขอ reduced motion หรือ JS ไม่ทำงาน
|
||||
* เนื้อหาก็ยังแสดงปกติ (ไม่มีคลาส = ไม่มีอะไรถูกซ่อน)
|
||||
*/
|
||||
export function useReveal<T extends HTMLElement = HTMLDivElement>(delayMs = 0) {
|
||||
const ref = useRef<T | null>(null);
|
||||
const [revealed, setRevealed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
if (!node) return;
|
||||
|
||||
// เบราว์เซอร์เก่ามาก: ไม่มี observer → แสดงทันที ไม่ค้างซ่อน
|
||||
if (typeof IntersectionObserver === "undefined") {
|
||||
setRevealed(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
for (const entry of entries) {
|
||||
// กันกรณีเลื่อนเร็ว/กลับเข้าหน้าที่ scroll ค้างอยู่: บล็อกที่เลยจอขึ้นไปแล้ว
|
||||
// ต้องโผล่ทันที (ไม่งั้นจะค้างซ่อนตลอด เพราะไม่มีการตัดผ่านขอบเขตอีก)
|
||||
const rootTop = entry.rootBounds?.top ?? 0;
|
||||
const passed = entry.boundingClientRect.bottom <= rootTop;
|
||||
if (!entry.isIntersecting && !passed) continue;
|
||||
|
||||
setRevealed(true);
|
||||
observer.disconnect();
|
||||
break;
|
||||
}
|
||||
},
|
||||
{ threshold: REVEAL_THRESHOLD, rootMargin: REVEAL_ROOT_MARGIN },
|
||||
);
|
||||
|
||||
observer.observe(node);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
const style = {
|
||||
"--fx-delay": `${Math.max(0, delayMs)}ms`,
|
||||
} as CSSProperties;
|
||||
|
||||
return { ref, revealed, style };
|
||||
}
|
||||
Reference in new issue
Block a user