export const getHostnameFromUrl = (url: string): string => {
  try {
    const urlObj = new URL(url)
    return urlObj.hostname
  } catch {
    return 'unknown'
  }
}

export const truncateUrl = (url: string, maxLength: number = 60): string => {
  if (url.length <= maxLength) {
    return url
  }
  
  return url.substring(0, maxLength) + '...'
}