a tool for shared writing and social publishing
at update/reader 62 lines 1.8 kB view raw
1import { useIdentityData } from "components/IdentityProvider"; 2import { 3 navPages, 4 HomeButton, 5 ReaderButton, 6 NotificationButton, 7 WriterButton, 8} from "./NavigationButtons"; 9import { PublicationButtons } from "./Publications"; 10import { Sidebar } from "./Sidebar"; 11import { LoginActionButton, LoginButton } from "components/LoginButton"; 12 13export const DesktopNavigation = (props: { 14 currentPage: navPages; 15 publication?: string; 16}) => { 17 let { identity } = useIdentityData(); 18 let thisPublication = identity?.publications?.find( 19 (pub) => pub.uri === props.publication, 20 ); 21 22 let currentlyWriter = 23 props.currentPage === "home" || 24 props.currentPage === "looseleafs" || 25 props.currentPage === "pub"; 26 return ( 27 <div className="flex flex-col gap-3"> 28 <Sidebar alwaysOpen> 29 {identity?.atp_did ? ( 30 <NotificationButton current={props.currentPage === "notifications"} /> 31 ) : ( 32 <LoginActionButton /> 33 )} 34 </Sidebar> 35 36 <Sidebar alwaysOpen> 37 <ReaderButton 38 current={props.currentPage === "reader"} 39 subs={ 40 identity?.publication_subscriptions?.length !== 0 && 41 identity?.publication_subscriptions?.length !== undefined 42 } 43 /> 44 {currentlyWriter ? ( 45 <> 46 <HomeButton current={props.currentPage === "home"} /> 47 <hr className="border-border-light border-dashed" /> 48 <PublicationButtons 49 currentPage={props.currentPage} 50 currentPubUri={thisPublication?.uri} 51 /> 52 </> 53 ) : ( 54 <WriterButton 55 currentPage={props.currentPage} 56 currentPubUri={thisPublication?.uri} 57 /> 58 )} 59 </Sidebar> 60 </div> 61 ); 62};