mirror of
https://framagit.org/enfance-libre/statistiques
synced 2025-12-16 15:13:45 +00:00
34 lines
1 KiB
TypeScript
34 lines
1 KiB
TypeScript
|
|
import { Client } from "@notionhq/client";
|
||
|
|
import { createMermaidCodeBlock } from "../blocks/createMermaidCodeBlock";
|
||
|
|
import { createParagraphBlock } from "../blocks/createParagraphBlock";
|
||
|
|
import { createStatGroupChildrenListItemBlock } from "./createStatGroupListItemBlock";
|
||
|
|
import { updatePageContent } from "./updatePageContent";
|
||
|
|
import {
|
||
|
|
StatsGenerales,
|
||
|
|
statsGeneralesDesc,
|
||
|
|
} from "../../../statistiques/v2/generales/StatsGenerales";
|
||
|
|
|
||
|
|
export async function publishStatsGenerales(
|
||
|
|
notionClient: Client,
|
||
|
|
header: string,
|
||
|
|
statsGenerales: StatsGenerales,
|
||
|
|
mermaidDiagramStatsGeneralesMensuelles: string
|
||
|
|
) {
|
||
|
|
const headerBlock = createParagraphBlock(header);
|
||
|
|
const statsBlocks = createStatGroupChildrenListItemBlock(
|
||
|
|
statsGeneralesDesc,
|
||
|
|
statsGenerales
|
||
|
|
);
|
||
|
|
|
||
|
|
const diagramBlock = createMermaidCodeBlock(
|
||
|
|
mermaidDiagramStatsGeneralesMensuelles
|
||
|
|
);
|
||
|
|
|
||
|
|
const blocks = [headerBlock, ...statsBlocks, diagramBlock];
|
||
|
|
await updatePageContent(
|
||
|
|
notionClient,
|
||
|
|
"313751fb-daed-4b33-992f-c86d7ac2de37",
|
||
|
|
blocks
|
||
|
|
);
|
||
|
|
}
|