diff --git a/components/ActionBar/ActionButton.tsx b/components/ActionBar/ActionButton.tsx index 6a4ebd46..0cd62d03 100644 --- a/components/ActionBar/ActionButton.tsx +++ b/components/ActionBar/ActionButton.tsx @@ -86,10 +86,3 @@ export const ActionButton = ( ); }; - -// ok currently in the middle of making the actions on home, looseleaf, and pub appear at the top by the page title -// i then need to find a good place for the publication list in the footer -// but first i really need to refactor action button -// 1) make a primary variant -// 2) make a secondary variant -// \ No newline at end of file diff --git a/components/ActionBar/MobileNavigation.tsx b/components/ActionBar/MobileNavigation.tsx index 634fb343..db63d327 100644 --- a/components/ActionBar/MobileNavigation.tsx +++ b/components/ActionBar/MobileNavigation.tsx @@ -22,6 +22,7 @@ import { TagSmall } from "components/Icons/TagSmall"; import { Avatar } from "components/Avatar"; import { useProfileFromDid } from "src/utils/getRecordFromDid"; import { LoginActionButton } from "components/LoginButton"; +import { ButtonPrimary } from "components/Buttons"; export const MobileNavigation = (props: { currentPage: navPages; @@ -33,36 +34,94 @@ export const MobileNavigation = (props: { let compactOnMobile = props.currentPage === "home" || props.currentPage === "looseleafs" || - props.currentPage === "pub" - ? false - : true; + props.currentPage === "pub"; + function getPubIcons() { + let hasLooseleafs = !!identity?.permission_token_on_homepage.find( + (f) => + f.permission_tokens.leaflets_to_documents && + f.permission_tokens.leaflets_to_documents[0]?.document, + ); + + if (identity && identity.publications.length >= 1) { + return ( +
+ Publications +
+ {identity.publications.map((pub, index) => { + if (index <= 3) + return ( + + ); + })} +
+
+ ); + } + if (identity && hasLooseleafs) { + return ( +
+ +
+ ); + } else + return ( + + Create a Publication! + + ); + } return (
-
- - +
+
+ + +
+ {identity?.atp_did ? ( + <> + {compactOnMobile && } + + + ) : ( + + )}
- {identity?.atp_did ? ( - <> - {!compactOnMobile && } - - - ) : ( - + + {compactOnMobile && ( + + +
+ +
)}
); diff --git a/components/ActionBar/NavigationButtons.tsx b/components/ActionBar/NavigationButtons.tsx index ae3a7c27..2e1995c7 100644 --- a/components/ActionBar/NavigationButtons.tsx +++ b/components/ActionBar/NavigationButtons.tsx @@ -1,9 +1,7 @@ import { HomeSmall } from "components/Icons/HomeSmall"; import { ActionButton } from "./ActionButton"; import { useIdentityData } from "components/IdentityProvider"; -import Link from "next/link"; -import { DiscoverSmall } from "components/Icons/DiscoverSmall"; -import { PubIcon, PublicationButtons } from "./Publications"; +import { PublicationButtons } from "./Publications"; import { ReaderUnreadSmall } from "components/Icons/ReaderSmall"; import { NotificationsReadSmall, @@ -12,10 +10,6 @@ import { import { SpeedyLink } from "components/SpeedyLink"; import { Popover } from "components/Popover"; import { WriterSmall } from "components/Icons/WriterSmall"; -import { LooseLeafSmall } from "components/Icons/LooseleafSmall"; -import { normalizePublicationRecord } from "src/utils/normalizeRecords"; -import { theme } from "tailwind.config"; - export type navPages = | "home" | "reader" @@ -47,61 +41,24 @@ export const WriterButton = (props: { currentPubUri?: string; compactOnMobile?: boolean; }) => { - let { identity } = useIdentityData(); - - let currentPub = identity?.publications?.find( - (pub) => pub.uri === props.currentPubUri, - ); - let pubRecord = currentPub - ? normalizePublicationRecord(currentPub.record) - : null; - + console.log(props.currentPage); let current = props.currentPage === "home" || props.currentPage === "looseleafs" || props.currentPage === "pub"; - console.log(current); - - let currentPubIcon = - currentPub && pubRecord ? ( - - ) : null; - - let currentIcon = - props.currentPage === "home" ? ( - - ) : props.currentPage === "looseleafs" ? ( - - ) : props.currentPage === "pub" ? ( - currentPubIcon - ) : null; return ( } - label=
Write
- className={current ? "bg-bg-page! border-border-light!" : ""} - /> - ) : ( - - - - } - label=
Writer
- className={current ? "bg-bg-page! border-border-light!" : ""} - /> - ) + } + label="Write" + className={` w-fit! ${current ? "bg-bg-page! border-border-light!" : ""}`} + /> } > @@ -110,9 +67,7 @@ export const WriterButton = (props: { icon={} label="Write" className={ - props.currentPage === "home" - ? "bg-bg-page! border-border-light!" - : "" + props.currentPage === "home" ? "bg-bg-page! border-border!" : "" } /> @@ -135,7 +90,7 @@ export const ReaderButton = (props: { } label="Read" className={props.current ? "bg-bg-page! border-border-light!" : ""} @@ -166,22 +121,3 @@ export function NotificationButton(props: { current?: boolean }) { ); } - -const Divider = () => { - return ( - - - - ); -};