дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
Clears the React-specific violations reported by oxlint's `perf` category: 123 array-index keys, 28 constructed context values and 6 object/array default props. Keys now use a stable data id where one exists, and the index with a short documented suppression where position is the real identity (editable rows, streams, repeated data). Context values are memoized or hoisted, and default literals are module-level constants. Enabling the `perf` category itself is handled separately; this PR only fixes the violations. Co-authored-by: akbar1214 <[email protected]>
46 рядки
1.5 KiB
TypeScript
46 рядки
1.5 KiB
TypeScript
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 (
|
|
<>
|
|
<div
|
|
className={styles.messageText}
|
|
style={{ fontFamily: family, fontSize: size, fontWeight: fontWeightOf(editor?.fontWeight, 400) }}
|
|
>
|
|
<div className={styles.subjectLine} style={{ fontWeight: fontWeightOf(editor?.boldFontWeight, 700) }}>
|
|
{renderText(subject)}
|
|
</div>
|
|
{body && <div className={styles.fullMessage}>{renderText(body)}</div>}
|
|
</div>
|
|
<div className={styles.meta}>
|
|
{revision} {commit.author} <{commit.email}>
|
|
{commit.timeMs ? " " + tx`on ${new Date(commit.timeMs).toLocaleString()}` : ""}
|
|
</div>
|
|
</>
|
|
);
|
|
}
|