import { lintInfoMap } from '../Linter/Linter.utils' import { LintException } from '@/data/lint/lint-rules-query' import { Member } from '@/data/organizations/organization-members-query' export const generateRuleText = (e: LintException, member?: Member) => { const lintName = lintInfoMap.find((x) => x.name === e.lint_name)?.title if (e.is_disabled) { return `Ignore "${lintName}" for ${!e.assigned_to ? 'all project members' : `${member?.username ?? member?.primary_email}`}` } else { return `"${lintName}" is only visible to ${member?.username} ` } } export const generateRuleDescription = ({ name, member, disabled, }: { name?: string member?: Member disabled: boolean }) => { const lint = lintInfoMap.find((x) => x.name === name) return ( <>
What this rule means:
The "{lint?.title}" lint will be{' '} {disabled ? `ignored for ${!!member ? `this user only` : 'this project'}` : `visible to ${!!member ? `this user only` : ''}`}
{!!member ? ( disabled ? ( <> Only {member.username ?? member.primary_email} will no longer see this lint in the{' '} {lint?.category} Advisor, the lint will still be visible to all other project members > ) : ( <> Only {member.username ?? member.primary_email} will see this lint in the{' '} {lint?.category} Advisor, the lint will no longer be visible to all other project members > ) ) : ( <> All project members will no longer see this lint in the{' '} {lint?.category} Advisor, nor receive notifications via emails about this lint > )}
> ) }