MCPcopy Create free account
hub / github.com/dailydotdev/apps / DndContextProvider

Function DndContextProvider

packages/shared/src/contexts/DndContext.tsx:30–58  ·  view source on GitHub ↗
({
  children,
}: DndContextProviderProps)

Source from the content-addressed store, hash-verified

28}
29
30export const DndContextProvider = ({
31 children,
32}: DndContextProviderProps): ReactElement => {
33 const [showDnd, setShowDnd] = useState(false);
34 const [dndSettings, setDndSettings] =
35 usePersistentContext<DndSettings>('dnd');
36
37 if (!checkIsExtension()) {
38 return (
39 <DndContext.Provider value={DEFAULT_VALUE}>
40 {children}
41 </DndContext.Provider>
42 );
43 }
44
45 return (
46 <DndContext.Provider
47 value={{
48 showDnd,
49 setShowDnd,
50 dndSettings,
51 isActive: dndSettings?.expiration?.getTime() > now.getTime(),
52 onDndSettings: setDndSettings,
53 }}
54 >
55 {children}
56 </DndContext.Provider>
57 );
58};
59
60export default DndContext;
61

Callers

nothing calls this directly

Calls 2

checkIsExtensionFunction · 0.90
usePersistentContextFunction · 0.85

Tested by

no test coverage detected