1import { capitalize } from '~/components/plugins/api/APISectionUtils'; 2import { PlatformName } from '~/types/common'; 3 4export const getPlatformName = (text: string): PlatformName => { 5 if (text.toLowerCase().includes('ios')) return 'ios'; 6 if (text.toLowerCase().includes('android')) return 'android'; 7 if (text.toLowerCase().includes('web')) return 'web'; 8 if (text.toLowerCase().includes('expo')) return 'expo'; 9 return ''; 10}; 11 12export const TAG_CLASSES = { 13 android: '!bg-palette-green4 !text-palette-green12 !border-palette-green5', 14 ios: '!bg-palette-blue4 !text-palette-blue12 !border-palette-blue5', 15 web: '!bg-palette-orange4 !text-palette-orange12 !border-palette-orange5', 16 expo: '!bg-palette-purple4 !text-palette-purple12 !border-palette-purple5', 17 deprecated: '!bg-palette-yellow3 !text-palette-yellow12 !border-palette-yellow5', 18 experimental: '!bg-palette-pink4 !text-palette-pink12 !border-palette-pink5', 19}; 20 21export const formatName = (name: PlatformName) => { 22 const cleanName = name.toLowerCase().replace('\n', ''); 23 if (cleanName.includes('ios')) { 24 return cleanName.replace('ios', 'iOS'); 25 } else if (cleanName.includes('expo')) { 26 return cleanName.replace('expo', 'Expo Go'); 27 } else { 28 return capitalize(name); 29 } 30}; 31