teqo-backup/src/lib/homeSearchFocusHistory.ts
Cursor Agent 84365ddf54
B106 — Voltar no header mobile, Android back e skeleton das sugestões
- CampaignHomeSearchChromeContext + publisher no Início
- CampaignMobileTopBar troca SidebarTrigger por Voltar quando uiFocused
- useHomeSearchFocusHistory com pushState/popstate para back do SO
- HomeSearchSuggestSkeleton enquanto isFetching sem hits
- Unit tests para history helper, top bar e skeleton

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-01 18:36:28 +00:00

21 lines
864 B
TypeScript

/** History state mark for Início mobile search focus (B106). */
export const HOME_SEARCH_FOCUS_HISTORY_KEY = 'teqoHomeSearchFocus' as const
export type HomeSearchFocusHistoryState = {
[HOME_SEARCH_FOCUS_HISTORY_KEY]?: true
}
export const isHomeSearchFocusHistoryState = (state: unknown): state is HomeSearchFocusHistoryState =>
typeof state === 'object' &&
state !== null &&
HOME_SEARCH_FOCUS_HISTORY_KEY in state &&
(state as HomeSearchFocusHistoryState)[HOME_SEARCH_FOCUS_HISTORY_KEY] === true
/**
* After popstate, the active entry may no longer carry our mark — collapse when
* focus mode was open and the browser popped our synthetic entry.
*/
export const shouldCollapseHomeSearchOnPopstate = (input: {
wasHistoryPushed: boolean
closingProgrammatically: boolean
}): boolean => input.wasHistoryPushed && !input.closingProgrammatically