import $ from 'jquery'; import * as JSX from './jsx'; import * as user from './user'; import * as settings from './settings'; import { Dropdown, DropdownItem, Spinner, addPopup } from './components'; async function logout() { await user.logout(); } /** * NavItem component * takes in title and route, optionally "disabled" **/ function NavItem( props: any ) { const url = new URL( window.location.href ); var style = `height: 45px;`; var onclick = () => JSX.navigate( props.route ); if( props.disabled || url.pathname == props.route ) { style += "color: #888;pointer-events: none;"; onclick = null; } return [ { props.title } ] } function SettingsButton( props: any ) { let openSettings = settings.openPopup; let style = `height: 45px;`; if( props.disabled ) { openSettings = null; style += "color: #888; pointer-events: none;"; } return [ Settings ] } function EmailInput() { const sendLink = async () => { const email = $( "#login-email" ).val().toString(); $( "#login-btn-wrapper" ).append( ); const res = await user.sendLoginLink( email ); if( res === true ) { $( "#header-login-dropdown" ).replaceWith(
Success! Check your inbox for a login link.
); } else { $( "#header-login-dropdown" ).replaceWith(
Error sending email: { res }
); } }; return
Log in
} function showLoginPopup() { addPopup( $( ) ); } export function Header() { return }