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