diff --git a/app/[leaflet_id]/actions/PublishButton.tsx b/app/[leaflet_id]/actions/PublishButton.tsx index a17a31ce..f5db76fb 100644 --- a/app/[leaflet_id]/actions/PublishButton.tsx +++ b/app/[leaflet_id]/actions/PublishButton.tsx @@ -53,9 +53,9 @@ export const PublishButton = (props: { entityID: string }) => { } - label={"Publish!"} + label={"Publish!!!"} onClick={() => { router.push(`/${params.leaflet_id}/publish`); }} @@ -196,10 +196,10 @@ const PublishToPublicationButton = (props: { entityID: string }) => { trigger={ } - label={"Publish"} + label={"Publish!"} /> } > diff --git a/components/ActionBar/DesktopNavigation.tsx b/components/ActionBar/DesktopNavigation.tsx index 027ed8a2..b30d6efc 100644 --- a/components/ActionBar/DesktopNavigation.tsx +++ b/components/ActionBar/DesktopNavigation.tsx @@ -72,17 +72,18 @@ export const NavigationContent = (props: NavigationProps) => { <> {props.pageTitle} -
- {props.actions && ( <> +
+
{props.actions}
-
)} {props.tabs && ( <> +
+ {Object.entries(props.tabs).map(([name, { href, icon }]) => ( { let { identity } = useIdentityData(); @@ -27,51 +29,74 @@ export const PublicationButtons = (props: { className?: string }) => { f.permission_tokens.leaflets_to_documents && f.permission_tokens.leaflets_to_documents[0]?.document, ); - - // don't show pub list button if not logged in or no pub list + let { data: localLeaflets } = useSWR("leaflets", () => getHomeDocs(), { + fallbackData: [], + }); + let hasDocs = identity + ? identity.permission_token_on_homepage.length > 0 + : localLeaflets.filter((d) => !d.hidden).length > 0; + + // don't show pub list button if + // no pubs or looseleafs but has docs + // if they don't have docs, the empty state of the homepage prompts them to make publications // we show a "start a pub" banner instead + console.log(hasDocs); + if ( + !hasLooseleafs && + hasDocs && + (!identity || identity.publications.length === 0) + ) + return ; + if ( - !identity || - !identity.atp_did || - (!hasLooseleafs && identity.publications.length === 0) + !hasLooseleafs && + !hasDocs && + (!identity || identity.publications.length === 0) ) - return ; + return null; return ( -
-
PUBLICATIONS
- {hasLooseleafs && ( - <> - - {/*TODO How should i get if this is the current page or not? - theres not "pub" to check the uri for. Do i need to add it as an option to NavPages? thats kinda annoying*/} - } - /> - -
- - )} + <> +
- {identity.publications?.map((d) => { - return ; - })} - - - label="New Publication" - className="text-tertiary!" - /> - -
+
PUBLICATIONS
+ {hasLooseleafs && ( + <> + + {/*TODO How should i get if this is the current page or not? + theres not "pub" to check the uri for. Do i need to add it as an option to NavPages? thats kinda annoying*/} + } + /> + +
+ + )} + + {identity?.publications?.map((d) => { + return ; + })} + + + label="New Publication" + className="text-tertiary!" + /> + + + ); }; @@ -99,57 +124,12 @@ export const PublicationOption = (props: { ); }; -const PubListEmpty = () => { - let initialRender = useIsInitialRender(); - let mobile = useIsMobile(); - let isMobile = !initialRender && mobile; - - let [state, setState] = useState<"default" | "info">("default"); - if (isMobile && state == "default") - return ( - } - subtext="Start a blog on ATProto!" - onClick={(e) => { - e.preventDefault(); - e.stopPropagation(); - setState("info"); - }} - /> - ); - - if (isMobile && state === "info") return ; - else - return ( - } - subtext="Start a blog on ATProto!" - /> - } - > - - - ); -}; - export const PubListEmptyContent = (props: { compact?: boolean }) => { let { identity } = useIdentityData(); return (