a tool for shared writing and social publishing

added the publicaions nav to the mobile footer

+95 -107
-7
components/ActionBar/ActionButton.tsx
··· 86 </button> 87 ); 88 }; 89 - 90 - // ok currently in the middle of making the actions on home, looseleaf, and pub appear at the top by the page title 91 - // i then need to find a good place for the publication list in the footer 92 - // but first i really need to refactor action button 93 - // 1) make a primary variant 94 - // 2) make a secondary variant 95 - //
··· 86 </button> 87 ); 88 };
+84 -25
components/ActionBar/MobileNavigation.tsx
··· 22 import { Avatar } from "components/Avatar"; 23 import { useProfileFromDid } from "src/utils/getRecordFromDid"; 24 import { LoginActionButton } from "components/LoginButton"; 25 26 export const MobileNavigation = (props: { 27 currentPage: navPages; ··· 33 let compactOnMobile = 34 props.currentPage === "home" || 35 props.currentPage === "looseleafs" || 36 - props.currentPage === "pub" 37 - ? false 38 - : true; 39 40 return ( 41 <div 42 - className={`mobileNav flex justify-between gap-1 items-center text-secondary pl-1 ${compactOnMobile ? "w-full" : "w-fit"}`} 43 > 44 - <div className="flex gap-2"> 45 - <WriterButton 46 - compactOnMobile={compactOnMobile} 47 - currentPage={props.currentPage} 48 - currentPubUri={props.currentPublicationUri} 49 - /> 50 - <ReaderButton 51 - compactOnMobile={compactOnMobile} 52 - current={props.currentPage === "reader"} 53 - subs={ 54 - identity?.publication_subscriptions?.length !== 0 && 55 - identity?.publication_subscriptions?.length !== undefined 56 - } 57 - /> 58 </div> 59 - {identity?.atp_did ? ( 60 - <> 61 - {!compactOnMobile && <Separator />} 62 - <NotificationButton /> 63 - </> 64 - ) : ( 65 - <LoginActionButton /> 66 )} 67 </div> 68 );
··· 22 import { Avatar } from "components/Avatar"; 23 import { useProfileFromDid } from "src/utils/getRecordFromDid"; 24 import { LoginActionButton } from "components/LoginButton"; 25 + import { ButtonPrimary } from "components/Buttons"; 26 27 export const MobileNavigation = (props: { 28 currentPage: navPages; ··· 34 let compactOnMobile = 35 props.currentPage === "home" || 36 props.currentPage === "looseleafs" || 37 + props.currentPage === "pub"; 38 + function getPubIcons() { 39 + let hasLooseleafs = !!identity?.permission_token_on_homepage.find( 40 + (f) => 41 + f.permission_tokens.leaflets_to_documents && 42 + f.permission_tokens.leaflets_to_documents[0]?.document, 43 + ); 44 + 45 + if (identity && identity.publications.length >= 1) { 46 + return ( 47 + <div className="pubNav flex gap-2 font-bold"> 48 + Publications 49 + <div className="flex"> 50 + {identity.publications.map((pub, index) => { 51 + if (index <= 3) 52 + return ( 53 + <PubIcon 54 + key={pub.uri} 55 + record={normalizePublicationRecord(pub.record)} 56 + uri={pub.uri} 57 + className="-ml-4 first:ml-0" 58 + /> 59 + ); 60 + })} 61 + </div> 62 + </div> 63 + ); 64 + } 65 + if (identity && hasLooseleafs) { 66 + return ( 67 + <div className="bg-bg-leaflet rounded-full "> 68 + <LooseLeafSmall className="scale-[75%]" /> 69 + </div> 70 + ); 71 + } else 72 + return ( 73 + <ButtonPrimary compact className="text-sm!"> 74 + Create a Publication! 75 + </ButtonPrimary> 76 + ); 77 + } 78 79 return ( 80 <div 81 + className={`mobileNav flex justify-between gap-1 items-center text-secondary px-1 w-full `} 82 > 83 + <div 84 + className={`flex gap-2 grow items-center ${compactOnMobile ? "justify-start" : "justify-between"}`} 85 + > 86 + <div className="flex gap-2 items-center justify-start"> 87 + <WriterButton 88 + compactOnMobile={compactOnMobile} 89 + currentPage={props.currentPage} 90 + currentPubUri={props.currentPublicationUri} 91 + /> 92 + <ReaderButton 93 + compactOnMobile={compactOnMobile} 94 + current={props.currentPage === "reader"} 95 + subs={ 96 + identity?.publication_subscriptions?.length !== 0 && 97 + identity?.publication_subscriptions?.length !== undefined 98 + } 99 + /> 100 + </div> 101 + {identity?.atp_did ? ( 102 + <> 103 + {compactOnMobile && <Separator classname="h-6!" />} 104 + <NotificationButton /> 105 + </> 106 + ) : ( 107 + <LoginActionButton /> 108 + )} 109 </div> 110 + 111 + {compactOnMobile && ( 112 + <Popover trigger={getPubIcons()} className="pt-1 px-2!"> 113 + <HomeButton 114 + current={props.currentPage === "home"} 115 + className="flex-row-reverse! justify-end!" 116 + /> 117 + <hr className="my-1 border-border-light" /> 118 + <PublicationButtons 119 + currentPage={props.currentPage} 120 + currentPubUri={props.currentPublicationUri} 121 + className="justify-end!" 122 + optionClassName=" flex-row-reverse!" 123 + /> 124 + </Popover> 125 )} 126 </div> 127 );
+11 -75
components/ActionBar/NavigationButtons.tsx
··· 1 import { HomeSmall } from "components/Icons/HomeSmall"; 2 import { ActionButton } from "./ActionButton"; 3 import { useIdentityData } from "components/IdentityProvider"; 4 - import Link from "next/link"; 5 - import { DiscoverSmall } from "components/Icons/DiscoverSmall"; 6 - import { PubIcon, PublicationButtons } from "./Publications"; 7 import { ReaderUnreadSmall } from "components/Icons/ReaderSmall"; 8 import { 9 NotificationsReadSmall, ··· 12 import { SpeedyLink } from "components/SpeedyLink"; 13 import { Popover } from "components/Popover"; 14 import { WriterSmall } from "components/Icons/WriterSmall"; 15 - import { LooseLeafSmall } from "components/Icons/LooseleafSmall"; 16 - import { normalizePublicationRecord } from "src/utils/normalizeRecords"; 17 - import { theme } from "tailwind.config"; 18 - 19 export type navPages = 20 | "home" 21 | "reader" ··· 47 currentPubUri?: string; 48 compactOnMobile?: boolean; 49 }) => { 50 - let { identity } = useIdentityData(); 51 - 52 - let currentPub = identity?.publications?.find( 53 - (pub) => pub.uri === props.currentPubUri, 54 - ); 55 - let pubRecord = currentPub 56 - ? normalizePublicationRecord(currentPub.record) 57 - : null; 58 - 59 let current = 60 props.currentPage === "home" || 61 props.currentPage === "looseleafs" || 62 props.currentPage === "pub"; 63 - console.log(current); 64 - 65 - let currentPubIcon = 66 - currentPub && pubRecord ? ( 67 - <PubIcon record={pubRecord} uri={currentPub.uri} /> 68 - ) : null; 69 - 70 - let currentIcon = 71 - props.currentPage === "home" ? ( 72 - <HomeSmall className="text-tertiary" /> 73 - ) : props.currentPage === "looseleafs" ? ( 74 - <LooseLeafSmall className="text-tertiary" /> 75 - ) : props.currentPage === "pub" ? ( 76 - currentPubIcon 77 - ) : null; 78 79 return ( 80 <Popover 81 className="p-2!" 82 asChild 83 trigger={ 84 - props.compactOnMobile ? ( 85 - <ActionButton 86 - nav 87 - labelOnMobile={true} 88 - icon={<WriterSmall />} 89 - label=<div className="flex flex-row gap-1">Write</div> 90 - className={current ? "bg-bg-page! border-border-light!" : ""} 91 - /> 92 - ) : ( 93 - <ActionButton 94 - nav 95 - labelOnMobile={false} 96 - icon={ 97 - <> 98 - <WriterSmall /> 99 - </> 100 - } 101 - label=<div className="flex flex-row gap-1">Writer</div> 102 - className={current ? "bg-bg-page! border-border-light!" : ""} 103 - /> 104 - ) 105 } 106 > 107 <SpeedyLink href={"/home"} className="hover:!no-underline"> ··· 110 icon={<HomeSmall />} 111 label="Write" 112 className={ 113 - props.currentPage === "home" 114 - ? "bg-bg-page! border-border-light!" 115 - : "" 116 } 117 /> 118 </SpeedyLink> ··· 135 <SpeedyLink href={"/reader"} className="hover:no-underline!"> 136 <ActionButton 137 nav 138 - labelOnMobile={props.compactOnMobile} 139 icon={<ReaderUnreadSmall />} 140 label="Read" 141 className={props.current ? "bg-bg-page! border-border-light!" : ""} ··· 166 </SpeedyLink> 167 ); 168 } 169 - 170 - const Divider = () => { 171 - return ( 172 - <svg 173 - width="6" 174 - height="25" 175 - viewBox="0 0 6 25" 176 - fill="none" 177 - xmlns="http://www.w3.org/2000/svg" 178 - > 179 - <path 180 - d="M0.5 0.5V7.5L5 12.5L0.5 17.5L0.5 24.5" 181 - stroke={theme.colors["border-light"]} 182 - strokeLinecap="round" 183 - strokeLinejoin="round" 184 - /> 185 - </svg> 186 - ); 187 - };
··· 1 import { HomeSmall } from "components/Icons/HomeSmall"; 2 import { ActionButton } from "./ActionButton"; 3 import { useIdentityData } from "components/IdentityProvider"; 4 + import { PublicationButtons } from "./Publications"; 5 import { ReaderUnreadSmall } from "components/Icons/ReaderSmall"; 6 import { 7 NotificationsReadSmall, ··· 10 import { SpeedyLink } from "components/SpeedyLink"; 11 import { Popover } from "components/Popover"; 12 import { WriterSmall } from "components/Icons/WriterSmall"; 13 export type navPages = 14 | "home" 15 | "reader" ··· 41 currentPubUri?: string; 42 compactOnMobile?: boolean; 43 }) => { 44 + console.log(props.currentPage); 45 let current = 46 props.currentPage === "home" || 47 props.currentPage === "looseleafs" || 48 props.currentPage === "pub"; 49 50 return ( 51 <Popover 52 className="p-2!" 53 asChild 54 trigger={ 55 + <ActionButton 56 + nav 57 + labelOnMobile={!props.compactOnMobile} 58 + icon={<WriterSmall />} 59 + label="Write" 60 + className={` w-fit! ${current ? "bg-bg-page! border-border-light!" : ""}`} 61 + /> 62 } 63 > 64 <SpeedyLink href={"/home"} className="hover:!no-underline"> ··· 67 icon={<HomeSmall />} 68 label="Write" 69 className={ 70 + props.currentPage === "home" ? "bg-bg-page! border-border!" : "" 71 } 72 /> 73 </SpeedyLink> ··· 90 <SpeedyLink href={"/reader"} className="hover:no-underline!"> 91 <ActionButton 92 nav 93 + labelOnMobile={!props.compactOnMobile} 94 icon={<ReaderUnreadSmall />} 95 label="Read" 96 className={props.current ? "bg-bg-page! border-border-light!" : ""} ··· 121 </SpeedyLink> 122 ); 123 }