/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/team-building/shared.tsx
106 строк
3 KB
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
import type * as T from '@/constants/types' import type {IconType} from '@/common-adapters/icon.constants-gen' import * as TeamBuilding from '@/stores/team-building' const services: { [K in T.TB.ServiceIdWithContact]: { avatarIcon?: IconType // icon to show as avatar for results, if different than `icon` badge?: boolean icon: IconType // icon to show in tab bar label: string longLabel: Array<string> searchPlaceholder: string } } = { email: { badge: true, icon: 'iconfont-mention', label: 'Email', // TODO: rethink this for the empty state when we're actually using it longLabel: ['An email', 'address'], searchPlaceholder: 'email', }, facebook: { icon: 'iconfont-identity-facebook', label: 'Facebook', longLabel: ['A Facebook', 'user'], searchPlaceholder: 'Facebook', }, github: { icon: 'iconfont-identity-github', label: 'GitHub', longLabel: ['A GitHub', 'user'], searchPlaceholder: 'GitHub', }, hackernews: { icon: 'iconfont-identity-hn', label: 'Hacker News', longLabel: ['A Hacker', 'News user'], searchPlaceholder: 'Hacker News', }, keybase: { avatarIcon: isMobile ? 'icon-placeholder-avatar-circular-48' : 'icon-placeholder-avatar-circular-32', icon: 'iconfont-contact-book', label: 'Keybase and contacts', longLabel: isMobile ? ['Keybase &', 'Contacts'] : ['A Keybase', 'user'], searchPlaceholder: isMobile ? 'Keybase & contacts' : 'Keybase', }, phone: { badge: true, icon: 'iconfont-number-pad', label: 'Phone', longLabel: ['A phone', 'number'], searchPlaceholder: 'phone', }, reddit: { icon: 'iconfont-identity-reddit', label: 'Reddit', longLabel: ['A Reddit', 'user'], searchPlaceholder: 'Reddit', }, twitter: { icon: 'iconfont-identity-twitter', label: 'Twitter', longLabel: ['A Twitter', 'user'], searchPlaceholder: 'Twitter', }, } const accentColors: {[K in T.TB.ServiceIdWithContact]: string} = { email: '#3663ea', facebook: '#3B5998', github: '#333', hackernews: '#FF6600', keybase: '#3663ea', phone: '#3663ea', reddit: '#ff4500', twitter: '#1DA1F2', } const darkModeAccentColors: Partial<typeof accentColors> = { github: '#E7E8E8', } export const serviceIdToAccentColor = (service: T.TB.ServiceIdWithContact, isDarkMode: boolean): string => { return (isDarkMode && darkModeAccentColors[service]) || accentColors[service] } export const serviceIdToIconFont = (service: T.TB.ServiceIdWithContact): IconType => services[service].icon export const serviceIdToAvatarIcon = (service: T.TB.ServiceIdWithContact): IconType => services[service].avatarIcon || services[service].icon export const serviceIdToLabel = (service: T.TB.ServiceIdWithContact): string => services[service].label export const serviceIdToLongLabel = (service: T.TB.ServiceIdWithContact): Array<string> => services[service].longLabel export const serviceIdToSearchPlaceholder = (service: T.TB.ServiceIdWithContact): string => services[service].searchPlaceholder export const serviceIdToBadge = (service: T.TB.ServiceIdWithContact): boolean => services[service].badge === true export const serviceMapToArray = (services: T.TB.ServiceMap) => TeamBuilding.allServices.filter(x => x !== 'keybase' && x in services) export const getSearchResults = ( searchResults: T.Immutable<T.TB.SearchResults>, searchString: string, selectedService: T.TB.ServiceIdWithContact ) => searchResults.get(searchString.trim())?.get(selectedService)