-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #486 from alleslabs/feat/schema-query-scroll
Switch to schema tab when available and add msg scrolling
- Loading branch information
Showing
12 changed files
with
210 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./app"; | ||
export * from "./nav"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { Dispatch, ReactNode, SetStateAction } from "react"; | ||
import { useContext, createContext, useMemo } from "react"; | ||
|
||
import { useLocalStorage } from "lib/hooks/useLocalStorage"; | ||
import type { Option } from "lib/types"; | ||
|
||
interface NavContextInterface { | ||
isExpand: boolean; | ||
isDevMode: Option<boolean>; | ||
setIsExpand: Dispatch<SetStateAction<boolean>>; | ||
setIsDevMode: Dispatch<SetStateAction<Option<boolean>>>; | ||
} | ||
const NavContext = createContext<NavContextInterface>({ | ||
isExpand: false, | ||
isDevMode: undefined, | ||
setIsExpand: () => {}, | ||
setIsDevMode: () => {}, | ||
}); | ||
|
||
export const NavProvider = ({ children }: { children: ReactNode }) => { | ||
const [isDevMode, setIsDevMode] = useLocalStorage<Option<boolean>>( | ||
"devMode", | ||
undefined | ||
); | ||
const [isExpand, setIsExpand] = useLocalStorage("navbar", false); | ||
|
||
const states = useMemo<NavContextInterface>( | ||
() => ({ | ||
isDevMode, | ||
isExpand, | ||
setIsDevMode, | ||
setIsExpand, | ||
}), | ||
[isDevMode, isExpand, setIsDevMode, setIsExpand] | ||
); | ||
|
||
return <NavContext.Provider value={states}>{children}</NavContext.Provider>; | ||
}; | ||
|
||
export const useNavContext = (): NavContextInterface => { | ||
return useContext(NavContext); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.