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