diff options
| author | Mani Sundararajan <[email protected]> | 2026-01-18 06:12:07 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-18 05:12:07 -0600 |
| commit | 06bc4dcb06a814b501dd1190cb1a424eafb91f13 (patch) | |
| tree | e8511825dae3288fe22ea4f28753c9b740bf0a0b /packages/app/src/pages | |
| parent | 0ccf9bd9acf5d861c89c39878f50fc9cd7f48735 (diff) | |
| download | opencode-06bc4dcb06a814b501dd1190cb1a424eafb91f13.tar.gz opencode-06bc4dcb06a814b501dd1190cb1a424eafb91f13.zip | |
feat(desktop): implement session unshare button (#8660)
Diffstat (limited to 'packages/app/src/pages')
| -rw-r--r-- | packages/app/src/pages/session.tsx | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx index dbdbbc7eb..d76ff99b3 100644 --- a/packages/app/src/pages/session.tsx +++ b/packages/app/src/pages/session.tsx @@ -654,6 +654,72 @@ export default function Page() { disabled: !params.id || visibleUserMessages().length === 0, onSelect: () => dialog.show(() => <DialogFork />), }, + ...(sync.data.config.share !== "disabled" + ? [ + { + id: "session.share", + title: "Share session", + description: "Share this session and copy the URL to clipboard", + category: "Session", + slash: "share", + disabled: !params.id || !!info()?.share?.url, + onSelect: async () => { + if (!params.id) return + await sdk.client.session + .share({ sessionID: params.id }) + .then((res) => { + navigator.clipboard.writeText(res.data!.share!.url).catch(() => + showToast({ + title: "Failed to copy URL to clipboard", + variant: "error", + }), + ) + }) + .then(() => + showToast({ + title: "Session shared", + description: "Share URL copied to clipboard!", + variant: "success", + }), + ) + .catch(() => + showToast({ + title: "Failed to share session", + description: "An error occurred while sharing the session", + variant: "error", + }), + ) + }, + }, + { + id: "session.unshare", + title: "Unshare session", + description: "Stop sharing this session", + category: "Session", + slash: "unshare", + disabled: !params.id || !info()?.share?.url, + onSelect: async () => { + if (!params.id) return + await sdk.client.session + .unshare({ sessionID: params.id }) + .then(() => + showToast({ + title: "Session unshared", + description: "Session unshared successfully!", + variant: "success", + }), + ) + .catch(() => + showToast({ + title: "Failed to unshare session", + description: "An error occurred while unsharing the session", + variant: "error", + }), + ) + }, + }, + ] + : []), ]) const handleKeyDown = (event: KeyboardEvent) => { |
