Merge branch 'master' into feat/maas-support

This commit is contained in:
Junyan Qin (Chin)
2026-01-01 13:07:45 +08:00
committed by GitHub
13 changed files with 153 additions and 56 deletions
@@ -4,7 +4,7 @@ import * as React from 'react';
import { useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { toast } from 'sonner';
import { Copy, Trash2, Plus } from 'lucide-react';
import { Copy, Check, Trash2, Plus } from 'lucide-react';
import { useRouter, usePathname, useSearchParams } from 'next/navigation';
import {
Dialog,
@@ -87,6 +87,7 @@ export default function ApiIntegrationDialog({
const [newWebhookDescription, setNewWebhookDescription] = useState('');
const [newWebhookEnabled, setNewWebhookEnabled] = useState(true);
const [deleteWebhookId, setDeleteWebhookId] = useState<number | null>(null);
const [copiedKey, setCopiedKey] = useState<string | null>(null);
// Sync URL with dialog state
useEffect(() => {
@@ -182,7 +183,8 @@ export default function ApiIntegrationDialog({
const handleCopyKey = (key: string) => {
navigator.clipboard.writeText(key);
toast.success(t('common.apiKeyCopied'));
setCopiedKey(key);
setTimeout(() => setCopiedKey(null), 2000);
};
const maskApiKey = (key: string) => {
@@ -352,7 +354,11 @@ export default function ApiIntegrationDialog({
onClick={() => handleCopyKey(key.key)}
title={t('common.copyApiKey')}
>
<Copy className="h-4 w-4" />
{copiedKey === key.key ? (
<Check className="h-4 w-4 text-green-600" />
) : (
<Copy className="h-4 w-4" />
)}
</Button>
<Button
variant="ghost"
@@ -543,7 +549,11 @@ export default function ApiIntegrationDialog({
variant="outline"
size="icon"
>
<Copy className="h-4 w-4" />
{copiedKey === createdKey?.key ? (
<Check className="h-4 w-4 text-green-600" />
) : (
<Copy className="h-4 w-4" />
)}
</Button>
</div>
</div>
@@ -640,7 +650,11 @@ export default function ApiIntegrationDialog({
variant="outline"
size="icon"
>
<Copy className="h-4 w-4" />
{copiedKey === createdKey?.key ? (
<Check className="h-4 w-4 text-green-600" />
) : (
<Copy className="h-4 w-4" />
)}
</Button>
</div>
</div>