diff --git a/app/[leaflet_id]/Sidebar.tsx b/app/[leaflet_id]/Sidebar.tsx index 5a9bd9a1..29e7873d 100644 --- a/app/[leaflet_id]/Sidebar.tsx +++ b/app/[leaflet_id]/Sidebar.tsx @@ -1,5 +1,4 @@ "use client"; -import { ActionButton } from "components/ActionBar/ActionButton"; import { Sidebar } from "components/ActionBar/Sidebar"; import { useEntitySetContext } from "components/EntitySetProvider"; import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; @@ -10,7 +9,6 @@ import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; import { ThemePopover } from "components/ThemeManager/ThemeSetter"; import { PublishButton } from "./actions/PublishButton"; import { Watermark } from "components/Watermark"; -import { useUIState } from "src/useUIState"; import { BackToPubButton } from "./actions/BackToPubButton"; import { useIdentityData } from "components/IdentityProvider"; import { useReplicache } from "src/replicache"; @@ -30,25 +28,17 @@ export function LeafletSidebar() {
{entity_set.permissions.write && ( + + + + +
{pub?.publications && identity?.atp_did && pub.publications.identity_did === identity.atp_did ? ( - <> - - - - -
- - + ) : ( - <> - - - -
- - + )}
)} @@ -60,10 +50,3 @@ export function LeafletSidebar() { ); } - -const blurPage = () => { - useUIState.setState(() => ({ - focusedEntity: null, - selectedBlocks: [], - })); -}; diff --git a/app/[leaflet_id]/actions/PublishButton.tsx b/app/[leaflet_id]/actions/PublishButton.tsx index 46b7a286..96c2c921 100644 --- a/app/[leaflet_id]/actions/PublishButton.tsx +++ b/app/[leaflet_id]/actions/PublishButton.tsx @@ -1,28 +1,31 @@ import { publishToPublication } from "actions/publishToPublication"; import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; import { ActionButton } from "components/ActionBar/ActionButton"; +import { + PubIcon, + PubListEmptyContent, +} from "components/ActionBar/Publications"; +import { ArchiveSmall } from "components/Icons/ArchiveSmall"; import { PublishSmall } from "components/Icons/PublishSmall"; +import { useIdentityData } from "components/IdentityProvider"; +import { Menu, MenuItem } from "components/Layout"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; +import { Popover } from "components/Popover"; import { SpeedyLink } from "components/SpeedyLink"; import { useToaster } from "components/Toast"; import { DotLoader } from "components/utils/DotLoader"; -import { useParams } from "next/navigation"; -import { useRouter } from "next/router"; +import { PubLeafletPublication } from "lexicons/api"; +import { useParams, useRouter } from "next/navigation"; import { useState } from "react"; +import { useIsMobile } from "src/hooks/isMobile"; import { useReplicache } from "src/replicache"; export const PublishButton = () => { let { data: pub } = useLeafletPublicationData(); let params = useParams(); let router = useRouter(); - if (!pub) - return ( - } - label={"Publish on ATP"} - /> - ); + + if (!pub) return ; if (!pub?.doc) return ( { /> ); }; + +const PublishToPublication = () => { + let { identity } = useIdentityData(); + let params = useParams(); + let router = useRouter(); + let isMobile = useIsMobile(); + let hasPubs = + identity && identity.atp_did && identity.publications.length > 0; + + if (!hasPubs) + return ( + } + label={"Publish on ATP"} + /> + } + > +
Publish to…
+ {identity?.publications?.map((d) => { + return ( + { + // TODO + // make this a draft of the selected Publication + // redirect to the publication publish page + }} + > + +
{d.name}
+
+ ); + })} +
+ { + // TODO + // send to one-off /publish page + }} + > + +
Publish as One-Off
+
+
+ ); + else + return ( + } + label={"Publish on ATP"} + /> + } + > + {/* this component is also used on Home to populate the sidebar when PubList is empty */} + {/* however, this component needs to redirect to sign in, pub creation, AND publish so we might need to just make a new component */} + + + + ); +}; diff --git a/components/ActionBar/Publications.tsx b/components/ActionBar/Publications.tsx index a16f8aee..e3b54f5a 100644 --- a/components/ActionBar/Publications.tsx +++ b/components/ActionBar/Publications.tsx @@ -12,7 +12,7 @@ import { SpeedyLink } from "components/SpeedyLink"; import { PublishSmall } from "components/Icons/PublishSmall"; import { Popover } from "components/Popover"; import { BlueskyLogin } from "app/login/LoginForm"; -import { ButtonPrimary } from "components/Buttons"; +import { ButtonSecondary } from "components/Buttons"; import { useIsMobile } from "src/hooks/isMobile"; import { useState } from "react"; @@ -81,7 +81,6 @@ export const PublicationOption = (props: { }; const PubListEmpty = () => { - let { identity } = useIdentityData(); let isMobile = useIsMobile(); let [state, setState] = useState<"default" | "info">("default"); @@ -98,7 +97,7 @@ const PubListEmpty = () => { /> ); - if (isMobile && state === "info") return ; + if (isMobile && state === "info") return ; else return ( { /> } > - + ); }; -const PublishPopoverContent = () => { +export const PubListEmptyContent = () => { let { identity } = useIdentityData(); return ( @@ -136,9 +135,9 @@ const PublishPopoverContent = () => { on AT Proto
- + Start a Publication! - + ) : (