/* global React, LogoMark, Icon, api */ const { useState: useStateSidebar, useEffect: useEffectSidebar } = React; function Sidebar({ view, setView, profile, onSignOut }){ const items = [ {id:"overview", label:"Overview", icon:"home"}, {id:"campaigns", label:"Campaigns", icon:"flag"}, {id:"clips", label:"My clips", icon:"chart"}, {id:"payouts", label:"Payouts", icon:"wallet"}, {id:"settings", label:"Settings", icon:"settings"}, ]; const [balance, setBalance] = useStateSidebar(null); useEffectSidebar(() => { let mounted = true; api.getMyBalance().then(r => { if (mounted && !r.error) setBalance(r.data); }); return () => { mounted = false; }; }, [view]); const initial = (profile && profile.display_name && profile.display_name[0] ? profile.display_name[0] : "C").toUpperCase(); return ( ); } function Topbar({ onSubmit, profile }){ const name = profile && profile.display_name ? profile.display_name : (profile && profile.handle ? profile.handle.replace(/^@/,"") : "there"); return (