import type { Commit } from "@/bindings"; import type { ReactNode } from "react"; import { fontWeightOf } from "@/platform/editorSettings"; import { resolveMonoFont } from "@/platform/fonts"; import { tx } from "@/platform/i18n"; import { useProject } from "@/platform/project"; import styles from "./GitLog.module.css"; const identityText = (text: string): ReactNode => text; export function CommitMessageContent({ commit, message, compact = false, renderText = identityText, revision = commit.shortId, }: { commit: Commit; message: string; compact?: boolean; renderText?: (text: string) => ReactNode; revision?: ReactNode; }) { const editor = useProject((s) => s.settings?.editor); const { family, size } = resolveMonoFont(undefined, editor); const [subject = "", ...bodyLines] = message.trimEnd().split("\n"); const body = compact ? "" : bodyLines.join("\n").replace(/^\n+/, ""); return ( <>