Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(teams): copy invite link button (#4540)

Will Hutchinsona6ca7f975b8e
diff --git a/js/app/packages/app/component/settings/Team.tsx b/js/app/packages/app/component/settings/Team.tsx
index e7ea8d392d..b5fc2c0652 100644
--- a/js/app/packages/app/component/settings/Team.tsx
+++ b/js/app/packages/app/component/settings/Team.tsx
@@ -5,6 +5,7 @@ import TrashIcon from '@phosphor/trash.svg';
import SpinnerIcon from '@phosphor/spinner.svg';
import EnvelopeIcon from '@phosphor/envelope.svg';
import XIcon from '@phosphor/x.svg';
+import LinkIcon from '@phosphor/link.svg';
import CaretDownIcon from '@phosphor/caret-down.svg';
import CheckIcon from '@phosphor/check.svg';
import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
@@ -21,6 +22,7 @@ import {
} from './primitives';
import { Select } from '@kobalte/core/select';
import { useUserId } from '@core/context/user';
+import { getWebOrigin } from '@core/util/webOrigin';
import { useDisplayName, tryMacroId, macroIdToEmail } from '@core/user';
import {
createMemo,
@@ -29,6 +31,7 @@ import {
Index,
mapArray,
Match,
+ onCleanup,
Show,
Suspense,
Switch,
@@ -387,6 +390,23 @@ function InviteRow(props: {
isOwner: boolean;
onCancel: () => void;
}) {
+ const [copied, setCopied] = createSignal(false);
+ let copyResetTimeout: ReturnType<typeof setTimeout> | undefined;
+ onCleanup(() => clearTimeout(copyResetTimeout));
+ const handleCopyLink = async () => {
+ try {
+ await navigator.clipboard.writeText(
+ `${getWebOrigin()}/app/team-invite?id=${props.invite.id}`,
+ );
+ } catch (err) {
+ console.error('Failed to copy to clipboard', err);
+ return;
+ }
+ setCopied(true);
+ clearTimeout(copyResetTimeout);
+ copyResetTimeout = setTimeout(() => setCopied(false), 2000);
+ };
+
return (
<div class="flex items-center justify-between gap-2 px-6 py-3 bg-surface">
<div class="flex items-center gap-3 min-w-0 flex-1">
@@ -404,6 +424,18 @@ function InviteRow(props: {
</div>
</div>
<Show when={props.isOwner}>
+ <Tooltip label={copied() ? 'Copied' : 'Copy invite link'}>
+ <Button
+ variant="ghost"
+ size="sm"
+ class="shrink-0"
+ onClick={handleCopyLink}
+ >
+ <Show when={copied()} fallback={<LinkIcon class="size-4" />}>
+ <CheckIcon class="size-4" />
+ </Show>
+ </Button>
+ </Tooltip>
<Tooltip label="Cancel invite">
<Button
variant="ghost"
diff --git a/js/bun.lock b/js/bun.lock
index 5c83c44a1b..fd13fb759d 100644
--- a/js/bun.lock
+++ b/js/bun.lock
@@ -3742,6 +3742,8 @@
"babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="],
+ "chanfana/zod": ["[email protected]", "", {}, "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="],
+
"cli-truncate/string-width": ["[email protected]", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-IIaP0g3iy9Cyy18w3M9YcaDudujEAVHKt3a3QJg1+sr/oX96TbaGUubG0hJyCjCBThFH+tFpcIyoUHUn1ogaLA=="],
"cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
@@ -3752,8 +3754,6 @@
"concurrently/yargs": ["[email protected]", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w=="],
- "chanfana/zod": ["[email protected]", "", {}, "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="],
-
"csso/css-tree": ["[email protected]", "", { "dependencies": { "mdn-data": "2.0.28", "source-map-js": "^1.0.1" } }, "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA=="],
"datadog-metrics/debug": ["[email protected]", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g=="],