diff --git a/app/(home-pages)/home/Actions/Actions.tsx b/app/(home-pages)/home/Actions/Actions.tsx index c52ece50..c728e89d 100644 --- a/app/(home-pages)/home/Actions/Actions.tsx +++ b/app/(home-pages)/home/Actions/Actions.tsx @@ -1,7 +1,7 @@ "use client"; import { ThemePopover } from "components/ThemeManager/ThemeSetter"; import { CreateNewLeafletButton } from "./CreateNewButton"; -import { HelpPopover } from "components/HelpPopover"; +import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; import { AccountSettings } from "./AccountSettings"; import { useIdentityData } from "components/IdentityProvider"; import { useReplicache } from "src/replicache"; @@ -16,7 +16,7 @@ export const Actions = () => { {identity ? : } {/**/} - + ); }; diff --git a/app/[leaflet_id]/Footer.tsx b/app/[leaflet_id]/Footer.tsx index d6eb1ff3..42e06fb1 100644 --- a/app/[leaflet_id]/Footer.tsx +++ b/app/[leaflet_id]/Footer.tsx @@ -4,12 +4,13 @@ import { Footer as ActionFooter } from "components/ActionBar/Footer"; import { Media } from "components/Media"; import { ThemePopover } from "components/ThemeManager/ThemeSetter"; import { Toolbar } from "components/Toolbar"; -import { ShareOptions } from "components/ShareOptions"; -import { HomeButton } from "components/HomeButton"; +import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; +import { HomeButton } from "app/[leaflet_id]/actions/HomeButton"; +import { PublishButton } from "./actions/PublishButton"; import { useEntitySetContext } from "components/EntitySetProvider"; -import { HelpPopover } from "components/HelpPopover"; +import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; import { Watermark } from "components/Watermark"; -import { BackToPubButton, PublishButton } from "./Actions"; +import { BackToPubButton } from "./actions/BackToPubButton"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; import { useIdentityData } from "components/IdentityProvider"; @@ -43,14 +44,14 @@ export function LeafletFooter(props: { entityID: string }) { - + ) : ( - + ) diff --git a/app/[leaflet_id]/Sidebar.tsx b/app/[leaflet_id]/Sidebar.tsx index edbdf086..5a9bd9a1 100644 --- a/app/[leaflet_id]/Sidebar.tsx +++ b/app/[leaflet_id]/Sidebar.tsx @@ -2,15 +2,16 @@ import { ActionButton } from "components/ActionBar/ActionButton"; import { Sidebar } from "components/ActionBar/Sidebar"; import { useEntitySetContext } from "components/EntitySetProvider"; -import { HelpPopover } from "components/HelpPopover"; -import { HomeButton } from "components/HomeButton"; +import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; +import { HomeButton } from "app/[leaflet_id]/actions/HomeButton"; import { Media } from "components/Media"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; -import { ShareOptions } from "components/ShareOptions"; +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, PublishButton } from "./Actions"; +import { BackToPubButton } from "./actions/BackToPubButton"; import { useIdentityData } from "components/IdentityProvider"; import { useReplicache } from "src/replicache"; @@ -36,7 +37,7 @@ export function LeafletSidebar() { - +
@@ -44,7 +45,7 @@ export function LeafletSidebar() { <> - +
diff --git a/app/[leaflet_id]/actions/BackToPubButton.tsx b/app/[leaflet_id]/actions/BackToPubButton.tsx new file mode 100644 index 00000000..574eb57b --- /dev/null +++ b/app/[leaflet_id]/actions/BackToPubButton.tsx @@ -0,0 +1,27 @@ +import { getBasePublicationURL } from "app/lish/createPub/getPublicationURL"; +import { ActionButton } from "components/ActionBar/ActionButton"; +import { GoBackSmall } from "components/Icons/GoBackSmall"; +import { SpeedyLink } from "components/SpeedyLink"; +import { Json } from "supabase/database.types"; + +export const BackToPubButton = (props: { + publication: { + identity_did: string; + indexed_at: string; + name: string; + record: Json; + uri: string; + }; +}) => { + return ( + + } + label="To Pub" + /> + + ); +}; diff --git a/components/HelpPopover.tsx b/app/[leaflet_id]/actions/HelpButton.tsx similarity index 94% rename from components/HelpPopover.tsx rename to app/[leaflet_id]/actions/HelpButton.tsx index 84623469..651a4b54 100644 --- a/components/HelpPopover.tsx +++ b/app/[leaflet_id]/actions/HelpButton.tsx @@ -1,16 +1,16 @@ "use client"; -import { ShortcutKey } from "./Layout"; -import { Media } from "./Media"; -import { Popover } from "./Popover"; +import { ShortcutKey } from "../../../components/Layout"; +import { Media } from "../../../components/Media"; +import { Popover } from "../../../components/Popover"; import { metaKey } from "src/utils/metaKey"; -import { useEntitySetContext } from "./EntitySetProvider"; +import { useEntitySetContext } from "../../../components/EntitySetProvider"; import { useState } from "react"; import { ActionButton } from "components/ActionBar/ActionButton"; -import { HelpSmall } from "./Icons/HelpSmall"; +import { HelpSmall } from "../../../components/Icons/HelpSmall"; import { isMac } from "src/utils/isDevice"; import { useIsMobile } from "src/hooks/isMobile"; -export const HelpPopover = (props: { noShortcuts?: boolean }) => { +export const HelpButton = (props: { noShortcuts?: boolean }) => { let entity_set = useEntitySetContext(); let isMobile = useIsMobile(); diff --git a/components/HomeButton.tsx b/app/[leaflet_id]/actions/HomeButton.tsx similarity index 82% rename from components/HomeButton.tsx rename to app/[leaflet_id]/actions/HomeButton.tsx index ec73e044..5ed2ccb3 100644 --- a/components/HomeButton.tsx +++ b/app/[leaflet_id]/actions/HomeButton.tsx @@ -1,15 +1,14 @@ "use client"; import Link from "next/link"; -import { useEntitySetContext } from "./EntitySetProvider"; +import { useEntitySetContext } from "../../../components/EntitySetProvider"; import { ActionButton } from "components/ActionBar/ActionButton"; -import { useParams, useSearchParams } from "next/navigation"; -import { useIdentityData } from "./IdentityProvider"; +import { useSearchParams } from "next/navigation"; +import { useIdentityData } from "../../../components/IdentityProvider"; import { useReplicache } from "src/replicache"; import { addLeafletToHome } from "actions/addLeafletToHome"; -import { useSmoker } from "./Toast"; -import { AddToHomeSmall } from "./Icons/AddToHomeSmall"; -import { HomeSmall } from "./Icons/HomeSmall"; -import { permission } from "process"; +import { useSmoker } from "../../../components/Toast"; +import { AddToHomeSmall } from "../../../components/Icons/AddToHomeSmall"; +import { HomeSmall } from "../../../components/Icons/HomeSmall"; export function HomeButton() { let { permissions } = useEntitySetContext(); diff --git a/app/[leaflet_id]/Actions.tsx b/app/[leaflet_id]/actions/PublishButton.tsx similarity index 75% rename from app/[leaflet_id]/Actions.tsx rename to app/[leaflet_id]/actions/PublishButton.tsx index ebb6c89f..46b7a286 100644 --- a/app/[leaflet_id]/Actions.tsx +++ b/app/[leaflet_id]/actions/PublishButton.tsx @@ -1,46 +1,28 @@ import { publishToPublication } from "actions/publishToPublication"; -import { - getBasePublicationURL, - getPublicationURL, -} from "app/lish/createPub/getPublicationURL"; +import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; import { ActionButton } from "components/ActionBar/ActionButton"; -import { GoBackSmall } from "components/Icons/GoBackSmall"; import { PublishSmall } from "components/Icons/PublishSmall"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; import { SpeedyLink } from "components/SpeedyLink"; import { useToaster } from "components/Toast"; import { DotLoader } from "components/utils/DotLoader"; -import { useParams, useRouter } from "next/navigation"; +import { useParams } from "next/navigation"; +import { useRouter } from "next/router"; import { useState } from "react"; import { useReplicache } from "src/replicache"; -import { Json } from "supabase/database.types"; - -export const BackToPubButton = (props: { - publication: { - identity_did: string; - indexed_at: string; - name: string; - record: Json; - uri: string; - }; -}) => { - return ( - - } - label="To Pub" - /> - - ); -}; export const PublishButton = () => { let { data: pub } = useLeafletPublicationData(); let params = useParams(); let router = useRouter(); + if (!pub) + return ( + } + label={"Publish on ATP"} + /> + ); if (!pub?.doc) return ( diff --git a/components/ShareOptions/getShareLink.ts b/app/[leaflet_id]/actions/ShareOptions/getShareLink.ts similarity index 100% rename from components/ShareOptions/getShareLink.ts rename to app/[leaflet_id]/actions/ShareOptions/getShareLink.ts diff --git a/components/ShareOptions/index.tsx b/app/[leaflet_id]/actions/ShareOptions/index.tsx similarity index 98% rename from components/ShareOptions/index.tsx rename to app/[leaflet_id]/actions/ShareOptions/index.tsx index 8eeb8577..42193570 100644 --- a/components/ShareOptions/index.tsx +++ b/app/[leaflet_id]/actions/ShareOptions/index.tsx @@ -22,7 +22,7 @@ import { useIsMobile } from "src/hooks/isMobile"; export type ShareMenuStates = "default" | "login" | "domain"; -export let usePublishLink = () => { +export let useReadOnlyShareLink = () => { let { permission_token, rootEntity } = useReplicache(); let entity_set = useEntitySetContext(); let { data: publishLink } = useSWR( @@ -98,7 +98,7 @@ const ShareMenu = (props: { pub?.publications && pub.documents ? `${getPublicationURL(pub.publications)}/${new AtUri(pub?.documents.uri).rkey}` : null; - let publishLink = usePublishLink(); + let publishLink = useReadOnlyShareLink(); let [collabLink, setCollabLink] = useState(null); useEffect(() => { // strip leading '/' character from pathname diff --git a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx index 3d998853..3520728d 100644 --- a/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx +++ b/app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx @@ -13,7 +13,7 @@ import { ButtonPrimary } from "components/Buttons"; import { MoreOptionsVerticalTiny } from "components/Icons/MoreOptionsVerticalTiny"; import { DeleteSmall } from "components/Icons/DeleteSmall"; import { ShareSmall } from "components/Icons/ShareSmall"; -import { ShareButton } from "components/ShareOptions"; +import { ShareButton } from "app/[leaflet_id]/actions/ShareOptions"; import { SpeedyLink } from "components/SpeedyLink"; import { QuoteTiny } from "components/Icons/QuoteTiny"; import { CommentTiny } from "components/Icons/CommentTiny"; @@ -237,9 +237,5 @@ function PublishedDate(props: { dateString: string }) { day: "2-digit", }); - return ( -

- Published {formattedDate} -

- ); + return

Published {formattedDate}

; } diff --git a/components/Blocks/RSVPBlock/SendUpdate.tsx b/components/Blocks/RSVPBlock/SendUpdate.tsx index fa9817af..fb13b7f6 100644 --- a/components/Blocks/RSVPBlock/SendUpdate.tsx +++ b/components/Blocks/RSVPBlock/SendUpdate.tsx @@ -9,10 +9,10 @@ import { useToaster } from "components/Toast"; import { sendUpdateToRSVPS } from "actions/sendUpdateToRSVPS"; import { useReplicache } from "src/replicache"; import { Checkbox } from "components/Checkbox"; -import { usePublishLink } from "components/ShareOptions"; +import { useReadOnlyShareLink } from "app/[leaflet_id]/actions/ShareOptions"; export function SendUpdateButton(props: { entityID: string }) { - let publishLink = usePublishLink(); + let publishLink = useReadOnlyShareLink(); let { permissions } = useEntitySetContext(); let { permission_token } = useReplicache(); let [input, setInput] = useState(""); diff --git a/components/Pages/PageShareMenu.tsx b/components/Pages/PageShareMenu.tsx index e4b37e7a..7e706706 100644 --- a/components/Pages/PageShareMenu.tsx +++ b/components/Pages/PageShareMenu.tsx @@ -1,9 +1,12 @@ import { useLeafletDomains } from "components/PageSWRDataProvider"; -import { ShareButton, usePublishLink } from "components/ShareOptions"; +import { + ShareButton, + useReadOnlyShareLink, +} from "app/[leaflet_id]/actions/ShareOptions"; import { useEffect, useState } from "react"; export const PageShareMenu = (props: { entityID: string }) => { - let publishLink = usePublishLink(); + let publishLink = useReadOnlyShareLink(); let { data: domains } = useLeafletDomains(); let [collabLink, setCollabLink] = useState(null); useEffect(() => {