feat: add generation_mode to RecentArticle and related components
- Updated RecentArticle interface to include generation_mode. - Modified workspace_service to map generation_mode from database. - Adjusted domain model for RecentArticle to accommodate generation_mode. - Enhanced SQL queries to retrieve generation_mode from generation_tasks. - Created ArticleActionGroup component for article action buttons. - Implemented ArticleGenerateStatus component to display generation status. - Developed ArticlePublishStatus component to show publish status and related platforms. - Introduced ArticleSourceMeta component to display article source information. - Added utility functions for article actions and clipboard content generation.
This commit is contained in:
@@ -25,6 +25,18 @@ const platformCatalog: Record<string, Omit<PublishPlatformOption, "accountLabel"
|
||||
dongchedi: { id: "dongchedi", name: "懂车帝", shortName: "懂", accent: "#fadb14" },
|
||||
};
|
||||
|
||||
export function getPublishPlatformMeta(platformId: string): Omit<PublishPlatformOption, "accountLabel" | "bound"> {
|
||||
const normalized = normalizePublishPlatformId(platformId);
|
||||
const fallbackShortName = normalized.slice(0, 1).toUpperCase() || "?";
|
||||
|
||||
return platformCatalog[normalized] ?? {
|
||||
id: normalized,
|
||||
name: normalized || "--",
|
||||
shortName: fallbackShortName,
|
||||
accent: "#667085",
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizePublishPlatformId(platformId?: string | null): string {
|
||||
return String(platformId ?? "").trim();
|
||||
}
|
||||
@@ -73,8 +85,7 @@ export function parseTargetPlatforms(value?: string | null): string[] {
|
||||
}
|
||||
|
||||
export function getPublishPlatformLabel(platformId: string): string {
|
||||
const normalized = normalizePublishPlatformId(platformId);
|
||||
return platformCatalog[normalized]?.name ?? normalized;
|
||||
return getPublishPlatformMeta(platformId).name;
|
||||
}
|
||||
|
||||
export function formatPublishPlatformSummary(value?: string | null): string {
|
||||
|
||||
Reference in New Issue
Block a user