a tool for shared writing and social publishing

write invite link to clipboard

+21 -14
+21 -14
app/lish/[did]/[publication]/dashboard/publicationSettings/PublicationContributors.tsx
··· 9 9 import { ButtonPrimary } from "components/Buttons"; 10 10 import { PopoverArrow } from "components/Icons/PopoverArrow"; 11 11 import { useSmoker } from "components/Toast"; 12 + import { usePublicationData } from "../PublicationSWRProvider"; 13 + import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; 12 14 13 15 export const PubContributorManager = (props: { 14 16 backToMenuAction: () => void; ··· 55 57 contributors: { name: string; status: string }[]; 56 58 }) => { 57 59 let [inputValue, setInputValue] = useState(""); 60 + let smoker = useSmoker(); 61 + let { data: pub } = usePublicationData(); 62 + 63 + function getContributorLink(e: React.MouseEvent) { 64 + let pubUrl = getPublicationURL(pub?.publication!); 65 + navigator.clipboard.writeText(`${pubUrl}/invite-contributor`); 66 + 67 + smoker({ 68 + text: "Copied Invite Link!", 69 + position: { 70 + y: e.clientY, 71 + x: e.clientX, 72 + }, 73 + }); 74 + } 75 + 58 76 return ( 59 77 <div className="flex flex-col gap-1 pt-2"> 60 78 <div className="flex flex-col gap-0.5"> ··· 72 90 </div> 73 91 </div> 74 92 93 + {/*ONLY SHOW ON ADD*/} 75 94 <div className="flex flex-col gap-1 text-sm text-secondary text-center mb-2 mt-1 p-2 accent-container"> 76 95 <ButtonPrimary fullWidth compact onClick={(e) => getContributorLink(e)}> 77 96 Copy Accept Invite Link 78 97 </ButtonPrimary> 79 - Send this link to contributors so they can access this publication 98 + Send this link to invited contributors to access this publication 80 99 </div> 81 100 <hr className="border-border-light" /> 82 101 ··· 93 112 className="text-sm text-accent-contrast italic w-max shrink-0" 94 113 onClick={(e) => getContributorLink(e)} 95 114 > 96 - Resend Invite 115 + Copy Invite 97 116 </button> 98 117 )} 99 118 ··· 105 124 </div> 106 125 ); 107 126 }; 108 - 109 - function getContributorLink(e: React.MouseEvent) { 110 - let smoker = useSmoker(); 111 - 112 - smoker({ 113 - text: "Copied Invite Link!", 114 - position: { 115 - y: e.clientY, 116 - x: e.clientX, 117 - }, 118 - }); 119 - } 120 127 121 128 const PubContributorOptions = () => { 122 129 return (