From cac0c62f6f205e16d7f4cf42caeb83002aa4b93e Mon Sep 17 00:00:00 2001 From: Antony Leons Date: Sun, 26 Apr 2026 21:37:01 +0100 Subject: [PATCH 1/2] feat(social): add telegram profile link support Add Telegram as a new social media platform option for user profiles. This includes: - Adding Telegram field to the SocialLinks interface and default constants - Including validation schema for the Telegram field - Adding Telegram input field to the social section UI with appropriate icon and placeholder - Providing a Telegram SVG icon in the social icons directory - Updating markdown generator to handle Telegram links and use CDN icon for better compatibility --- src/components/sections/social-section.tsx | 1 + src/constants/defaults.ts | 1 + src/images/icons/Social/telegram.svg | 1 + src/lib/markdown-generator.ts | 8 +++++++- src/lib/validations.ts | 1 + src/types/profile.ts | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/images/icons/Social/telegram.svg diff --git a/src/components/sections/social-section.tsx b/src/components/sections/social-section.tsx index 19809a97..2fd37dae 100644 --- a/src/components/sections/social-section.tsx +++ b/src/components/sections/social-section.tsx @@ -37,6 +37,7 @@ export function SocialSection({ register, errors, watch }: SocialSectionProps) { { key: 'dribbble', label: 'Dribbble', icon: '🎨', placeholder: 'username' }, { key: 'behance', label: 'Behance', icon: '🎭', placeholder: 'username' }, { key: 'discord', label: 'Discord', icon: '💬', placeholder: 'invite-code' }, + { key: 'telegram', label: 'Telegram', icon: '✈️', placeholder: '@username' }, { key: 'rssurl', label: 'RSS Feed', icon: '📡', placeholder: 'https://...' }, ]; diff --git a/src/constants/defaults.ts b/src/constants/defaults.ts index e23a51cf..46bf56e6 100644 --- a/src/constants/defaults.ts +++ b/src/constants/defaults.ts @@ -96,6 +96,7 @@ export const DEFAULT_SOCIAL: SocialLinks = { hackerearth: '', geeks_for_geeks: '', discord: '', + telegram: '', rssurl: '', twitterBadge: false, }; diff --git a/src/images/icons/Social/telegram.svg b/src/images/icons/Social/telegram.svg new file mode 100644 index 00000000..4976a30c --- /dev/null +++ b/src/images/icons/Social/telegram.svg @@ -0,0 +1 @@ + diff --git a/src/lib/markdown-generator.ts b/src/lib/markdown-generator.ts index a2f572f9..61e129ac 100644 --- a/src/lib/markdown-generator.ts +++ b/src/lib/markdown-generator.ts @@ -37,6 +37,7 @@ const socialPlatformUrls: Record string> = { hackerearth: (u) => `https://hackerearth.com/${u}`, geeks_for_geeks: (u) => `https://auth.geeksforgeeks.org/user/${u}`, discord: (u) => `https://discord.gg/${u}`, + telegram: (u) => `https://t.me/${u.replace(/^@/, '')}`, }; const socialIcons: Record = { @@ -62,8 +63,12 @@ const socialIcons: Record = { hackerearth: 'hackerearth.svg', geeks_for_geeks: 'geeks-for-geeks.svg', discord: 'discord.svg', + telegram: 'https://cdn.simpleicons.org/telegram/26A5E4', }; +const socialIconBaseUrl = + 'https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/'; + // Generate skill icon URL - uses skillicons.dev for consistent dark mode support export function getSkillIconUrl(skill: string): string { // Skills that use simple-icons for better brand colors and dark mode support @@ -414,7 +419,8 @@ export function generateMarkdown(options: GenerateMarkdownOptions): string { const icon = socialIcons[platform]; const url = socialPlatformUrls[platform]; if (icon && url && username) { - markdown += `${username as string}\n`; + const iconSrc = icon.startsWith('http') ? icon : `${socialIconBaseUrl}${icon}`; + markdown += `${username as string}\n`; } }); diff --git a/src/lib/validations.ts b/src/lib/validations.ts index 776b2136..4c8cfd7b 100644 --- a/src/lib/validations.ts +++ b/src/lib/validations.ts @@ -92,6 +92,7 @@ export const socialSchema = z.object({ hackerearth: z.string().max(100), geeks_for_geeks: z.string().max(100), discord: z.string().max(100), + telegram: z.string().max(100), rssurl: z.string().url('Invalid URL').or(z.literal('')), // Twitter Badge Enhancement diff --git a/src/types/profile.ts b/src/types/profile.ts index 08089417..978cf6c5 100644 --- a/src/types/profile.ts +++ b/src/types/profile.ts @@ -95,6 +95,7 @@ export interface SocialLinks { hackerearth: string; geeks_for_geeks: string; discord: string; + telegram: string; rssurl: string; twitterBadge: boolean; } From 3b2b2a6aeea2390bdf8a3f43cab4dfb8db964677 Mon Sep 17 00:00:00 2001 From: Antony Leons Date: Sun, 26 Apr 2026 21:45:55 +0100 Subject: [PATCH 2/2] refactor: get icon locally (will break icon until merged Remove the separate socialIconBaseUrl variable and inline the base URL directly in the social icon markup generation. Also change the Telegram icon from a direct CDN URL to use the local SVG filename for consistency with other social icons. --- src/lib/markdown-generator.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lib/markdown-generator.ts b/src/lib/markdown-generator.ts index 61e129ac..4f0abe40 100644 --- a/src/lib/markdown-generator.ts +++ b/src/lib/markdown-generator.ts @@ -63,12 +63,9 @@ const socialIcons: Record = { hackerearth: 'hackerearth.svg', geeks_for_geeks: 'geeks-for-geeks.svg', discord: 'discord.svg', - telegram: 'https://cdn.simpleicons.org/telegram/26A5E4', + telegram: 'telegram.svg', }; -const socialIconBaseUrl = - 'https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/'; - // Generate skill icon URL - uses skillicons.dev for consistent dark mode support export function getSkillIconUrl(skill: string): string { // Skills that use simple-icons for better brand colors and dark mode support @@ -419,8 +416,7 @@ export function generateMarkdown(options: GenerateMarkdownOptions): string { const icon = socialIcons[platform]; const url = socialPlatformUrls[platform]; if (icon && url && username) { - const iconSrc = icon.startsWith('http') ? icon : `${socialIconBaseUrl}${icon}`; - markdown += `${username as string}\n`; + markdown += `${username as string}\n`; } });