Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at cb54cd87bb36c92ebcd59cd0b2edb77245b1b999 39 lines 936 B view raw
1import React from 'react' 2 3const CurrentConvoIdContext = React.createContext<{ 4 currentConvoId: string | undefined 5 setCurrentConvoId: (convoId: string | undefined) => void 6}>({ 7 currentConvoId: undefined, 8 setCurrentConvoId: () => {}, 9}) 10CurrentConvoIdContext.displayName = 'CurrentConvoIdContext' 11 12export function useCurrentConvoId() { 13 const ctx = React.useContext(CurrentConvoIdContext) 14 if (!ctx) { 15 throw new Error( 16 'useCurrentConvoId must be used within a CurrentConvoIdProvider', 17 ) 18 } 19 return ctx 20} 21 22export function CurrentConvoIdProvider({ 23 children, 24}: { 25 children: React.ReactNode 26}) { 27 const [currentConvoId, setCurrentConvoId] = React.useState< 28 string | undefined 29 >() 30 const ctx = React.useMemo( 31 () => ({currentConvoId, setCurrentConvoId}), 32 [currentConvoId], 33 ) 34 return ( 35 <CurrentConvoIdContext.Provider value={ctx}> 36 {children} 37 </CurrentConvoIdContext.Provider> 38 ) 39}