a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added a button to share as template if this doc is designated as such

celine 003491ef 5d153b29

+33 -21
+8 -8
components/Pages/PageShareMenu.tsx
··· 11 11 return ( 12 12 <div> 13 13 <ShareButton 14 - text="Publish this Page" 15 - subtext="Share a read-only link to this page" 16 - helptext="🚨 recipients can view the entire Leaflet" 17 - smokerText="Publish link copied!" 18 - id="get-page-publish-link" 19 - link={`${publishLink}?page=${props.entityID}`} 20 - /> 21 - <ShareButton 22 14 text="Collab on this Page" 23 15 subtext="Invite people to edit this page" 24 16 helptext="🚨 recipients can edit the entire Leaflet" 25 17 smokerText="Collab link copied!" 26 18 id="get-page-collab-link" 27 19 link={`${collabLink}?page=${props.entityID}`} 20 + /> 21 + <ShareButton 22 + text="Publish this Page" 23 + subtext="Share a read-only link to this page" 24 + helptext="🚨 recipients can view the entire Leaflet" 25 + smokerText="Publish link copied!" 26 + id="get-page-publish-link" 27 + link={`${publishLink}?page=${props.entityID}`} 28 28 /> 29 29 </div> 30 30 );
+25 -13
components/ShareOptions/index.tsx
··· 7 7 import { Menu, MenuItem } from "components/Layout"; 8 8 import { HoverButton } from "components/Buttons"; 9 9 import useSWR from "swr"; 10 + import { useTemplateState } from "app/home/CreateNewButton"; 10 11 11 12 export let usePublishLink = () => { 12 13 let { permission_token, rootEntity } = useReplicache(); ··· 29 30 ); 30 31 return publishLink; 31 32 }; 33 + 32 34 export function ShareOptions(props: { rootEntity: string }) { 33 35 let { permission_token } = useReplicache(); 34 36 let entity_set = useEntitySetContext(); ··· 41 43 42 44 let smoker = useSmoker(); 43 45 44 - if ( 45 - !permission_token.permission_token_rights.find( 46 - (s) => s.entity_set === entity_set.set && s.create_token, 47 - ) 48 - ) 49 - return null; 46 + let isTemplate = useTemplateState( 47 + (s) => !!s.templates.find((t) => t.id === permission_token.id), 48 + ); 50 49 51 50 return ( 52 51 <Menu 52 + className="max-w-xs" 53 53 trigger={ 54 54 <HoverButton 55 55 icon=<ShareSmall /> ··· 59 59 /> 60 60 } 61 61 > 62 - <ShareButton 63 - text="Publish" 64 - subtext="Share a read-only version" 65 - smokerText="Publish link copied!" 66 - id="get-publish-link" 67 - link={publishLink || ""} 68 - /> 62 + {isTemplate && ( 63 + <> 64 + <ShareButton 65 + text="Offer Template" 66 + subtext="Let people create new leaflets using this as a template" 67 + smokerText="Template link copied!" 68 + id="get-template-link" 69 + link={`template/${publishLink}` || ""} 70 + /> 71 + <hr className="border-border my-1" /> 72 + </> 73 + )} 69 74 <ShareButton 70 75 text="Collaborate" 71 76 subtext="Invite people to edit together" 72 77 smokerText="Collab link copied!" 73 78 id="get-collab-link" 74 79 link={collabLink} 80 + /> 81 + <ShareButton 82 + text="Publish" 83 + subtext="Share a read-only version" 84 + smokerText="Publish link copied!" 85 + id="get-publish-link" 86 + link={publishLink || ""} 75 87 /> 76 88 </Menu> 77 89 );