mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-05 16:22:06 +02:00
fix: update MarkdownContent styles to use ReturnType for better type inference
This commit is contained in:
@@ -21,69 +21,70 @@ export default function MarkdownContent({
|
||||
? theme.colors.textSecondary
|
||||
: theme.colors.textPrimary;
|
||||
|
||||
const markdownStyles = StyleSheet.create({
|
||||
body: {
|
||||
color: textColor,
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
fontSize: isSecondary ? 13 : 14,
|
||||
lineHeight: 22,
|
||||
},
|
||||
text: {
|
||||
color: textColor,
|
||||
fontSize: isSecondary ? 13 : 14,
|
||||
lineHeight: 22,
|
||||
},
|
||||
paragraph: {
|
||||
marginTop: 0,
|
||||
marginBottom: 8,
|
||||
color: textColor,
|
||||
},
|
||||
strong: {
|
||||
color: textColor,
|
||||
fontWeight: "700",
|
||||
},
|
||||
em: {
|
||||
color: textColor,
|
||||
fontStyle: "italic",
|
||||
},
|
||||
link: {
|
||||
color: theme.colors.actionPrimary,
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
bullet_list: {
|
||||
marginTop: 0,
|
||||
marginBottom: 8,
|
||||
},
|
||||
ordered_list: {
|
||||
marginTop: 0,
|
||||
marginBottom: 8,
|
||||
},
|
||||
list_item: {
|
||||
color: textColor,
|
||||
marginBottom: 4,
|
||||
},
|
||||
fence: {
|
||||
backgroundColor: theme.colors.backgroundSecondary,
|
||||
color: textColor,
|
||||
borderRadius: 8,
|
||||
padding: 10,
|
||||
marginBottom: 8,
|
||||
},
|
||||
code_inline: {
|
||||
backgroundColor: theme.colors.backgroundSecondary,
|
||||
color: textColor,
|
||||
borderRadius: 4,
|
||||
paddingHorizontal: 6,
|
||||
paddingVertical: 2,
|
||||
},
|
||||
blockquote: {
|
||||
borderLeftWidth: 3,
|
||||
borderLeftColor: theme.colors.borderDefault,
|
||||
paddingLeft: 10,
|
||||
marginBottom: 8,
|
||||
},
|
||||
});
|
||||
const markdownStyles: ReturnType<typeof StyleSheet.create> =
|
||||
StyleSheet.create({
|
||||
body: {
|
||||
color: textColor,
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
fontSize: isSecondary ? 13 : 14,
|
||||
lineHeight: 22,
|
||||
},
|
||||
text: {
|
||||
color: textColor,
|
||||
fontSize: isSecondary ? 13 : 14,
|
||||
lineHeight: 22,
|
||||
},
|
||||
paragraph: {
|
||||
marginTop: 0,
|
||||
marginBottom: 8,
|
||||
color: textColor,
|
||||
},
|
||||
strong: {
|
||||
color: textColor,
|
||||
fontWeight: "700",
|
||||
},
|
||||
em: {
|
||||
color: textColor,
|
||||
fontStyle: "italic",
|
||||
},
|
||||
link: {
|
||||
color: theme.colors.actionPrimary,
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
bullet_list: {
|
||||
marginTop: 0,
|
||||
marginBottom: 8,
|
||||
},
|
||||
ordered_list: {
|
||||
marginTop: 0,
|
||||
marginBottom: 8,
|
||||
},
|
||||
list_item: {
|
||||
color: textColor,
|
||||
marginBottom: 4,
|
||||
},
|
||||
fence: {
|
||||
backgroundColor: theme.colors.backgroundSecondary,
|
||||
color: textColor,
|
||||
borderRadius: 8,
|
||||
padding: 10,
|
||||
marginBottom: 8,
|
||||
},
|
||||
code_inline: {
|
||||
backgroundColor: theme.colors.backgroundSecondary,
|
||||
color: textColor,
|
||||
borderRadius: 4,
|
||||
paddingHorizontal: 6,
|
||||
paddingVertical: 2,
|
||||
},
|
||||
blockquote: {
|
||||
borderLeftWidth: 3,
|
||||
borderLeftColor: theme.colors.borderDefault,
|
||||
paddingLeft: 10,
|
||||
marginBottom: 8,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Markdown
|
||||
|
||||
@@ -5,6 +5,9 @@ import { fetchCurrentOnDutyEscalationPolicies } from "../api/onCallPolicies";
|
||||
import type {
|
||||
CurrentOnDutyEscalationPoliciesResponse,
|
||||
OnCallAssignmentItem,
|
||||
OnCallDutyEscalationRuleUserItem,
|
||||
OnCallDutyEscalationRuleTeamItem,
|
||||
OnCallDutyEscalationRuleScheduleItem,
|
||||
ProjectItem,
|
||||
ProjectOnCallAssignments,
|
||||
} from "../api/types";
|
||||
@@ -30,44 +33,50 @@ function toAssignments(
|
||||
): OnCallAssignmentItem[] {
|
||||
const assignments: OnCallAssignmentItem[] = [];
|
||||
|
||||
response.escalationRulesByUser.forEach((rule) => {
|
||||
assignments.push({
|
||||
projectId: project._id,
|
||||
projectName: project.name,
|
||||
policyId: getEntityId(rule.onCallDutyPolicy),
|
||||
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
|
||||
escalationRuleName:
|
||||
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
|
||||
assignmentType: "user",
|
||||
assignmentDetail: "You are directly assigned",
|
||||
});
|
||||
});
|
||||
response.escalationRulesByUser.forEach(
|
||||
(rule: OnCallDutyEscalationRuleUserItem) => {
|
||||
assignments.push({
|
||||
projectId: project._id,
|
||||
projectName: project.name,
|
||||
policyId: getEntityId(rule.onCallDutyPolicy),
|
||||
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
|
||||
escalationRuleName:
|
||||
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
|
||||
assignmentType: "user",
|
||||
assignmentDetail: "You are directly assigned",
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
response.escalationRulesByTeam.forEach((rule) => {
|
||||
assignments.push({
|
||||
projectId: project._id,
|
||||
projectName: project.name,
|
||||
policyId: getEntityId(rule.onCallDutyPolicy),
|
||||
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
|
||||
escalationRuleName:
|
||||
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
|
||||
assignmentType: "team",
|
||||
assignmentDetail: `Via team: ${rule.team?.name ?? "Unknown"}`,
|
||||
});
|
||||
});
|
||||
response.escalationRulesByTeam.forEach(
|
||||
(rule: OnCallDutyEscalationRuleTeamItem) => {
|
||||
assignments.push({
|
||||
projectId: project._id,
|
||||
projectName: project.name,
|
||||
policyId: getEntityId(rule.onCallDutyPolicy),
|
||||
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
|
||||
escalationRuleName:
|
||||
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
|
||||
assignmentType: "team",
|
||||
assignmentDetail: `Via team: ${rule.team?.name ?? "Unknown"}`,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
response.escalationRulesBySchedule.forEach((rule) => {
|
||||
assignments.push({
|
||||
projectId: project._id,
|
||||
projectName: project.name,
|
||||
policyId: getEntityId(rule.onCallDutyPolicy),
|
||||
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
|
||||
escalationRuleName:
|
||||
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
|
||||
assignmentType: "schedule",
|
||||
assignmentDetail: `Via schedule: ${rule.onCallDutyPolicySchedule?.name ?? "Unknown"}`,
|
||||
});
|
||||
});
|
||||
response.escalationRulesBySchedule.forEach(
|
||||
(rule: OnCallDutyEscalationRuleScheduleItem) => {
|
||||
assignments.push({
|
||||
projectId: project._id,
|
||||
projectName: project.name,
|
||||
policyId: getEntityId(rule.onCallDutyPolicy),
|
||||
policyName: rule.onCallDutyPolicy?.name ?? "Unknown policy",
|
||||
escalationRuleName:
|
||||
rule.onCallDutyPolicyEscalationRule?.name ?? "Unknown rule",
|
||||
assignmentType: "schedule",
|
||||
assignmentDetail: `Via schedule: ${rule.onCallDutyPolicySchedule?.name ?? "Unknown"}`,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
return assignments;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,8 @@ export default tseslint.config(
|
||||
module: true,
|
||||
__dirname: true,
|
||||
exports: true,
|
||||
"NodeJS": true
|
||||
"NodeJS": true,
|
||||
"PromiseSettledResult": true
|
||||
},
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
|
||||
Reference in New Issue
Block a user