···1111 return (
1212 <div>
1313 <ShareButton
1414- text="Publish this Page"
1515- subtext="Share a read-only link to this page"
1616- helptext="🚨 recipients can view the entire Leaflet"
1717- smokerText="Publish link copied!"
1818- id="get-page-publish-link"
1919- link={`${publishLink}?page=${props.entityID}`}
2020- />
2121- <ShareButton
2214 text="Collab on this Page"
2315 subtext="Invite people to edit this page"
2416 helptext="🚨 recipients can edit the entire Leaflet"
2517 smokerText="Collab link copied!"
2618 id="get-page-collab-link"
2719 link={`${collabLink}?page=${props.entityID}`}
2020+ />
2121+ <ShareButton
2222+ text="Publish this Page"
2323+ subtext="Share a read-only link to this page"
2424+ helptext="🚨 recipients can view the entire Leaflet"
2525+ smokerText="Publish link copied!"
2626+ id="get-page-publish-link"
2727+ link={`${publishLink}?page=${props.entityID}`}
2828 />
2929 </div>
3030 );
+25-13
components/ShareOptions/index.tsx
···77import { Menu, MenuItem } from "components/Layout";
88import { HoverButton } from "components/Buttons";
99import useSWR from "swr";
1010+import { useTemplateState } from "app/home/CreateNewButton";
10111112export let usePublishLink = () => {
1213 let { permission_token, rootEntity } = useReplicache();
···2930 );
3031 return publishLink;
3132};
3333+3234export function ShareOptions(props: { rootEntity: string }) {
3335 let { permission_token } = useReplicache();
3436 let entity_set = useEntitySetContext();
···41434244 let smoker = useSmoker();
43454444- if (
4545- !permission_token.permission_token_rights.find(
4646- (s) => s.entity_set === entity_set.set && s.create_token,
4747- )
4848- )
4949- return null;
4646+ let isTemplate = useTemplateState(
4747+ (s) => !!s.templates.find((t) => t.id === permission_token.id),
4848+ );
50495150 return (
5251 <Menu
5252+ className="max-w-xs"
5353 trigger={
5454 <HoverButton
5555 icon=<ShareSmall />
···5959 />
6060 }
6161 >
6262- <ShareButton
6363- text="Publish"
6464- subtext="Share a read-only version"
6565- smokerText="Publish link copied!"
6666- id="get-publish-link"
6767- link={publishLink || ""}
6868- />
6262+ {isTemplate && (
6363+ <>
6464+ <ShareButton
6565+ text="Offer Template"
6666+ subtext="Let people create new leaflets using this as a template"
6767+ smokerText="Template link copied!"
6868+ id="get-template-link"
6969+ link={`template/${publishLink}` || ""}
7070+ />
7171+ <hr className="border-border my-1" />
7272+ </>
7373+ )}
6974 <ShareButton
7075 text="Collaborate"
7176 subtext="Invite people to edit together"
7277 smokerText="Collab link copied!"
7378 id="get-collab-link"
7479 link={collabLink}
8080+ />
8181+ <ShareButton
8282+ text="Publish"
8383+ subtext="Share a read-only version"
8484+ smokerText="Publish link copied!"
8585+ id="get-publish-link"
8686+ link={publishLink || ""}
7587 />
7688 </Menu>
7789 );