mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-24 11:10:25 +02:00
- Add @multica/eslint-config package (base, react, next configs) - Replace `next lint` (removed in Next.js 16) with `eslint .` - Add lint scripts to all packages and desktop app - Add noUnusedLocals, noUnusedParameters, noImplicitReturns to base tsconfig - Fix all resulting TS/ESLint errors (unused imports, missing returns, stale eslint-disable comments from legacy eslint-config-next) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import {
|
|
Markdown as MarkdownBase,
|
|
type MarkdownProps as MarkdownBaseProps,
|
|
type RenderMode,
|
|
} from "@multica/ui/markdown";
|
|
import { IssueMentionCard } from "../issues/components/issue-mention-card";
|
|
|
|
export type { RenderMode };
|
|
|
|
export type MarkdownProps = MarkdownBaseProps;
|
|
|
|
/**
|
|
* Default renderMention that delegates to IssueMentionCard for issue mentions
|
|
* and renders a styled span for other mention types.
|
|
*/
|
|
function defaultRenderMention({
|
|
type,
|
|
id,
|
|
}: {
|
|
type: string;
|
|
id: string;
|
|
}): React.ReactNode {
|
|
if (type === "issue") {
|
|
return <IssueMentionCard issueId={id} />;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* App-level Markdown wrapper that injects IssueMentionCard via renderMention.
|
|
* Callers that need custom mention rendering can pass their own renderMention prop.
|
|
*/
|
|
export function Markdown(props: MarkdownProps): React.JSX.Element {
|
|
return <MarkdownBase renderMention={defaultRenderMention} {...props} />;
|
|
}
|
|
|
|
export const MemoizedMarkdown = React.memo(
|
|
Markdown,
|
|
(prevProps, nextProps) => {
|
|
if (prevProps.id && nextProps.id) {
|
|
return (
|
|
prevProps.id === nextProps.id &&
|
|
prevProps.children === nextProps.children &&
|
|
prevProps.mode === nextProps.mode
|
|
);
|
|
}
|
|
return (
|
|
prevProps.children === nextProps.children &&
|
|
prevProps.mode === nextProps.mode
|
|
);
|
|
},
|
|
);
|
|
MemoizedMarkdown.displayName = "MemoizedMarkdown";
|