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