From 5b8cbd22ff68baf4427549193b1aa7246990c2d8 Mon Sep 17 00:00:00 2001 From: josephjclark Date: Thu, 13 Jun 2024 13:54:09 +0100 Subject: [PATCH] Fix Docs Panel (#2198) * run prettier on docs panel * docs-panel: tweak margins to take up maximum width in vertical alignment, various paddings mean that the component doe not take all the available wwidth, and so the scrollbars are in the wrong place * docs-panel: stop the tabs creating a scrollbar if there isnt enoguh space this created a not very useful double scrollbar in small screens. Now if there isn't enough space, some of the tab is inaccessible. This just has to be how it is - there simply isn't enough screen space * docs-panel: restore overflow-hidden to the editors parent * Update CHANGELOG --------- Co-authored-by: Stuart Corbishley --- CHANGELOG.md | 3 ++ .../js/adaptor-docs/components/DocsPanel.tsx | 54 ++++++++++++------- assets/js/job-editor/JobEditor.tsx | 11 ++-- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a350a3a08..5af0b742b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ and this project adheres to ### Fixed +- Fix vanishing Docs panel when Editor panel is collapsed and opened again + [#2195](https://github.com/OpenFn/lightning/issues/2195) + ## [v2.6.1] - 2024-06-12 ### Changed diff --git a/assets/js/adaptor-docs/components/DocsPanel.tsx b/assets/js/adaptor-docs/components/DocsPanel.tsx index 9724dd2177..7ea458814b 100644 --- a/assets/js/adaptor-docs/components/DocsPanel.tsx +++ b/assets/js/adaptor-docs/components/DocsPanel.tsx @@ -6,27 +6,37 @@ import Function from './render/Function'; type DocsPanelProps = { specifier?: string; onInsert?: (text: string) => void; -} +}; -const docsLink = (

You can check the external docs site at -docs.openfn.org/adaptors. -

) +const docsLink = ( +

+ You can check the external docs site at + + docs.openfn.org/adaptors + + . +

+); const DocsPanel = ({ specifier, onInsert }: DocsPanelProps) => { - if (!specifier) {; + if (!specifier) { return
Nothing selected
; } - + const pkg = useDocs(specifier); - + if (pkg === null) { - return
Loading docs...
+ return
Loading docs...
; } if (pkg === false) { return (

Sorry, an error occurred loading the docs for this adaptor.

- {docsLink} + {docsLink}
); } @@ -35,26 +45,34 @@ const DocsPanel = ({ specifier, onInsert }: DocsPanelProps) => { if (functions.length === 0) { return (
-

{name} ({version})

+

+ {name} ({version}) +

Sorry, docs are unavailable for this adaptor.

- {docsLink} + {docsLink}
); } - + return ( -
-

{name} ({version})

-
These are the operations available for this adaptor:
+
+

+ {name} ({version}) +

+
+ These are the operations available for this adaptor: +
{functions .sort((a, b) => { if (a.name > b.name) return 1; else if (a.name < b.name) return -1; return 0; }) - .map((fn) => )} + .map(fn => ( + + ))}
- ); + ); }; -export default DocsPanel; \ No newline at end of file +export default DocsPanel; diff --git a/assets/js/job-editor/JobEditor.tsx b/assets/js/job-editor/JobEditor.tsx index fb77eadab1..afdb2684b8 100644 --- a/assets/js/job-editor/JobEditor.tsx +++ b/assets/js/job-editor/JobEditor.tsx @@ -155,7 +155,7 @@ export default ({ <>
-
+
{selectedTab === 'docs' && } {selectedTab === 'metadata' && (