[Experiment] Remove "Load Latest" button (#7120)

* Remove "show latest" behind the gate

* Add HomeBadgeProvider

* Update provider state from home feed tabs

* Add Home badge to native

* Add Home badge to mobile web

* Add Home badge to desktop web
This commit is contained in:
dan
2024-12-15 20:30:17 +00:00
committed by GitHub
parent 80c0125d6b
commit 1ac307bc42
10 changed files with 136 additions and 37 deletions
+24
View File
@@ -0,0 +1,24 @@
import React from 'react'
type StateContext = boolean
type ApiContext = (hasNew: boolean) => void
const stateContext = React.createContext<StateContext>(false)
const apiContext = React.createContext<ApiContext>((_: boolean) => {})
export function Provider({children}: React.PropsWithChildren<{}>) {
const [state, setState] = React.useState(false)
return (
<stateContext.Provider value={state}>
<apiContext.Provider value={setState}>{children}</apiContext.Provider>
</stateContext.Provider>
)
}
export function useHomeBadge() {
return React.useContext(stateContext)
}
export function useSetHomeBadge() {
return React.useContext(apiContext)
}