Something went wrong. Try again.
a tool for shared writing and social publishing
Something went wrong. Try again.
1.8 kB · 66 lines
TSX
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667import { useIdentityData } from "components/IdentityProvider";import { navPages, HomeButton, ReaderButton, NotificationButton, WriterButton,} from "./NavigationButtons";import { PublicationButtons } from "./Publications";import { Sidebar } from "./Sidebar";import { LoginActionButton, LoginButton } from "components/LoginButton";import { ProfileButton } from "./ProfileButton";
export const DesktopNavigation = (props: { currentPage: navPages; publication?: string;}) => { let { identity } = useIdentityData(); let thisPublication = identity?.publications?.find( (pub) => pub.uri === props.publication, );
let currentlyWriter = props.currentPage === "home" || props.currentPage === "looseleafs" || props.currentPage === "pub"; return ( <div className="flex flex-col gap-3"> <Sidebar alwaysOpen> {identity?.atp_did ? ( <> <ProfileButton /> <NotificationButton current={props.currentPage === "notifications"} /> </> ) : ( <LoginActionButton /> )} </Sidebar>
<Sidebar alwaysOpen> <ReaderButton current={props.currentPage === "reader"} subs={ identity?.publication_subscriptions?.length !== 0 && identity?.publication_subscriptions?.length !== undefined } /> <WriterButton currentPage={props.currentPage} currentPubUri={thisPublication?.uri} /> {currentlyWriter && ( <> <hr className="border-border-light border-dashed" /> <PublicationButtons currentPage={props.currentPage} currentPubUri={thisPublication?.uri} /> </> )} </Sidebar> </div> );};