Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): copy a link to a thread #7902

Closedfbehrens(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7902/headopened View on GitHub

Showing 9 changed files with 38 additions and 0 deletions (loading 6).

x
0 of 9 viewed, 9 left
28 additions and 0 deletionsapps/web/src/components/Sidebar.tsxModified
View file
@@ -112,6 +112,7 @@
import { threadEnvironment } from "../state/threads";
import { useEnvironmentQuery } from "../state/query";
import { useAtomCommand } from "../state/use-atom-command";
+import { readThreadLink } from "../threadLink";
import {
buildThreadRouteParams,
resolveActiveThreadRouteRef,
@@ -1772,6 +1773,25 @@
+ const { copyToClipboard: copyLinkToClipboard } = useCopyToClipboard<{ link: string }>({
+ target: "link",
+ onCopy: ({ link }) => {
+ toastManager.add({
+ type: "success",
+ title: "Link copied",
+ description: link,
+ });
+ },
+ onError: (error) => {
+ toastManager.add(
+ stackedThreadToast({
+ type: "error",
+ title: "Failed to copy link",
+ description: error instanceof Error ? error.message : "An error occurred.",
+ }),
+ );