import styles from './Header.module.scss' import { clsx } from 'clsx' import { router, useRouter } from '../../stores/router' import { Icon } from '../_shared/Icon' import { createMemo, createSignal, Show } from 'solid-js' import Notifications from './Notifications' import { ProfilePopup } from './ProfilePopup' import Userpic from '../Author/Userpic' import { showModal, useWarningsStore } from '../../stores/ui' import { ShowOnlyOnClient } from '../_shared/ShowOnlyOnClient' import { useSession } from '../../context/session' import { useLocalize } from '../../context/localize' import { getPagePath } from '@nanostores/router' import { Button } from '../_shared/Button' import { useEditorContext } from '../../context/editor' type HeaderAuthProps = { setIsProfilePopupVisible: (value: boolean) => void } export const HeaderAuth = (props: HeaderAuthProps) => { const { t } = useLocalize() const { page } = useRouter() const [visibleWarnings, setVisibleWarnings] = createSignal(false) const { warnings } = useWarningsStore() const { session, isSessionLoaded, isAuthenticated } = useSession() const { actions: { toggleEditorPanel } } = useEditorContext() const toggleWarnings = () => setVisibleWarnings(!visibleWarnings()) const handleBellIconClick = (event: Event) => { event.preventDefault() if (!isAuthenticated()) { showModal('auth') return } toggleWarnings() } const isEditorPage = createMemo( () => page().route === 'create' || page().route === 'edit' || page().route === 'editSettings' ) const showNotifications = createMemo(() => isAuthenticated() && !isEditorPage()) const showSaveButton = createMemo(() => isAuthenticated() && isEditorPage()) const showCreatePostButton = createMemo(() => isAuthenticated() && !isEditorPage()) const showAuthenticatedControls = createMemo(() => isAuthenticated() && isEditorPage()) const handleBurgerButtonClick = () => { toggleEditorPanel() } return (
{t('Enter')}
} > { props.setIsProfilePopupVisible(isVisible) }} containerCssClass={styles.control} trigger={
} />
) }