/** * Identity Card component for displaying saved identities */ import { Pencil,User } from 'lucide-react'; import React from 'react'; import { useI18n } from '../../application/i18n/I18nProvider'; import { cn } from '../../lib/utils'; import { Identity } from '../../types'; import { Button } from '../ui/button'; import { VaultEntityIcon, vaultIdentityIconClass } from '../vault/VaultEntityIcon'; interface IdentityCardProps { identity: Identity; viewMode: 'grid' | 'list'; isSelected: boolean; reorderProps?: React.HTMLAttributes; onClick: () => void; } export const IdentityCard: React.FC = ({ identity, viewMode, isSelected, reorderProps, onClick, }) => { const { t } = useI18n(); const hasPassword = !!identity.password; const hasKey = !!identity.keyId; const keyKind = identity.authMethod === 'certificate' ? 'certificate' : 'key'; const summary = hasPassword && hasKey ? (keyKind === 'certificate' ? t('keychain.identity.summary.passwordAndCertificate') : t('keychain.identity.summary.passwordAndKey')) : hasKey ? (keyKind === 'certificate' ? t('keychain.identity.summary.certificate') : t('keychain.identity.summary.key')) : hasPassword ? t('keychain.identity.summary.password') : t('keychain.identity.summary.none'); return (
} />
{identity.label || 'Add a label...'}
{summary}
); };