Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: show copied text when monograph link is copied (#9780)

01zulfi13e657334264
diff --git a/apps/web/src/components/publish-view/index.tsx b/apps/web/src/components/publish-view/index.tsx
index 605df4a26..f59ac3043 100644
--- a/apps/web/src/components/publish-view/index.tsx
+++ b/apps/web/src/components/publish-view/index.tsx
@@ -60,6 +60,7 @@ function PublishView(props: PublishViewProps) {
const publishNote = useStore((store) => store.publish);
const unpublishNote = useStore((store) => store.unpublish);
const [monograph, setMonograph] = useState(props.monograph);
+ const [copied, setCopied] = useState(false);
const monographAnalytics = useIsFeatureAvailable("monographAnalytics");
const analytics = usePromise(async () => {
if (!monographAnalytics?.isAllowed || !monograph) return { totalViews: 0 };
@@ -110,12 +111,15 @@ function PublishView(props: PublishViewProps) {
<Button
variant="secondary"
className="copyPublishLink"
- sx={{ flexShrink: 0, m: 0 }}
+ sx={{ flexShrink: 0, m: 0, color: copied ? "accent" : "initial" }}
onClick={() => {
writeText(`${hosts.MONOGRAPH_HOST}/${monograph?.id}`);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
}}
+ disabled={copied}
>
- {strings.copy()}
+ {copied ? strings.copied() : strings.copy()}
</Button>
</Flex>
) : null}