Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit eb5be76

Browse files
fix: profile sidebar scroll (#349)
* fix: profile sidebar scroll * fix: profile scroll sidebar * fix: remove console.log * fix: removed signOutButtonRef --------- Co-authored-by: flaviomoceri <moceri.flavio@gmail.com>
1 parent ee86e24 commit eb5be76

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

apps/web/app/profile/components/_Sidebar.tsx

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Image from 'next/image';
44
import Link from 'next/link';
5-
import { useEffect, useState, useRef } from 'react';
5+
import { useEffect, useState } from 'react';
66
import {
77
Icon,
88
Typography,
@@ -131,8 +131,6 @@ export default function Sidebar({
131131
const [showProfileMenu, setShowProfileMenu] = useState(false);
132132
const checkLink = Utils.storage.get('checkLink');
133133
const [scrolled, setScrolled] = useState(false);
134-
const signOutButtonRef = useRef(null);
135-
const [isSignOutVisible, setIsSignOutVisible] = useState(true);
136134

137135
useEffect(() => {
138136
async function fetchData() {
@@ -270,7 +268,7 @@ export default function Sidebar({
270268

271269
useEffect(() => {
272270
const handleScroll = () => {
273-
if (window.scrollY > 300) {
271+
if (window.scrollY > 1100) {
274272
setScrolled(true);
275273
} else {
276274
setScrolled(false);
@@ -284,30 +282,12 @@ export default function Sidebar({
284282
};
285283
}, []);
286284

287-
useEffect(() => {
288-
const observer = new IntersectionObserver(
289-
(entries) => {
290-
const entry = entries[0];
291-
if (window.scrollY > 500) {
292-
setIsSignOutVisible(entry.isIntersecting);
293-
}
294-
},
295-
{ threshold: 0 }
296-
);
297-
if (signOutButtonRef.current) {
298-
observer.observe(signOutButtonRef.current);
299-
}
300-
return () => observer.disconnect();
301-
}, []);
302-
303285
return (
304286
<>
305287
<div className="col-span-1 hidden flex-col justify-start items-start gap-8 xl:inline-flex">
306288
<div
307289
className={`w-full self-start ${
308-
isSignOutVisible
309-
? 'border-0 hidden'
310-
: 'block sticky top-[120px] border'
290+
!scrolled ? 'border hidden' : 'block sticky top-[120px] border'
311291
} ${
312292
!scrolled && 'border-0'
313293
} border-white border-opacity-10 z-20 rounded-2xl px-3 py-4`}
@@ -593,7 +573,6 @@ export default function Sidebar({
593573
</div>
594574
</div>
595575
)}
596-
<div ref={signOutButtonRef} />
597576
</div>
598577
</div>
599578
<Modal.CheckLink

0 commit comments

Comments
 (0)