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 ` ` } // Render edit form for a link function renderLinkEditItem(link: LinkItem, index: number): string { const serviceOptions = availableServices.map(s => `` ).join('') return ` ` } // Render link page export function renderLinkPage(data: LinkCollection | null, handle: string, isOwner = false): string { const jsonUrl = `/@${handle}/at/collection/ai.syui.at.link/self` const links = data?.links || [] const editBtn = isOwner ? `` : '' // Edit form (hidden by default) const editItems = links.map((link, i) => renderLinkEditItem(link, i)).join('') const newServiceOptions = availableServices.map(s => `` ).join('') const editForm = isOwner ? ` ` : '' if (links.length === 0) { return ` ` } const items = links.map(link => renderLinkItem(link)).join('') return ` ` }