Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | 10x 10x 10x 10x 9x 9x 10x 10x 15x 10x 10x 10x 8x 8x 2x 2x 12x 6x 3x 3x 3x 10x 10x 6x 10x 3x 6x | export interface ColorStrings extends Record<string, string | undefined> {
dark?: string;
default?: string;
emphasis?: string;
failure: string;
info: string;
light?: string;
success: string;
warning: string;
}
export const getAdaptiveCardColorString = (colorString: string) => {
const colorStrings: ColorStrings = {
dark: 'Dark', // unsure, spec says this is a valid option but doesn't specify the color
default: 'Emphasis', //gray
emphasis: 'Emphasis', //gray
failure: 'Attention', // red
info: 'Accent', // blue
light: 'Light', // unsure, spec says this is a valid option but doesn't specify the color
success: 'Good', // green
warning: 'Warning', // yellow
};
return colorStrings[colorString] ?? 'Emphasis';
};
export interface EmojiStrings extends Record<string, string | undefined> {
accent: string;
attention: string;
dark?: string;
emphasis?: string;
good: string;
light?: string;
warning: string;
}
export const getEmoji = (adaptiveCardColor = 'Emphasis') => {
const emojiList: EmojiStrings = {
accent: 'âšī¸ ',
attention: 'đ¨ ',
dark: '',
emphasis: '',
good: 'â
',
light: '',
warning: 'â ī¸ ',
};
return emojiList[adaptiveCardColor.toLowerCase() as keyof EmojiStrings] ?? '';
};
export type UserMention = {
name: string;
id: string;
};
export type ParseUserMentionsResult = {
mentions: UserMention[];
invalidEntries: string[];
};
export const parseUserMentions = (input: string): ParseUserMentionsResult => {
const entries = input
.split(',')
.map((entry) => entry.trim())
.filter(Boolean);
const mentions: UserMention[] = [];
const invalidEntries: string[] = [];
for (const entry of entries) {
const parts = entry.split('|');
if (parts.length !== 2) {
invalidEntries.push(entry);
continue;
}
const [name, id] = parts.map((part) => part.trim());
if (!name || !id) {
invalidEntries.push(entry);
continue;
}
mentions.push({ name, id });
}
return { mentions, invalidEntries };
};
export const buildMentionEntities = (mentions: UserMention[]) =>
mentions.map((mention) => ({
type: 'mention',
text: `<at>${mention.name}</at>`,
mentioned: {
id: mention.id,
name: mention.name,
},
}));
export const renderMentionsText = (mentions: UserMention[]) =>
`**Mentions:** ${mentions
.map((mention) => `<at>${mention.name}</at>`)
.join(', ')}`;
|