diff --git a/src/clients/Weechat.tsx b/src/clients/Weechat.tsx index e88dc24..a29c150 100644 --- a/src/clients/Weechat.tsx +++ b/src/clients/Weechat.tsx @@ -57,6 +57,17 @@ const Weechat: TextClient = { return Weechat doesn't support this kind of link; } }, + copyString: (link) => { + switch (link.kind) { + case LinkKind.Alias: + case LinkKind.RoomId: + return `/join ${link.identifier}`; + case LinkKind.UserId: + return `/invite ${link.identifier}`; + default: + return ''; + } + }, description: 'Commandline Matrix interface using Weechat', }; diff --git a/src/clients/types.ts b/src/clients/types.ts index 2df503b..cdaed27 100644 --- a/src/clients/types.ts +++ b/src/clients/types.ts @@ -81,6 +81,7 @@ export interface LinkedClient extends ClientDescription { export interface TextClient extends ClientDescription { kind: ClientKind.TEXT_CLIENT; toInviteString(parsedLink: SafeLink): JSX.Element; + copyString(parsedLink: SafeLink): string; } /* diff --git a/src/components/ClientTile.tsx b/src/components/ClientTile.tsx index 7644782..ba3e57d 100644 --- a/src/components/ClientTile.tsx +++ b/src/components/ClientTile.tsx @@ -42,7 +42,16 @@ const ClientTile: React.FC = ({ client, link }: IProps) => { const inviteButton = client.kind === ClientKind.LINKED_CLIENT ? ( - ) : null; + ) : ( + + ); let clientTile = ( diff --git a/src/components/InviteTile.tsx b/src/components/InviteTile.tsx index 1311f9f..a35b2c7 100644 --- a/src/components/InviteTile.tsx +++ b/src/components/InviteTile.tsx @@ -61,6 +61,7 @@ const InviteTile: React.FC = ({ children, client, link }: IProps) => { case ClientKind.TEXT_CLIENT: // TODO: copy to clipboard invite =

{client.toInviteString(link)}

; + navigator.clipboard.writeText(client.copyString(link)); inviteUseString = `These are instructions for ${client.name}.`; break; }