feat: auto-load poll results

This commit is contained in:
codytseng
2025-07-27 22:08:08 +08:00
parent b35e0cf850
commit ea821fd708
18 changed files with 193 additions and 64 deletions

View File

@@ -49,6 +49,16 @@ export function isInViewport(el: HTMLElement) {
)
}
export function isPartiallyInViewport(el: HTMLElement) {
const rect = el.getBoundingClientRect()
return (
rect.top < (window.innerHeight || document.documentElement.clientHeight) &&
rect.bottom > 0 &&
rect.left < (window.innerWidth || document.documentElement.clientWidth) &&
rect.right > 0
)
}
export function isEmail(email: string) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
}