mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-23 10:08:38 +02:00
- Add GET /api/config endpoint exposing cdn_domain from CLOUDFRONT_DOMAIN - Create packages/core/config/ zustand store, fetched at app startup - Extract file card preprocessing to packages/ui/markdown/file-cards.ts with isCdnUrl(url, cdnDomain) using exact hostname match - Add file card support to packages/ui/markdown/Markdown.tsx (was missing) - Remove hardcoded .copilothub.ai hostname check from file-card.tsx - Fix LocalStorage.CdnDomain() to return hostname not full URL - Always run preprocessFileCards regardless of cdnDomain availability (!file syntax works without CDN domain, only legacy matching needs it) - Use useConfigStore hook in common/markdown.tsx for reactive updates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import {
|
|
Markdown as MarkdownBase,
|
|
type MarkdownProps as MarkdownBaseProps,
|
|
type RenderMode,
|
|
} from "@multica/ui/markdown";
|
|
import { useConfigStore } from "@multica/core/config";
|
|
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
|
|
* and cdnDomain from the config store for file card rendering.
|
|
*/
|
|
export function Markdown(props: MarkdownProps): React.JSX.Element {
|
|
const cdnDomain = useConfigStore((s) => s.cdnDomain);
|
|
return <MarkdownBase renderMention={defaultRenderMention} cdnDomain={cdnDomain} {...props} />;
|
|
}
|
|
|
|
export const MemoizedMarkdown = React.memo(Markdown);
|
|
MemoizedMarkdown.displayName = "MemoizedMarkdown";
|