Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions app/components/ConfigCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { useRouter } from "next/navigation";
import { colors } from "@/app/lib/colors";
import { SavedConfig, ConfigPublic } from "@/app/lib/types/configs";
import { formatRelativeTime } from "@/app/lib/utils";
import { CheckIcon, CopyIcon } from "@/app/components/icons";
import { useToast } from "@/app/hooks/useToast";

interface ConfigCardProps {
config: ConfigPublic;
Expand All @@ -28,12 +30,29 @@ export default function ConfigCard({
onLoadSingleVersion,
}: ConfigCardProps) {
const router = useRouter();
const toast = useToast();
const [expanded, setExpanded] = useState(false);
const [isLoadingDetails, setIsLoadingDetails] = useState(false);
const [latestVersion, setLatestVersion] = useState<SavedConfig | null>(null);
const [totalVersions, setTotalVersions] = useState<number>(0);
const [showTools, setShowTools] = useState(false);
const [showVectorStores, setShowVectorStores] = useState(false);
const [copiedId, setCopiedId] = useState(false);

const handleCopyId = useCallback(
async (e: React.MouseEvent) => {
e.stopPropagation();
try {
await navigator.clipboard.writeText(config.id);
setCopiedId(true);
toast.success("Config ID copied to clipboard");
setTimeout(() => setCopiedId(false), 2000);
} catch {
toast.error("Failed to copy");
}
},
[config.id, toast],
);

const handleToggleExpand = useCallback(async () => {
if (expanded) {
Expand Down Expand Up @@ -219,6 +238,30 @@ export default function ConfigCard({
</div>
) : latestVersion ? (
<div className="pt-4">
<div className="flex items-center gap-2 mb-3 px-2.5 py-1.5 rounded-md bg-bg-secondary">
<span className="text-xs shrink-0 text-text-secondary">
Config ID:
</span>
<span
className="text-xs font-mono truncate text-text-primary"
title={config.id}
>
{config.id}
</span>
<button
type="button"
onClick={handleCopyId}
className="ml-auto p-1 rounded-md transition-colors shrink-0 cursor-pointer hover:bg-neutral-200"
title="Copy Config ID"
>
Comment on lines +251 to +256
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add an explicit accessible name to the icon-only copy button.

At Line 251, the button relies on title (Line 255). Please add aria-label="Copy Config ID" so screen readers announce the action reliably.

Suggested patch
                 <button
                   type="button"
                   onClick={handleCopyId}
                   className="ml-auto p-1 rounded-md transition-colors shrink-0 cursor-pointer hover:bg-neutral-200"
                   title="Copy Config ID"
+                  aria-label="Copy Config ID"
                 >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
type="button"
onClick={handleCopyId}
className="ml-auto p-1 rounded-md transition-colors shrink-0 cursor-pointer hover:bg-neutral-200"
title="Copy Config ID"
>
<button
type="button"
onClick={handleCopyId}
className="ml-auto p-1 rounded-md transition-colors shrink-0 cursor-pointer hover:bg-neutral-200"
title="Copy Config ID"
aria-label="Copy Config ID"
>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/components/ConfigCard.tsx` around lines 251 - 256, The icon-only copy
button in ConfigCard.tsx (the button with onClick={handleCopyId}) relies only on
title for accessibility; add an explicit accessible name by adding
aria-label="Copy Config ID" to that button element so screen readers announce
the action reliably.

{copiedId ? (
<CheckIcon className="w-3.5 h-3.5 text-status-success" />
) : (
<CopyIcon className="w-3.5 h-3.5 text-text-secondary" />
)}
</button>
</div>

{/* Config Details */}
<div className="flex flex-wrap gap-3 mb-4">
<div
Expand Down
Loading