mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
- 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>
21 lines
864 B
TypeScript
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
|