+ {/* Fades to solid as the hero scrolls under it */}
+ {isTransparentPage && (
+
+ )}
+ {/* Hidden until the bar is solid, so the hall name on the hero image
+ never shows through behind it */}
{greeting}
@@ -621,11 +701,11 @@ function MobileToolbar(): React.JSX.Element {
>
>
@@ -718,6 +798,7 @@ function MobileToolbar(): React.JSX.Element {
@@ -752,6 +833,20 @@ function MobileToolbar(): React.JSX.Element {
/>
+
+
+
+
{
+ if (!enabled) return;
+
+ const update = () => {
+ const heroBottom =
+ document.getElementById("hero")?.getBoundingClientRect().bottom ?? 0;
+ setFade(Math.min(Math.max((128 - heroBottom) / 64, 0), 1));
+ };
+
+ update();
+ window.addEventListener("scroll", update, { passive: true });
+ return () => window.removeEventListener("scroll", update);
+ }, [enabled]);
+
+ return fade;
+}
diff --git a/apps/next/src/lib/auth-constants.ts b/apps/next/src/lib/auth-constants.ts
index 346df8bb..9eba1daa 100644
--- a/apps/next/src/lib/auth-constants.ts
+++ b/apps/next/src/lib/auth-constants.ts
@@ -1 +1,4 @@
export const AUTH_PROVIDER_ID = "icssc";
+
+/** Seconds since sign-in during which a session can delete its account. */
+export const SESSION_FRESH_AGE = 5 * 60;
diff --git a/apps/next/src/lib/auth.ts b/apps/next/src/lib/auth.ts
index 825f7c09..469f75de 100644
--- a/apps/next/src/lib/auth.ts
+++ b/apps/next/src/lib/auth.ts
@@ -7,7 +7,7 @@ import { betterAuth } from "better-auth/minimal";
import { nextCookies } from "better-auth/next-js";
import { genericOAuth } from "better-auth/plugins";
-import { AUTH_PROVIDER_ID } from "@/lib/auth-constants";
+import { AUTH_PROVIDER_ID, SESSION_FRESH_AGE } from "@/lib/auth-constants";
import type { AuthAdditionalData } from "@/lib/auth-types";
import { getSafeAuthRedirectPath } from "@/lib/auth-utils";
@@ -41,8 +41,15 @@ export const auth = betterAuth({
enabled: true,
maxAge: 5 * 60,
},
+ // Account deletion requires a sign-in this recent.
+ freshAge: SESSION_FRESH_AGE,
},
user: {
+ deleteUser: {
+ enabled: true,
+ // TODO: When auth.icssc.club adds account deletion, call it from a
+ // beforeDelete hook to revoke Sign in with Apple tokens and end ICSSC sessions.
+ },
additionalFields: {
hasOnboarded: {
type: "boolean",
diff --git a/apps/next/src/utils/funcs.ts b/apps/next/src/utils/funcs.ts
index bebce6aa..98b9808d 100644
--- a/apps/next/src/utils/funcs.ts
+++ b/apps/next/src/utils/funcs.ts
@@ -527,18 +527,21 @@ export function getEventType(title: string): string {
}
/**
- * Scrolls to a station section while leaving room for the sticky restaurant controls.
+ * Scrolls to a station section while leaving room for the toolbar and sticky
+ * restaurant controls.
*/
export function scrollToStation(stationId: string) {
const section = document.getElementById(stationId);
if (!section) return;
- const controlsHeight =
- document.getElementById("restaurant-controls")?.offsetHeight ?? 0;
+ const controls = document.getElementById("restaurant-controls");
+ const controlsBottom = controls
+ ? Number.parseFloat(getComputedStyle(controls).top) + controls.offsetHeight
+ : 0;
window.scrollTo({
top:
section.getBoundingClientRect().top +
window.scrollY -
- controlsHeight -
+ controlsBottom -
16,
behavior: "smooth",
});