fix: update MarkdownContent styles to use ReturnType for better type inference

This commit is contained in:
Nawaz Dhandala
2026-02-15 20:14:56 +00:00
parent c7362f3ada
commit 008005415a
3 changed files with 111 additions and 100 deletions

View File

@@ -21,69 +21,70 @@ export default function MarkdownContent({
? theme.colors.textSecondary ? theme.colors.textSecondary
: theme.colors.textPrimary; : theme.colors.textPrimary;
const markdownStyles = StyleSheet.create({ const markdownStyles: ReturnType<typeof StyleSheet.create> =
body: { StyleSheet.create({
color: textColor, body: {
margin: 0, color: textColor,
padding: 0, margin: 0,
fontSize: isSecondary ? 13 : 14, padding: 0,
lineHeight: 22, fontSize: isSecondary ? 13 : 14,
}, lineHeight: 22,
text: { },
color: textColor, text: {
fontSize: isSecondary ? 13 : 14, color: textColor,
lineHeight: 22, fontSize: isSecondary ? 13 : 14,
}, lineHeight: 22,
paragraph: { },
marginTop: 0, paragraph: {
marginBottom: 8, marginTop: 0,
color: textColor, marginBottom: 8,
}, color: textColor,
strong: { },
color: textColor, strong: {
fontWeight: "700", color: textColor,
}, fontWeight: "700",
em: { },
color: textColor, em: {
fontStyle: "italic", color: textColor,
}, fontStyle: "italic",
link: { },
color: theme.colors.actionPrimary, link: {
textDecorationLine: "underline", color: theme.colors.actionPrimary,
}, textDecorationLine: "underline",
bullet_list: { },
marginTop: 0, bullet_list: {
marginBottom: 8, marginTop: 0,
}, marginBottom: 8,
ordered_list: { },
marginTop: 0, ordered_list: {
marginBottom: 8, marginTop: 0,
}, marginBottom: 8,
list_item: { },
color: textColor, list_item: {
marginBottom: 4, color: textColor,
}, marginBottom: 4,
fence: { },
backgroundColor: theme.colors.backgroundSecondary, fence: {
color: textColor, backgroundColor: theme.colors.backgroundSecondary,
borderRadius: 8, color: textColor,
padding: 10, borderRadius: 8,
marginBottom: 8, padding: 10,
}, marginBottom: 8,
code_inline: { },
backgroundColor: theme.colors.backgroundSecondary, code_inline: {
color: textColor, backgroundColor: theme.colors.backgroundSecondary,
borderRadius: 4, color: textColor,
paddingHorizontal: 6, borderRadius: 4,
paddingVertical: 2, paddingHorizontal: 6,
}, paddingVertical: 2,
blockquote: { },
borderLeftWidth: 3, blockquote: {
borderLeftColor: theme.colors.borderDefault, borderLeftWidth: 3,
paddingLeft: 10, borderLeftColor: theme.colors.borderDefault,
marginBottom: 8, paddingLeft: 10,
}, marginBottom: 8,
}); },
});
return ( return (
<Markdown <Markdown

View File

@@ -5,6 +5,9 @@ import { fetchCurrentOnDutyEscalationPolicies } from "../api/onCallPolicies";
import type { import type {
CurrentOnDutyEscalationPoliciesResponse, CurrentOnDutyEscalationPoliciesResponse,
OnCallAssignmentItem, OnCallAssignmentItem,
OnCallDutyEscalationRuleUserItem,
OnCallDutyEscalationRuleTeamItem,
OnCallDutyEscalationRuleScheduleItem,
ProjectItem, ProjectItem,
ProjectOnCallAssignments, ProjectOnCallAssignments,
} from "../api/types"; } from "../api/types";
@@ -30,44 +33,50 @@ function toAssignments(
): OnCallAssignmentItem[] { ): OnCallAssignmentItem[] {
const assignments: OnCallAssignmentItem[] = []; const assignments: OnCallAssignmentItem[] = [];
response.escalationRulesByUser.forEach((rule) => { response.escalationRulesByUser.forEach(
assignments.push({ (rule: OnCallDutyEscalationRuleUserItem) => {
projectId: project._id, assignments.push({
projectName: project.name, projectId: project._id,
policyId: getEntityId(rule.onCallDutyPolicy), projectName: project.name,
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy", policyId: getEntityId(rule.onCallDutyPolicy),
escalationRuleName: policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule", escalationRuleName:
assignmentType: "user", rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
assignmentDetail: "You are directly assigned", assignmentType: "user",
}); assignmentDetail: "You are directly assigned",
}); });
},
);
response.escalationRulesByTeam.forEach((rule) => { response.escalationRulesByTeam.forEach(
assignments.push({ (rule: OnCallDutyEscalationRuleTeamItem) => {
projectId: project._id, assignments.push({
projectName: project.name, projectId: project._id,
policyId: getEntityId(rule.onCallDutyPolicy), projectName: project.name,
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy", policyId: getEntityId(rule.onCallDutyPolicy),
escalationRuleName: policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule", escalationRuleName:
assignmentType: "team", rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
assignmentDetail: `Via team: ${rule.team?.name ?? "Unknown"}`, assignmentType: "team",
}); assignmentDetail: `Via team: ${rule.team?.name ?? "Unknown"}`,
}); });
},
);
response.escalationRulesBySchedule.forEach((rule) => { response.escalationRulesBySchedule.forEach(
assignments.push({ (rule: OnCallDutyEscalationRuleScheduleItem) => {
projectId: project._id, assignments.push({
projectName: project.name, projectId: project._id,
policyId: getEntityId(rule.onCallDutyPolicy), projectName: project.name,
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy", policyId: getEntityId(rule.onCallDutyPolicy),
escalationRuleName: policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule", escalationRuleName:
assignmentType: "schedule", rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
assignmentDetail: `Via schedule: ${rule.onCallDutyPolicySchedule?.name ?? "Unknown"}`, assignmentType: "schedule",
}); assignmentDetail: `Via schedule: ${rule.onCallDutyPolicySchedule?.name ?? "Unknown"}`,
}); });
},
);
return assignments; return assignments;
} }

View File

@@ -233,7 +233,8 @@ export default tseslint.config(
module: true, module: true,
__dirname: true, __dirname: true,
exports: true, exports: true,
"NodeJS": true "NodeJS": true,
"PromiseSettledResult": true
}, },
parserOptions: { parserOptions: {
projectService: true, projectService: true,