{
loadTransform(this.props as any);
}
+ private renderPrompt(id: string, contentRef: string): JSX.Element {
+ if (this.props.hidePrompts) {
+ return <>>;
+ }
+
+ return (
+
+ {(props: PassedPromptProps) => {
+ if (props.status === "busy") {
+ return {"[*]"};
+ }
+ if (props.status === "queued") {
+ return {"[…]"};
+ }
+ if (typeof props.executionCount === "number") {
+ return {`[${props.executionCount}]`};
+ }
+ return {"[ ]"};
+ }}
+
+ );
+ }
+
render(): JSX.Element {
return (
@@ -46,6 +71,7 @@ class NotebookReadOnlyRenderer extends React.Component {
code: ({ id, contentRef }: { id: any; contentRef: ContentRef }) => (
{{
+ prompt: (props: { id: string; contentRef: string }) => this.renderPrompt(props.id, props.contentRef),
editor: {
codemirror: (props: PassedEditorProps) =>
this.props.hideInputs ? <>> :
diff --git a/src/NotebookViewer/NotebookViewer.tsx b/src/NotebookViewer/NotebookViewer.tsx
index 17484b893..e9fca19bb 100644
--- a/src/NotebookViewer/NotebookViewer.tsx
+++ b/src/NotebookViewer/NotebookViewer.tsx
@@ -35,13 +35,19 @@ const onInit = async () => {
const galleryItemJunoResponse = await junoClient.getNotebookInfo(galleryItemId);
galleryItem = galleryItemJunoResponse.data;
}
- render(notebookUrl, backNavigationText, hideInputs, galleryItem, onBackClick);
+
+ // The main purpose of hiding the prompt is to hide everything when hiding inputs.
+ // It is generally not very useful to just hide the prompt.
+ const hidePrompts = hideInputs;
+
+ render(notebookUrl, backNavigationText, hideInputs, hidePrompts, galleryItem, onBackClick);
};
const render = (
notebookUrl: string,
backNavigationText: string,
- hideInputs: boolean,
+ hideInputs?: boolean,
+ hidePrompts?: boolean,
galleryItem?: IGalleryItem,
onBackClick?: () => void
) => {
@@ -51,6 +57,7 @@ const render = (
galleryItem,
backNavigationText,
hideInputs,
+ hidePrompts,
onBackClick: onBackClick,
onTagClick: undefined
};