[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:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user