import React from 'react';
import { View, Text, Pressable } from 'react-native';
import { Image } from 'expo-image';
import * as Linking from 'expo-linking';
import Svg, { Path } from 'react-native-svg';
import type { NFDProfile as NFDProfileType, ComponentSize } from '../types/algorand';
import { formatAddress, formatRelativeTime } from '../utils/format';
import { CopyButton } from '../ui/CopyButton';
import { SizeContainer } from '../ui/SizeContainer';
function VerifiedIcon({ size = 16, color = '#60a5fa' }: { size?: number; color?: string }) {
return (
);
}
function UserIcon({ size = 24, color = '#71717a' }: { size?: number; color?: string }) {
return (
);
}
function ExternalLinkIcon({ size = 16, color = '#a1a1aa' }: { size?: number; color?: string }) {
return (
);
}
interface NFDProfileProps {
data: NFDProfileType;
showBio?: boolean;
showProperties?: boolean;
compact?: boolean;
size?: ComponentSize;
className?: string;
}
export function NFDProfileComponent({
data: profile,
showBio = true,
showProperties = true,
compact = false,
size = 'full',
className,
}: NFDProfileProps) {
const handleSocialPress = (key: string, value: string) => {
let url: string;
if (key === 'website') {
url = value.startsWith('http') ? value : `https://${value}`;
} else {
url = `https://${key}.com/${value.replace('@', '')}`;
}
Linking.openURL(url);
};
if (compact) {
return (
{profile.avatar ? (
) : (
)}
{profile.verified && }
{profile.name}
);
}
const isFullscreen = size === 'fullscreen';
return (
{/* Header */}
{profile.avatar ? (
) : (
)}
{profile.name}
{profile.verified && }
{formatAddress(profile.address)}
{/* Bio */}
{showBio && profile.bio && (
{profile.bio}
)}
{/* Verification Badge */}
{profile.verified ? (
<>
Verified NFD
>
) : (
<>
Unverified
>
)}
{/* Social Links */}
{showProperties && Object.keys(profile.properties).length > 0 && (
Social Links
{Object.entries(profile.properties).map(([key, value]) => (
handleSocialPress(key, value)}
className="flex-row items-center gap-1.5 px-3 py-1.5 rounded-lg bg-zinc-800"
>
{key}
))}
)}
{/* Created Date */}
Created {formatRelativeTime(profile.createdAt)}
);
}