fix: replace raw button with DS Button, add token copy-to-clipboard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-09 19:51:03 +02:00
parent 7d4126ad4e
commit 798ec4850d

View File

@@ -1,10 +1,13 @@
import React, { useState } from 'react';
import {
Badge,
Button,
Card,
EmptyState,
Spinner,
useToast,
} from '@cameleer/design-system';
import { Copy } from 'lucide-react';
import { useAuth } from '../auth/useAuth';
import { useLicense } from '../api/hooks';
import styles from '../styles/platform.module.css';
@@ -34,6 +37,7 @@ export function LicensePage() {
const { tenantId } = useAuth();
const { data: license, isLoading, isError } = useLicense(tenantId ?? '');
const [tokenExpanded, setTokenExpanded] = useState(false);
const { toast } = useToast();
if (isLoading) {
return (
@@ -149,13 +153,19 @@ export function LicensePage() {
<p className={styles.description}>
Use this token when registering Cameleer agents with your tenant.
</p>
<button
type="button"
className="text-sm text-primary-400 hover:text-primary-300 underline underline-offset-2 focus:outline-none"
onClick={() => setTokenExpanded((v) => !v)}
>
{tokenExpanded ? 'Hide token' : 'Show token'}
</button>
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<Button variant="ghost" size="sm" onClick={() => setTokenExpanded((v) => !v)}>
{tokenExpanded ? 'Hide token' : 'Show token'}
</Button>
{tokenExpanded && (
<Button variant="ghost" size="sm" onClick={() => {
navigator.clipboard.writeText(license.token);
toast({ title: 'Token copied to clipboard', variant: 'success' });
}}>
<Copy size={14} /> Copy
</Button>
)}
</div>
{tokenExpanded && (
<div className={styles.tokenBlock}>
<code className={styles.tokenCode}>