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:
@@ -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)}
|
||||
>
|
||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<Button variant="ghost" size="sm" onClick={() => setTokenExpanded((v) => !v)}>
|
||||
{tokenExpanded ? 'Hide token' : 'Show token'}
|
||||
</button>
|
||||
</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}>
|
||||
|
||||
Reference in New Issue
Block a user