(props: Props)
| 12 | } |
| 13 | |
| 14 | const Header = (props: Props) => { |
| 15 | const { className } = props; |
| 16 | const layoutStore = useLayoutStore(); |
| 17 | const conversationStore = useConversationStore(); |
| 18 | const isDarkMode = useDarkMode(); |
| 19 | const [showSchemaDrawer, setShowSchemaDrawer] = useState<boolean>(false); |
| 20 | const currentConversationId = conversationStore.currentConversationId; |
| 21 | const title = conversationStore.getConversationById(currentConversationId)?.title || "SQL Chat"; |
| 22 | |
| 23 | useEffect(() => { |
| 24 | document.title = `${title}`; |
| 25 | }, [title]); |
| 26 | |
| 27 | return ( |
| 28 | <> |
| 29 | <div className={`${className || ""} w-full border-b dark:border-zinc-700 z-1`}> |
| 30 | <div className="my-2 w-full flex flex-row justify-between items-center lg:grid lg:grid-cols-3"> |
| 31 | <div className="ml-2 flex justify-start items-center"> |
| 32 | <button |
| 33 | className="w-8 h-8 p-1 mr-1 block lg:hidden rounded-md cursor-pointer hover:bg-gray-100 dark:hover:bg-zinc-700" |
| 34 | onClick={() => layoutStore.toggleSidebar()} |
| 35 | > |
| 36 | <Icon.IoIosMenu className="text-gray-600 w-full h-auto" /> |
| 37 | </button> |
| 38 | <span className="w-auto text-left block lg:hidden">{title}</span> |
| 39 | <GitHubStarBadge className="hidden lg:flex ml-2" /> |
| 40 | </div> |
| 41 | <span className="w-auto text-center hidden lg:flex justify-center items-center"> |
| 42 | <a |
| 43 | href="https://www.bytebase.com?source=sqlchat" |
| 44 | className="hidden sm:block w-auto h-auto py-1 px-2 rounded-md hover:bg-gray-100 dark:hover:bg-zinc-700" |
| 45 | target="_blank" |
| 46 | > |
| 47 | <img |
| 48 | className="h-5 sm:h-6 w-auto" |
| 49 | src={isDarkMode ? "/craft-by-bytebase-dark-mode.webp" : "/craft-by-bytebase.webp"} |
| 50 | alt="" |
| 51 | /> |
| 52 | </a> |
| 53 | </span> |
| 54 | </div> |
| 55 | <ConversationTabsView /> |
| 56 | </div> |
| 57 | </> |
| 58 | ); |
| 59 | }; |
| 60 | |
| 61 | export default Header; |
nothing calls this directly
no test coverage detected