import type { LinkCollection, LinkItem } from '../lib/api'
// Service configurations
const serviceConfig = {
github: {
name: 'GitHub',
urlTemplate: 'https://github.com/{username}',
icon: ``,
},
x: {
name: 'X',
urlTemplate: 'https://x.com/{username}',
icon: ``,
},
youtube: {
name: 'YouTube',
urlTemplate: 'https://youtube.com/@{username}',
icon: ``,
},
}
// Available services for dropdown
export const availableServices = ['github', 'x', 'youtube'] as const
// Build URL from service and username
function buildUrl(service: string, username: string): string {
const config = serviceConfig[service as keyof typeof serviceConfig]
if (!config) return '#'
return config.urlTemplate.replace('{username}', username)
}
// Render link item for display
function renderLinkItem(link: LinkItem): string {
const { service, username } = link
const config = serviceConfig[service as keyof typeof serviceConfig]
if (!config) return ''
const url = buildUrl(service, username)
return `
No links found.