({ root }: { root: ShellRoot })
| 132 | }; |
| 133 | |
| 134 | const RootRow = ({ root }: { root: ShellRoot }): ReactElement => { |
| 135 | const { user } = useAuthContext(); |
| 136 | const setActionsSlot = useShellActionsSlot(); |
| 137 | const { streak, isLoading, isStreaksEnabled } = useReadingStreak(); |
| 138 | const isMobileAppHeader = useMobileAppHeader(); |
| 139 | const { isPlus } = usePlusSubscription(); |
| 140 | const { isEnabled: hasMessages } = useMessagesEnabled(); |
| 141 | const isHome = root === ShellRoot.Home; |
| 142 | |
| 143 | return ( |
| 144 | <div |
| 145 | className="shell-root-row flex items-center" |
| 146 | style={{ |
| 147 | height: topButton.size + 14, |
| 148 | paddingInline: topButton.inset, |
| 149 | gap: topButton.gap, |
| 150 | }} |
| 151 | > |
| 152 | {isHome ? ( |
| 153 | <Logo |
| 154 | position={LogoPosition.Initial} |
| 155 | isPlus={isPlus} |
| 156 | // The Plus and messages squares together leave a 375px row no |
| 157 | // room for the wordmark. |
| 158 | hideTextNarrow={hasMessages && !isPlus} |
| 159 | /> |
| 160 | ) : ( |
| 161 | <h1 className="min-w-0 flex-1 truncate font-bold typo-title3"> |
| 162 | {rootTitles[root]} |
| 163 | </h1> |
| 164 | )} |
| 165 | {isHome && <span className="flex-1" />} |
| 166 | {isMobileAppHeader && <MobileAppActions />} |
| 167 | {user && isHome && <QuestHeaderButton compact shell />} |
| 168 | {user && isHome && isStreaksEnabled && streak && ( |
| 169 | <ReadingStreakButton |
| 170 | isLoading={isLoading} |
| 171 | streak={streak} |
| 172 | compact |
| 173 | iconPosition={ButtonIconPosition.Right} |
| 174 | className="shell-material shell-hit relative !h-[2.375rem] !rounded-14 px-3" |
| 175 | /> |
| 176 | )} |
| 177 | {user && isHome && <PlusSquare />} |
| 178 | {user && root === ShellRoot.Activity && ( |
| 179 | <Link href={`${webappUrl}notifications/settings`} passHref> |
| 180 | <ShellSquare tag="a" aria-label="Notification settings"> |
| 181 | <SettingsIcon size={IconSize.Small} /> |
| 182 | </ShellSquare> |
| 183 | </Link> |
| 184 | )} |
| 185 | <div ref={setActionsSlot} className="contents" /> |
| 186 | {user && <MessagesSquare />} |
| 187 | <AvatarSquare /> |
| 188 | </div> |
| 189 | ); |
| 190 | }; |
| 191 |
nothing calls this directly
no test coverage detected