From b02b45c17aae711153e99454f1009c84bf742936 Mon Sep 17 00:00:00 2001 From: Kristoffer Longva Eriksen Date: Wed, 23 Mar 2022 09:04:11 +0100 Subject: [PATCH] Added copy invite link function --- src/client/package-lock.json | 5 +++++ src/client/package.json | 1 + src/client/src/managetournament.js | 21 ++++++++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/client/package-lock.json b/src/client/package-lock.json index 28abee9..8c98e70 100644 --- a/src/client/package-lock.json +++ b/src/client/package-lock.json @@ -9550,6 +9550,11 @@ "warning": "^4.0.3" } }, + "react-custom-alert": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/react-custom-alert/-/react-custom-alert-0.1.2.tgz", + "integrity": "sha512-VkxPh4loaDzeQ4THauq5qOETr/SL/4L+4k1Ie3C948nSgxCy0CSY7MKrzkFwiwIiYCxib3/60zIqmTLUECHEww==" + }, "react-dev-utils": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.0.tgz", diff --git a/src/client/package.json b/src/client/package.json index 69be55f..ee1147a 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -14,6 +14,7 @@ "iarn": "0.0.0", "react": "^17.0.2", "react-bootstrap": "^2.2.1", + "react-custom-alert": "^0.1.2", "react-dom": "^17.0.2", "react-router-dom": "^6.2.2", "react-scripts": "5.0.0", diff --git a/src/client/src/managetournament.js b/src/client/src/managetournament.js index 15b3ab5..3f06870 100644 --- a/src/client/src/managetournament.js +++ b/src/client/src/managetournament.js @@ -1,5 +1,6 @@ import * as React from "react"; import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom"; +import { AlertContainer, alert } from "react-custom-alert"; import HomeImage from "./components/homeimage"; import SaveButton from "./components/savebutton"; @@ -39,18 +40,23 @@ function AnnounceButton(props) { } function InviteButton(props) { + function event() { + copy(); + alertSuccess(); + } + const copy = () => { + navigator.clipboard.writeText("discord.gg/asura"); + }; + const alertSuccess = () => + alert({ message: "Copied to clipboard.", type: "success" }); return ( - ); } +//navigator.clipboard.writeText("discord.gg/asura") export default function TournamentManager() { return ( @@ -59,6 +65,7 @@ export default function TournamentManager() { + ); }