80 lines
2.4 KiB
TypeScript
80 lines
2.4 KiB
TypeScript
import React from 'react';
|
|
import { View, Text, TouchableOpacity } from 'react-native';
|
|
import Icon from 'react-native-vector-icons/Ionicons';
|
|
import { useTheme } from '@theme';
|
|
import { getStyles } from './leadDetailHeader.styles';
|
|
import { LeadDetailHeaderProps } from './leadDetailHeader.props';
|
|
import { getInitials, toRgba } from '@utils';
|
|
|
|
export const LeadDetailHeader: React.FC<LeadDetailHeaderProps> = ({
|
|
name,
|
|
company,
|
|
email,
|
|
phonenumber,
|
|
statusName,
|
|
statusColor,
|
|
avatarColor,
|
|
onStatusPress,
|
|
onEmailPress,
|
|
onPhonePress,
|
|
}) => {
|
|
const { theme: colors, isDark } = useTheme();
|
|
const styles = getStyles(colors);
|
|
|
|
const accent = statusColor || avatarColor || '#5B4CF5';
|
|
const badgeBg = toRgba(accent, isDark ? 0.20 : 0.12);
|
|
|
|
return (
|
|
<View style={styles.card}>
|
|
<View style={[styles.avatar, { backgroundColor: accent }]}>
|
|
<Text style={styles.avatarText}>{getInitials(name)}</Text>
|
|
</View>
|
|
|
|
<Text style={styles.name} numberOfLines={1}>
|
|
{name || 'No Name'}
|
|
</Text>
|
|
|
|
{company && (
|
|
<View style={styles.companyRow}>
|
|
<Icon name="business-outline" size={13} color={colors.textMuted} />
|
|
<Text style={styles.company}>{company}</Text>
|
|
</View>
|
|
)}
|
|
|
|
<TouchableOpacity
|
|
onPress={onStatusPress}
|
|
activeOpacity={onStatusPress ? 0.7 : 1}
|
|
disabled={!onStatusPress}>
|
|
<View style={[styles.statusBadge, { backgroundColor: badgeBg }]}>
|
|
<View style={[styles.statusDot, { backgroundColor: accent }]} />
|
|
<Text style={[styles.statusText, { color: accent }]}>
|
|
{statusName || 'No Status'}
|
|
</Text>
|
|
</View>
|
|
</TouchableOpacity>
|
|
|
|
<View style={styles.quickActions}>
|
|
{email && (
|
|
<TouchableOpacity
|
|
style={styles.actionBtn}
|
|
onPress={onEmailPress}
|
|
activeOpacity={0.7}>
|
|
<Icon name="mail-outline" size={16} color={colors.icon} />
|
|
<Text style={styles.actionBtnText}>Email</Text>
|
|
</TouchableOpacity>
|
|
)}
|
|
|
|
{phonenumber && (
|
|
<TouchableOpacity
|
|
style={styles.actionBtn}
|
|
onPress={onPhonePress}
|
|
activeOpacity={0.7}>
|
|
<Icon name="call-outline" size={16} color={colors.icon} />
|
|
<Text style={styles.actionBtnText}>Call</Text>
|
|
</TouchableOpacity>
|
|
)}
|
|
</View>
|
|
</View>
|
|
);
|
|
};
|