'use client'
import React, { useMemo, useState } from 'react'
import { cn } from '../../utils/cn'
import { EyeIcon } from '../icons'
import { Copy01Icon } from '../icons-v2-generated/documents'
import { CheckIcon } from '../icons-v2-generated/signs-and-symbols'
import { ExternalLink } from 'lucide-react'
import { OpenFrameLogo } from '../..'
import { useCopyToClipboard } from '../../hooks/use-copy-to-clipboard'
import { useIsTruncated } from '../../hooks/ui/use-is-truncated'
import { FloatingTooltip } from './floating-tooltip'
import { TruncateText } from './truncate-text'
export type ServiceCardRowAction = {
copy?: boolean
open?: boolean
reveal?: boolean
}
export type ServiceCardRow = {
label?: string
value: string
href?: string
copyValue?: string
isSecret?: boolean
monospace?: boolean
actions?: ServiceCardRowAction
}
export type ServiceCardTag = {
label: string
}
export interface ServiceCardProps {
title: string
subtitle?: string
icon?: React.ReactNode
tag?: ServiceCardTag
rows: ServiceCardRow[]
className?: string
}
function MaskedValue({ value, isRevealed }: { value: string; isRevealed: boolean }) {
if (isRevealed) return {value}
return {'•'.repeat(Math.min(value.length, 12))}
}
export function ServiceCard({ title, subtitle, icon, tag, rows, className }: ServiceCardProps) {
const resolvedIcon = icon ?? (