()
| 39 | } |
| 40 | |
| 41 | export function ShellCluster(): ReactElement | null { |
| 42 | const router = useRouter(); |
| 43 | const queryClient = useQueryClient(); |
| 44 | const hidden = hidesCluster(router?.pathname, router?.asPath); |
| 45 | const { user, squads, showLogin } = useAuthContext(); |
| 46 | const { unreadCount } = useNotificationContext(); |
| 47 | const { logEvent } = useLogContext(); |
| 48 | const { openModal } = useLazyModal(); |
| 49 | const haptic = useHaptic(); |
| 50 | const { p } = useShellScroll(); |
| 51 | const isLandscape = useIsPhoneLandscape(); |
| 52 | // Sideways the screen is too short for the resting bar: it stays compact. |
| 53 | const size = isLandscape ? 1 : p; |
| 54 | const shellField = useShellField(); |
| 55 | const active = owningRoot(router?.pathname ?? ''); |
| 56 | const hasSquads = (squads?.length ?? 0) > 0; |
| 57 | const trackRef = useRef<HTMLDivElement>(null); |
| 58 | const pointer = useRef<{ id: number; startX: number; moved: boolean } | null>( |
| 59 | null, |
| 60 | ); |
| 61 | const suppressClick = useRef(false); |
| 62 | // While a finger holds and moves along the bar the indicator follows it; |
| 63 | // `index` is the tab under the finger, `left` the indicator's offset. |
| 64 | const [drag, setDrag] = useState<{ left: number; index: number } | null>( |
| 65 | null, |
| 66 | ); |
| 67 | // Whether a finger is down on the bar. The bar lifts (scale 1.04, the way |
| 68 | // Instagram's and iOS 26's bars do) only once that finger slides along the |
| 69 | // tabs; a tap leaves it still. |
| 70 | const [pressed, setPressed] = useState(false); |
| 71 | // The glass feel of a held bar: the pill is a lens that lifts, follows |
| 72 | // the finger on a stiff spring and squashes along its motion; the whole |
| 73 | // bar leans past its ends when the finger overshoots. The lens is driven |
| 74 | // frame by frame on the element, outside React. |
| 75 | const [pull, setPull] = useState(0); |
| 76 | const pillRef = useRef<HTMLSpanElement>(null); |
| 77 | const lens = useRef<{ |
| 78 | target: number; |
| 79 | pos: number; |
| 80 | vel: number; |
| 81 | frame: number; |
| 82 | last: number; |
| 83 | } | null>(null); |
| 84 | |
| 85 | const tabs: ClusterTab[] = [ |
| 86 | { |
| 87 | root: ShellRoot.Home, |
| 88 | label: 'Home', |
| 89 | href: '/', |
| 90 | Icon: HomeIcon, |
| 91 | requiresLogin: true, |
| 92 | trigger: AuthTriggers.MainButton, |
| 93 | }, |
| 94 | { |
| 95 | root: ShellRoot.Explore, |
| 96 | label: 'Explore', |
| 97 | href: '/posts', |
| 98 | Icon: SearchIcon, |
nothing calls this directly
no test coverage detected