({
personas,
experienceLevel,
}: BuildSwipePromptArgs)
| 12 | role.toLowerCase().replace(/\s+engineer$/, ''); |
| 13 | |
| 14 | export function buildSwipePrompt({ |
| 15 | personas, |
| 16 | experienceLevel, |
| 17 | }: BuildSwipePromptArgs): string { |
| 18 | if (!personas?.length) { |
| 19 | return ''; |
| 20 | } |
| 21 | |
| 22 | const roleClause = |
| 23 | personas.length === 1 |
| 24 | ? `I'm a ${normalizeRoleLabel(personas[0].title)} engineer` |
| 25 | : `I work across ${personas |
| 26 | .map((p) => p.title.toLowerCase()) |
| 27 | .join(' and ')}`; |
| 28 | |
| 29 | const experienceLabel = |
| 30 | experienceLevel && UserExperienceLevel[experienceLevel]; |
| 31 | const experienceClause = experienceLabel ? ` (${experienceLabel})` : ''; |
| 32 | |
| 33 | const tags = dedupe(personas.flatMap((p) => p.tags)); |
| 34 | const interestsClause = tags.length |
| 35 | ? ` I'm interested in: ${tags.join(', ')}.` |
| 36 | : ''; |
| 37 | |
| 38 | return `${roleClause}${experienceClause}.${interestsClause}`.trim(); |
| 39 | } |
no test coverage detected