71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
// import { Linking, Platform } from 'react-native';
|
|
|
|
// /**
|
|
// * Opens the default email client with the provided email address
|
|
// * @param email - The email address to send to
|
|
// */
|
|
// export const handleEmailPress = (email?: string | null) => {
|
|
// if (!email) {
|
|
// console.warn('No email provided');
|
|
// return;
|
|
// }
|
|
|
|
// Linking.openURL(`mailto:${email}`).catch(err =>
|
|
// console.error('Error opening email:', err),
|
|
// );
|
|
// };
|
|
|
|
// /**
|
|
// * Opens the phone dialer with the provided phone number
|
|
// * @param phoneNumber - The phone number to call
|
|
// */
|
|
// export const handlePhonePress = (phoneNumber?: string | null) => {
|
|
// if (!phoneNumber) {
|
|
// console.warn('No phone number provided');
|
|
// return;
|
|
// }
|
|
|
|
// const phoneUrl =
|
|
// Platform.OS === 'ios'
|
|
// ? `telprompt:${phoneNumber}`
|
|
// : `tel:${phoneNumber}`;
|
|
|
|
// Linking.openURL(phoneUrl).catch(err =>
|
|
// console.error('Error opening phone:', err),
|
|
// );
|
|
// };
|
|
|
|
// /**
|
|
// * Opens the browser with the provided website URL
|
|
// * @param website - The website URL to open
|
|
// */
|
|
// export const handleWebsitePress = (website?: string | null) => {
|
|
// if (!website) {
|
|
// console.warn('No website provided');
|
|
// return;
|
|
// }
|
|
|
|
// const url = website.startsWith('http') ? website : `https://${website}`;
|
|
|
|
// Linking.openURL(url).catch(err =>
|
|
// console.error('Error opening website:', err),
|
|
// );
|
|
// };
|
|
|
|
// /**
|
|
// * Generates initials from a full name
|
|
// * @param name - The full name to extract initials from
|
|
// * @returns The initials (e.g., "John Doe" returns "JD")
|
|
// */
|
|
// export const getInitials = (name?: string | null): string => {
|
|
// if (!name) return '?';
|
|
|
|
// const nameParts = name.trim().split(' ');
|
|
|
|
// if (nameParts.length >= 2) {
|
|
// return (nameParts[0][0] + nameParts[nameParts.length - 1][0]).toUpperCase();
|
|
// }
|
|
|
|
// return name.substring(0, 2).toUpperCase();
|
|
// };
|