From d5cceb9589115dc9c7c836ba8f5b41dea5339bbd Mon Sep 17 00:00:00 2001 From: Yrobot Date: Sun, 10 Nov 2024 10:56:38 +0800 Subject: [PATCH] feat: add a popup on Copy webhook Button to display the webhook url (#117) --- web/src/components/WebhooksTable.js | 39 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/web/src/components/WebhooksTable.js b/web/src/components/WebhooksTable.js index 367f3d5..8d81889 100644 --- a/web/src/components/WebhooksTable.js +++ b/web/src/components/WebhooksTable.js @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { Button, Form, Label, Pagination, Table } from 'semantic-ui-react'; +import { Button, Form, Label, Pagination, Table, Popup } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import { API, copy, showError, showSuccess, showWarning } from '../helpers'; @@ -223,6 +223,7 @@ const WebhooksTable = () => { ) .map((webhook, idx) => { if (webhook.deleted) return <>; + const webhookUrl = `${window.location.origin}/webhook/${webhook.link}`; return ( {webhook.id} @@ -238,23 +239,25 @@ const WebhooksTable = () => {
- + { + if ( + await copy( + webhookUrl + ) + ) { + showSuccess('已复制到剪贴板!'); + } else { + showWarning('无法复制到剪贴板!'); + } + }} + > + 复制 Webhook 链接 + + } />