tweb/src/components/wrappers/participantRank.ts
Eduard Kuzmenko de226d59ee Chat management
Migrate to vite
2023-05-21 19:18:21 +07:00

14 lines
567 B
TypeScript

import getParticipantRank from '../../lib/appManagers/utils/chats/getParticipantRank';
import {i18n} from '../../lib/langPack';
import wrapEmojiText from '../../lib/richTextProcessor/wrapEmojiText';
export default function wrapParticipantRank(rank: Parameters<typeof getParticipantRank>[0] | ReturnType<typeof getParticipantRank> | 0) {
if(typeof(rank) === 'object') {
rank = getParticipantRank(rank);
}
return typeof(rank) === 'number' ?
i18n(!rank ? 'Chat.ChannelBadge' : (rank === 1 ? 'Chat.OwnerBadge' : 'ChatAdmin')) :
wrapEmojiText(rank);
}