feat: initial commit with seeded database and premium ui changes

This commit is contained in:
Dodo
2026-06-11 18:41:42 +07:00
commit edf94ae5c1
1684 changed files with 33073 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
"use client";
import { useEffect, useState } from "react";
export function useScroll(downThreshold: number, upThreshold?: number) {
const [scrolled, setScrolled] = useState(false);
const scrollUpThreshold = upThreshold ?? downThreshold / 2;
useEffect(() => {
const handleScroll = () => {
const y = window.scrollY;
// Hysteresis: different thresholds for up/down to prevent flickering
setScrolled((prev) => {
if (prev) {
// Currently scrolled - only unscroll when below lower threshold
return y > scrollUpThreshold;
}
// Currently not scrolled - only scroll when above higher threshold
return y > downThreshold;
});
};
window.addEventListener("scroll", handleScroll, { passive: true });
handleScroll();
return () => window.removeEventListener("scroll", handleScroll);
}, [downThreshold, scrollUpThreshold]);
return scrolled;
}