From 5943a2ebbfcaac7d1acde6417aa2080e92c22a33 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 5 Apr 2023 04:42:55 +0100 Subject: [PATCH] add FE context menu to generate docs. fix styles in doc-gen ui --- apps/doc-gen/src/app/App.tsx | 8 +++++--- apps/doc-gen/src/app/docgen-client.ts | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/doc-gen/src/app/App.tsx b/apps/doc-gen/src/app/App.tsx index de6cc7737b..27de6ec2f5 100644 --- a/apps/doc-gen/src/app/App.tsx +++ b/apps/doc-gen/src/app/App.tsx @@ -29,9 +29,11 @@ const App = () => { return (
-

Compile a solidity contract in order to build documentation as markdown.

- {fileName &&
File: {fileName}
} - {hasBuild && } +
Compile a solidity contract in order to build documentation as markdown or right click on a contract and click on "Generate Documentation".
+ {fileName &&
+
File: {fileName}
+
} + {hasBuild && }
) } diff --git a/apps/doc-gen/src/app/docgen-client.ts b/apps/doc-gen/src/app/docgen-client.ts index 802b25ecdb..8cc908a5ba 100644 --- a/apps/doc-gen/src/app/docgen-client.ts +++ b/apps/doc-gen/src/app/docgen-client.ts @@ -56,8 +56,8 @@ export class DocGenClient extends PluginClient { } async generateDocsCustomAction(action: customAction) { - console.log({ action }) - // await this.generateDocs() + await this.call('solidity', 'compile', action.path[0]) + await this.generateDocs() } async docgen(builds: Build[], userConfig?: Config): Promise { @@ -86,6 +86,9 @@ export class DocGenClient extends PluginClient { } async generateDocs() { - this.docgen([this.build]) + this.eventEmitter.on('compilationFinished', async (build: Build, fileName: string) => { + await this.docgen([build]) + }) + this.eventEmitter.off('compilationFinished', () => console.log('remove compilationFinished listener')) } }