a tool for shared writing and social publishing
at update/reader 39 lines 1.2 kB view raw
1import { useLeafletDomains } from "components/PageSWRDataProvider"; 2import { 3 ShareButton, 4 useReadOnlyShareLink, 5} from "app/[leaflet_id]/actions/ShareOptions"; 6import { useEffect, useState } from "react"; 7 8export const PageShareMenu = (props: { entityID: string }) => { 9 let publishLink = useReadOnlyShareLink(); 10 let { data: domains } = useLeafletDomains(); 11 let [collabLink, setCollabLink] = useState<null | string>(null); 12 useEffect(() => { 13 setCollabLink(window.location.pathname); 14 }, []); 15 16 return ( 17 <div> 18 <ShareButton 19 text="Share Edit Link" 20 subtext="Recipients can edit the full Leaflet" 21 smokerText="Collab link copied!" 22 id="get-page-collab-link" 23 link={`${collabLink}?page=${props.entityID}`} 24 /> 25 <ShareButton 26 text="Share View Link" 27 subtext="Recipients can view the full Leaflet" 28 smokerText="Publish link copied!" 29 id="get-page-publish-link" 30 fullLink={ 31 domains?.[0] 32 ? `https://${domains[0].domain}${domains[0].route}?page=${props.entityID}` 33 : undefined 34 } 35 link={`${publishLink}?page=${props.entityID}`} 36 /> 37 </div> 38 ); 39};