diff --git a/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx b/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx index e692816c..7aa1d731 100644 --- a/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx +++ b/app/lish/[did]/[publication]/dashboard/settings/SettingsContent.tsx @@ -164,17 +164,57 @@ function SettingsForm(props: { onOpenTheme: () => void }) { {canSeePro && !isPro ? : } -
- You have unsaved updates! - - {loading ? : "Update Pub"} - -
+ + ); } +function SettingsFooter(props: { loading: boolean }) { + let [distanceFromBottom, setDistanceFromBottom] = useState(Infinity); + + useEffect(() => { + const scrollContainer = document.getElementById("home-content"); + if (!scrollContainer) return; + + const handleScroll = () => { + const dist = + scrollContainer.scrollHeight - + scrollContainer.scrollTop - + scrollContainer.clientHeight; + setDistanceFromBottom(dist); + }; + + handleScroll(); + scrollContainer.addEventListener("scroll", handleScroll); + return () => scrollContainer.removeEventListener("scroll", handleScroll); + }, []); + + const threshold = 100; + // ratio: 1 = far from bottom (full margin), 0 = at bottom (no margin) + const ratio = Math.min(distanceFromBottom / threshold, 1); + const mx = ratio * 8; // 8px = mx-2 + + return ( +
+
+ You have unsaved updates! + + {props.loading ? : "Update Pub"} + +
+
+ ); +} + export const DashboardContainer = (props: { children: React.ReactNode; className?: string;