import { BoldOutlined, GithubOutlined } from '@ant-design/icons'; import { Button, Modal, Space } from 'antd'; import { useResponsive } from 'antd-style'; import qs from 'query-string'; import React, { useCallback, useEffect, useState } from 'react'; import styled from 'styled-components'; import { shallow } from 'zustand/shallow'; import { DraggablePanel } from '@/components'; import { useAppStore } from '@/store'; import Giscus from './Giscus'; import Logo from './Logo'; import Nav from './Nav'; import Setting from './Setting'; import { civitaiLogo, themeIcon } from './style'; /****************************************************** *********************** Style ************************* ******************************************************/ const HeaderView = styled.div` display: flex; flex-wrap: nowrap; gap: 12px; align-items: center; justify-content: space-between; height: -webkit-fill-available; height: -moz-available; padding: 16px 24px; `; /****************************************************** ************************* Dom ************************* ******************************************************/ interface HeaderProps { children: React.ReactNode; } const Header: React.FC = ({ children }) => { const [themeMode] = useAppStore((st) => [st.themeMode], shallow); const { mobile } = useResponsive(); const [expand, setExpand] = useState(true); const [isModalOpen, setIsModalOpen] = useState(false); useEffect(() => { if (mobile) setExpand(false); }, []); const handleSetTheme = useCallback(() => { const theme = themeMode === 'light' ? 'dark' : 'light'; const gradioURL = qs.parseUrl(window.location.href); gradioURL.query.__theme = theme; window.location.replace(qs.stringifyUrl(gradioURL)); }, [themeMode]); const showModal = () => setIsModalOpen(true); const handleCancel = () => setIsModalOpen(false); return ( <>