({
feedName,
algoState: [selectedAlgo, setSelectedAlgo],
chips,
}: SearchControlHeaderProps)
| 82 | export const DEFAULT_ALGORITHM_INDEX = 0; |
| 83 | |
| 84 | export const SearchControlHeader = ({ |
| 85 | feedName, |
| 86 | algoState: [selectedAlgo, setSelectedAlgo], |
| 87 | chips, |
| 88 | }: SearchControlHeaderProps): ReactElement | null => { |
| 89 | const [selectedPeriod, setSelectedPeriod] = useQueryState({ |
| 90 | key: [QueryStateKeys.FeedPeriod], |
| 91 | defaultValue: 0, |
| 92 | }); |
| 93 | const { user } = useAuthContext(); |
| 94 | const { logEvent } = useLogContext(); |
| 95 | const { sortingEnabled } = useContext(SettingsContext); |
| 96 | const { isUpvoted, isSortableFeed } = useFeedName({ feedName }); |
| 97 | const isLaptop = useViewSize(ViewSize.Laptop); |
| 98 | const isMobile = useViewSize(ViewSize.MobileL); |
| 99 | const isTablet = useViewSize(ViewSize.Tablet); |
| 100 | const { isV2 } = useLayoutVariant(); |
| 101 | const isV2Strip = isV2; |
| 102 | const { streak, isLoading, isStreaksEnabled } = useReadingStreak(); |
| 103 | const { checkHasCompleted, completeAction, isActionsFetched } = useActions(); |
| 104 | const browserName = getCurrentBrowserName(); |
| 105 | const isEdge = browserName === BrowserName.Edge; |
| 106 | const feedsWithActions = [ |
| 107 | SharedFeedPage.MyFeed, |
| 108 | SharedFeedPage.Custom, |
| 109 | SharedFeedPage.CustomForm, |
| 110 | ]; |
| 111 | const hasFeedActions = feedsWithActions.includes(feedName as SharedFeedPage); |
| 112 | const hasDismissedInstallExtension = checkHasCompleted( |
| 113 | ActionType.DismissInstallExtension, |
| 114 | ); |
| 115 | const canInstallExtension = |
| 116 | !checkIsExtension() && |
| 117 | isExtensionCapableBrowser() && |
| 118 | isNullOrUndefined(user?.flags?.lastExtensionUse); |
| 119 | const shouldEvaluateInstallExtensionPrompt = |
| 120 | hasFeedActions && |
| 121 | isActionsFetched && |
| 122 | canInstallExtension && |
| 123 | !hasDismissedInstallExtension; |
| 124 | const hasIntroQuests = useHasIntroQuests({ |
| 125 | shouldEvaluate: shouldEvaluateInstallExtensionPrompt, |
| 126 | }); |
| 127 | |
| 128 | if (isMobile) { |
| 129 | return null; |
| 130 | } |
| 131 | |
| 132 | // v2 compact ghost styles for the page-header action strip: 32px |
| 133 | // square icon buttons + 32px-tall text buttons, no border/bg, with |
| 134 | // a surface-hover affordance on hover. |
| 135 | const compactIconButtonClassName = |
| 136 | '!size-8 !rounded-10 !border-transparent !bg-transparent !p-0 hover:!bg-surface-hover'; |
| 137 | const compactTextButtonClassName = |
| 138 | '!h-8 !rounded-10 !border-transparent !bg-transparent !px-3 hover:!bg-surface-hover'; |
| 139 | |
| 140 | const dropdownProps: Partial<DropdownProps> = { |
| 141 | className: { |
nothing calls this directly
no test coverage detected